我在我的应用程序中使用ASP.NET身份时出错.
不支持每种类型的多个对象集.对象集"Identity Users"和"Users"都可以包含"Recommendation Platform.Models.ApplicationUser"类型的实例.
我在StackOverflow中看到了一些关于这个错误的问题.全部表示两个DbSet
相同类型的对象.但在我看来DbContext
有不一样的类型DbSets
.FindAsync()
在登录期间抛出方法的异常.
if (ModelState.IsValid)
var user = await UserManager.FindAsync(model.UserName, model.Password);
if (user != null && user.IsConfirmed)
{
Run Code Online (Sandbox Code Playgroud)
问题是我没有两个DbSets
相同的类型.我的上下文看起来像这样:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
public System.Data.Entity.DbSet<RecommendationPlatform.Models.ApplicationUser> IdentityUsers { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
和
public class RecContext : DbContext
{
public RecContext()
: base("RecConnection")
{
Database.SetInitializer<RecContext>(new DropCreateDatabaseIfModelChanges<RecContext>());
}
public DbSet<Recommendation> Recommendations { get; set; }
public DbSet<Geolocation> Geolocations { get; set; } …
Run Code Online (Sandbox Code Playgroud) 我开始开发驱动程序,但是我遵循了一些在这里在线遇到的教程,我正在尝试将我的驱动程序编译成一个简单的 .sys 文件。
代码如下所示:
#include <ntddk.h>
#include <wdf.h>
#define UNREFERENCED_PARAMETER(P) (P)
VOID DriverUnload(PDRIVER_OBJECT driver)
{
DbgPrint("first:HelloWorld End?");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pUnicodeString)
{
DbgPrint("first:HelloWorld Begin?");
pDriverObject->DriverUnload = DriverUnload;
return STATUS_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
我得到了这个非常有趣的错误,而不是编译:
Error C2220 warning treated as error - no 'object' file generated MyHelloWorldDriver C:\Users\****\source\repos\MyHelloWorldDriver\MyHelloWorldDriver\main.c 7
Run Code Online (Sandbox Code Playgroud)
我迷路了,因为我不知道还能从哪里寻求答案。我已经检查并检查了所有,我得到了这个有趣的错误,它在其他版本的 Visual Studio 上工作正常。如果我删除警告,我不会担心,它可以正常编译并且不会向我的屏幕发送任何错误,为什么会这样?
我正在使用 Visual Studio 2019,我可能缺少什么?
聚苯乙烯
我得到的警告看起来像这样
Error (active) E1097 unknown attribute "no_init_all" MyHelloWorldDriver C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\km\ntddk.h 372
Error (active) E1097 unknown attribute "no_init_all" MyHelloWorldDriver C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\km\ntddk.h …
Run Code Online (Sandbox Code Playgroud) 考虑到我有这个div
:
<div class="ResCheckIn">
<div class="ResDtlLabel">
Check-in
</div>
Thursday, October 18, 2018
</div>
Run Code Online (Sandbox Code Playgroud)
我只是想得到字符串"Thursday, October 18, 2018"
,所以排除内部div
.如果我尝试.innerHMTML
:
document.querySelectorAll('.ResCheckIn').innerHTML;
Run Code Online (Sandbox Code Playgroud)
它返回所有内容.ResCheckIn
,包括内部div
类"ResDtlLabel"
,所以这:
<div class="ResDtlLabel tSmall tLight">
Check-in</div>
Thursday, October 11, 2018
Run Code Online (Sandbox Code Playgroud)
理想情况下,我希望不使用jQuery就能做到这一点.
我已经0 || -0
在Chrome开发者控制台中测试了以下代码,-0
结果又回来了,我试图找出原因。该表表示不同JS环境中的结果。
????????????????????????????????????????????????????????
? Browser ? Version ? 0 || -0 ?
????????????????????????????????????????????????????????
?Internet Explorer 11 ? 11.3024.14393.0 ? 0 ?
?Google Chrome ? 75.0.3770.100 ? -0 ?
?Mozilla Firefox (Quantum) ? 67.0.4 ? -0 ?
?Microsoft Edge (Chromium) ? 77.0.197.1 ? -0 ?
?Microsoft Edge (Chakra) ? 44.17763.1.0 ? 0 ?
?Node.js ? 11.1.0 ? -0 ?
????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)
我的假设是,在第一种情况下,当位于-0
右侧时,结果为-0
,但是当位于左侧时,结果为0
。这使我相信,在二进制逻辑“或”运算-0
期间,当位于左侧时,将丢弃符号位(无论出于何种原因),并且这样执行运算。同时,当它在右侧时,因为该运算符存在,所以它可能在数字上添加了一个符号位,这导致右侧数字多了一位,从而导致右侧值被返回。0 || 0 …
c# ×2
javascript ×2
asp.net ×1
asp.net-mvc ×1
c ×1
color-scheme ×1
dom ×1
driver ×1
html ×1
innerhtml ×1
resharper ×1