Klepsi
Klepsi
CC#
Created by Klepsi on 4/1/2024 in #help
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??
3 replies
CC#
Created by Klepsi on 3/31/2024 in #help
how to embed?
I need to embed these objects in this large object
[Collection("warehouse.transactions")]
public class Transaction
{
public ObjectId id { get; set; } = ObjectId.GenerateNewId();
[Required]
public DateTime Time { get; set; } = DateTime.UtcNow;

[Required]
public double Amount { get; set; }

[Required]
public Item? Item { get; set; }

[Required]
public Warehouse? Warehouse { get; set; }

[Required]
public Buyer? Buyer { get; set; }

[Required]
public Staff? Staff { get; set; }
}
[Collection("warehouse.transactions")]
public class Transaction
{
public ObjectId id { get; set; } = ObjectId.GenerateNewId();
[Required]
public DateTime Time { get; set; } = DateTime.UtcNow;

[Required]
public double Amount { get; set; }

[Required]
public Item? Item { get; set; }

[Required]
public Warehouse? Warehouse { get; set; }

[Required]
public Buyer? Buyer { get; set; }

[Required]
public Staff? Staff { get; set; }
}
but I keep getting errors about shadow properties (EntityFramework 7 Mongodb) how would I do this?
2 replies
CC#
Created by Klepsi on 3/30/2024 in #help
csharp infinite loop caused by Identity store provider
I have made my own provider and everything looks fine but c# keeps stackoverflowing
4 replies