【问题标题】:Can I extend a EntityCollection<Class> : LINQ to SQL我可以扩展 EntityCollection<Class> 吗:LINQ to SQL
【发布时间】:2010-01-08 05:45:25
【问题描述】:

我可以扩展或使用部分类来添加更多功能吗? EntityCollection

例如。

这是从 LINQ 到 SQL 自动生成的类

客户.订单

我希望能够做到

customer.Orders.FindByOrderID(orderID)

但 Order 是 EntityCollection

我可以像只使用 Order 类一样将其设为部分类或扩展它吗?

【问题讨论】:

    标签: c# .net linq-to-sql partial-classes


    【解决方案1】:

    是的,我可以

    public static class OrderExtension
    {
        public static Order FindByOrderID(this EntityCollection<Order> orders, String orderID)
        {
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-05
      • 1970-01-01
      • 2011-08-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多