I have an issue with Code First. I just migrate the project from Model First to Code First and I think that Entity Framework is losing its mind... Here is my class (simplified) :
public class MyClass
{
// Key, other properties...
public bool? MyNullBoolean { get; set; }
public static void Configure(EntityTypeConfiguration<MyClass> myClass)
{
// Other configuration on other properties...
myClass.Property(m => m.MyNullBoolean).IsOptional();
}
}
Here are some additionnal informations for you :
Configure()
method in the OnModelCreating()
method. MyNullBoolean = c.Boolean(nullable: false)
, so EF is acting like this property is required, wich is not as previously seen. Here is what I tried :
I'm out of idea and I found nothing in the Internet. Thanks for your help guys !
I think that EF was corrupted because when I uninstall it, clean the solution, install it, rebuild the solution, it worked.
So there was no problem with db or my model.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.