Мне нужно хранить пары ключей / значений безопасного объекта в EF Core.
Типы ключевых значений
// KeyValuePair<string,bool>
// KeyValuePair<string,int>
// KeyValuePair<string,string>
// KeyValuePair<string,float>
// KeyValuePair<string,DateTime>
Сущность
public class MyEntity
{
public int Id { get; set; }
public List<KeyValuePair<string,T>> Attributes { get; set; }
}
В другом месте
{
…
dbContext.MyEntity.Add(new KeyValuePair<string,bool>("Active", true);
dbContext.MyEntity.Add(new KeyValuePair<string,string>("Customer", "Microsoft");
dbContext.MyEntity.Add(new KeyValuePair<string,string>("Street", "1 Microsoft Way");
dbContext.MyEntity.Add(new KeyValuePair<string,float>("Rating",5.0);
}
Как это можно сделать в EF Core?