✅ List<KeyValuePair<Trader, long>> requires primary key to be defined
This is my main model i'm trying to pass
with Trader as
with a basic database
for some reason, passing a Item class through this this method
throws the error in the title
is there a way to set List<KeyValuePair<Trader, long>> to be keyless?
6 Replies
How would you expect a
List<KeyValuePair<Trader, long>>
to be represented in the database?
Also, what database are you using?EntityFrameworkCore.InMemory
Right, so it probably does not support JSON columns
ah...
would there be an alternative way to store something like this than?
with proper order? or would I need to use something else?
I'd rethink your schema completely
It's a relational database, so use that fact
No need for the whole trader to be a key anywhere
An ID is enough
I'd have a
Trader
, an Item
, and a TraderPrice
TraderPrice
referencing both item and trader
Something like
Something like thatok thank you o/