I have a POCO (Plain Old CLR Object)
public Foo
{
public virtual int Id { get; set; }
public virtual Dictionary<string, string> Stuff { get; set; }
public virtual string More { get; set; }
}
Using the model first approach (i.e. I don’t have a data model yet), how would I handle persisting Stuff (Dictionary)?
This is not a true answer to the question, but since there are no other replies, I’ll share what I did.
I simply created a new type
{Id, Code, Text}and replaced my dictionary with a list of that type. I then do something like this to get the keys, values, or do a lookup:In my case the number of entries in the dictionary tends to be small. However, see this question for performance considerations when the dictionary/list is large.