I would like to use a lazy-loading collection on a model, but I want Add/Remove functionality to be done through separate methods. So something like this:
class Model
{
protected virtual ICollection<Something> _somethings { get; set; }
public IEnumerable<Something> Somethings
{
get { return _somethings; }
}
public void AddSomething(Something thingToAdd)
{
/* logic */
_somethings.Add(thingToAdd);
}
}
I can't figure out how to configure the mapping for this. I looked into using a configuration class: EntityConfiguration. But since the property is protected I can't figure out how to set a configuration on it. Is there any way to accomplish what I'm trying to do here?