开发者

Type inference failed in the call to 'SelectMany'

开发者 https://www.devze.com 2023-03-07 01:02 出处:网络
I have this LINQ query: var businessAffiliates = from b in context.Businesses from ba in b.BusinessOfficers

I have this LINQ query:

        var businessAffiliates = from b in context.Businesses
                                 from ba in b.BusinessOfficers
                                 from p in ba.Person                                     
                开发者_开发问答                 select b;

but I am getting this error:

An expression of type 'myproj.Models.Person' is not allowed in a subsequent from clause in a query expression with source type 'System.Linq.IQueryable'. Type inference failed in the call to 'SelectMany'.


It looks like ba.Person it a single object, but the from clause expects a sequence of objects. if you replace that line with let p = ba.Person then it would work. But i wonder why you need those additional from clauses.

0

精彩评论

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

关注公众号