I am learning about web services and the book I am using is pulling data from SQL server using the entity framework (which I know little about too).
Unfortunately the classes created by the entity framework contain things like:
public Conference()
{
this.Sessions = new HashSet<Session>();
}
public virtual ICollection<Session> Sessions { get; set; }
Which causes a problem because an interface is not serialisable:
Cannot serialize member X of type System.Collections.Generic.ICollection ... because it is an interface.
Now I could (and did) modify the generated classes to use concrete classes but if I ever need to regenerate the entities then that change will be undone. Ideally I could tell the entity framework to generate something like this (or even better, have control of the concrete type so I could tell the entity framework to use a List if I want to):
public Conference()
{
this.Sessions = new HashSet<Session>();
}
public virtual HashSet<Session> Sessions { get; set; }
Is it possible? If so, how?