C
C#13mo ago
Klepsi ⚦

C# Entity core framework gaslighting

modelBuilder.Entity<Transaction>().Property("ItemsSoldAndAmount").IsRequired();
modelBuilder.Entity<Transaction>().Property("ItemsSoldAndAmount").IsRequired();
public class Transaction
{
...
[Required]
public List<AmountItem> ItemsSoldAndAmount { get; set; } = new List<AmountItem>();
...
}
public class Transaction
{
...
[Required]
public List<AmountItem> ItemsSoldAndAmount { get; set; } = new List<AmountItem>();
...
}
public class AmountItem
{
[Required]
public ObjectId Identifier { get; set; }
[Required]
public Item? Item { get; set; }
[Required]
public double amount { get; set; }
}
public class AmountItem
{
[Required]
public ObjectId Identifier { get; set; }
[Required]
public Item? Item { get; set; }
[Required]
public double amount { get; set; }
}
how is this not supported by the database when a List<> in another POCO of mine is OK??
2 Replies
Ꜳåąɐȁặⱥᴀᴬ
does the other List<> have a mapping set up in the model builder?
Klepsi ⚦
Klepsi ⚦OP13mo ago
yeah

Did you find this page helpful?