选择刚刚添加的属性

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

我有问题参考我刚刚在languageId创建的Select。我知道不能以这种方式完成,因为m.中的m.languageId不是我想要的。

 var problem = await DataContext.ShopsProducts
                .Select(m => new
                {
                    languageId = m.Shop.LanguageId,
                    name = m.Product.LocalizedProductDetails.Select(
                        n => n.LanguageId == **m.languageId**);

我知道我可以将m.languageId替换为m.Shop.LanguageId,但这在我的项目中已经相当长了,并且在Select中有更多的引用。有没有办法,或者我应该在整个查询之前从Db中取出它?

c# .net linq select core
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.