Download zip file: https://filebin.net/t4kbp61pvwd7tnbq
Tried using regenerate storage and remapping, this should fix the issue, but it does not fix this issue?
ApplicationDbContext.cs: the error occurs in the address table, column "name", the model displays name is nullable, when the code is generated "name" is always required (line 130)
Generated code:
"modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").IsRequired().ValueGeneratedNever();"
It should be:
modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").ValueGeneratedNever();
Code: Select all
private void AddressMapping(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Address>().ToTable(@"Addresses", @"public");
modelBuilder.Entity<Address>().Property(x => x.Id).HasColumnName(@"Id").IsRequired().ValueGeneratedNever();
modelBuilder.Entity<Address>().Property(x => x.AccountId).HasColumnName(@"AccountId").IsRequired().ValueGeneratedNever();
modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").IsRequired().ValueGeneratedNever();
modelBuilder.Entity<Address>().Property(x => x.Company).HasColumnName(@"Company").ValueGeneratedNever();
......
}
---------
EntityDeveloper should update the efml file from not-null="True" to not-null="False" but it does not do this (even when the model is regenerated using "regenerate storage and remapping" option)
Code: Select all
<property name="Name" type="String" p1:nullable="True" p1:ValidateRequired="false" p1:Guid="e4076478-def9-42fe-9d3c-a7b3bf68b179">
<column name="" not-null="True" p1:unicode="True" />