I would like the below ICollection property in one of my data classes (let\'s call it \"Foo\")
public class Foo
{
[Key]
public int FooId { get; set;
EF can only work with entity classes. Each entity class must have defined primary key so the minimum in your scenario is:
public class StringData
{
public int Id { get; set; }
public string Data { get; set; }
}
or worse
public class StringData
{
[Key]
public string Data { get; set; }
}
Now you can define collection of StringData to map it as related table:
public virtual ICollection AllowedBars { get; set; }