How to map LINQ EntitySet to List property in property setter?

Posted by jlp on Stack Overflow See other posts from Stack Overflow or by jlp
Published on 2010-06-14T14:45:39Z Indexed on 2010/06/14 21:32 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

In my model I have these entities:

public interface IOrder
{
   string Name {get;set;}
   List<IProduct> OrderedProducts {get;set;}
}

public interface IProduct {}

In partial class generated by linq-to-sql I map these properties on my entity properties:

public partial class Order : IOrder
{
   List<IProduct> OrderedProducts
   {
      get { return this.L2SQLProducts.Cast<IProduct>.ToList(); }
      set { this.L2SQLProducts = ??? }
   }
}

How should setter look like?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET