entity framework - Why can't EF assign my child collection when the constructor is private? -
i have entity looks this
public class slideset { public slideset(string name) : this() { name = name } public slideset() { params = new hashset<slidesetparameter>(); } [required] public string name { get; set; } public virtual icollection<slidesetparameter> params { get; set; } } i noticed i'm not using second constructor ever , makes no sense in domain made private. of sudden params array stopped loading , gives me length of 0. what's going on? in order load need constructor @ least protected. why?
one of conditions ef able create proxies (necessary lazy loading)
the class must have public or protected parameter-less constructor.
from here (an old link, part still applies)
the proxy derived type , must able call parameterless constructor of base type.
Comments
Post a Comment