Entity Framework 将 List 对象添加到 Repository.EFModel

问题描述 投票:0回答:0

我有两组数据:customercurrentGroupSubscriptions,我想在其中添加到 EF select 语句。 customercurrentGroupSubscriptions 是一个列表,我正在尝试在 EFModel select 中使用该数据,但收到有关

edm type is ambiguous
的错误,我需要做任何不同的事情才能使它工作吗?

错误

Schema specified is not valid clr types

代码

     var customercurrentGroupSubscriptions = customergroupSubscriptions.GroupBy(r => r.GroupId)
         .Select(g => g.OrderByDescending(r => r.EndDate.Value).FirstOrDefault())
         .Select(i => new CustomerGroupSubscriptions
            {
                SubscriptionId = i.SubscriptionId,
                GroupId = i.GroupId,
                EndDate = i.EndDate
            }).ToList();

     var SubscriptionsForGroupSubscription = (from s in db.Subscriptions
        join i in customercurrentGroupSubscriptions on s.SubscriptionId equals i.SubscriptionId
          select new IndividualGroupSubscription
                 {
                     OriginalSubscriptionId = s.OriginalSubscriptionId
                 }
      ).toList();
c# entity-framework
© www.soinside.com 2019 - 2024. All rights reserved.