You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using .net Core 2.2 and EFCOre 2.2.6 and having error for Owned Type
Hers is my code
public class StorageSummary
{
public int Id { get; set; }
public StorageDetailSummary Original { get; set; }
public StorageDetailSummary Initial { get; set; }
public StorageDetailSummary Accepted { get; set; }
}
[Owned]
public class StorageDetailSummary
{
public decimal? PrimaryTow { get; set; }
public decimal? LaborCost { get; set; }
}
In dbcontext
modelBuilder.Entity<StorageSummary>(table =>
{
table.OwnsOne(
a => a.Original,
original =>
{
original.Property(x => x.PrimaryTow).HasColumnName("OriginalPrimaryTow");
original.Property(x => x.LaborCost).HasColumnName("OriginalLaborCost");
});
});
When I add to dbCOntext and SaveChanges I get the error as
The entity of type 'StorageSummary' is sharing the table 'StorageCheck.StorageSummaries' with entities of type 'StorageSummary.Initial#StorageDetailSummary', but there is no entity of this type with the same key value that has been marked as 'Added'. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.
The text was updated successfully, but these errors were encountered:
I am using .net Core 2.2 and EFCOre 2.2.6 and having error for Owned Type
Hers is my code
When I add to dbCOntext and SaveChanges I get the error as
The entity of type 'StorageSummary' is sharing the table 'StorageCheck.StorageSummaries' with entities of type 'StorageSummary.Initial#StorageDetailSummary', but there is no entity of this type with the same key value that has been marked as 'Added'. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.
The text was updated successfully, but these errors were encountered: