开发者

Using IList in Entityframework 4.1

I have this code where all objects are created by Entity Framework 4.1:

public void UpdateCustomer(int CustomerID, IList<O开发者_如何学Gorder> CustomerOrders)
  {
     foreach (var OrderItem in CustomerOrders)
      {
        Customer.Order = OrderItem;
      }

  }

When I try to assign OrderItem to Customer.Order, I receive the following error:

Error 15 Cannot implicitly convert type 'Order' to 'System.Data.Objects.DataClasses.EntityCollection'

What am I doing wrong here, and how can this be fixed?


You should assign collection of orders not an order

foreach (var OrderItem in CustomerOrders)
    Customer.Order.Add(OrderItem);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜