c# DbSet - Internal object association cannot be g

2019-08-28 01:31发布

问题:

I have the same problem of this topic. but on the association between entities.

internal virtual ICollection<Adress> Adresses { get; set; }

It works if I use like this:

public virtual ICollection<Adress> Adresses { get; set; } 

How can I initialize Adresses ?

回答1:

Entity Framework will only work with public properties. If you want to use different access modifies you should check out nHibernate.