是
if (!test(v))
与
相同if (test !== v)
如果没有,我只是想知道 if(!test(v))是什么意思?
答案 0 :(得分:4)
public class AppDbContext : IdentityDbContext<MkpUser, MkpRole, Guid, MkpLogin, MkpUserRole, MkpClaim>
{
#region Constructors
public AppDbContext()
: base("IdentityConnection")
{
}
#endregion
#region Methods
public static AppDbContext Create()
{
return new AppDbContext();
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Map Entities to their tables.
modelBuilder.Entity<MkpUser>().ToTable("User");
modelBuilder.Entity<MkpRole>().ToTable("Role");
modelBuilder.Entity<MkpClaim>().ToTable("UserClaim");
modelBuilder.Entity<MkpLogin>().ToTable("UserLogin");
modelBuilder.Entity<MkpUserRole>().ToTable("UserRole");
// Set AutoIncrement-Properties
modelBuilder.Entity<MkpUser>().Property(r => r.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
modelBuilder.Entity<MkpClaim>().Property(r => r.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
modelBuilder.Entity<MkpRole>().Property(r => r.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
// Override some column mappings that do not match our default
modelBuilder.Entity<MkpUser>().Property(r => r.UserName).HasColumnName("Email");
modelBuilder.Entity<MkpUser>().Property(r => r.PasswordHash).HasColumnName("Password");
}
#endregion
}
是一个函数,test
是传递给函数的参数。您正在测试函数的结果:
v
与:
相同if (!test(v))
if (!!test(v) == false)
会将结果强制转换为布尔值。