var providerTypes = from provider_types in dbContext.vw_LookUpProviderType select new vw_LookUpProviderType { ApplicationUser = provider_types.ApplicationUser, ProviderTypeId = provider_types.ProviderTypeId, Type = provider_types.Type }; var query = from providerCoi in dbContext.Provider_COI where providerCoi.COIProviderId == message.ProviderId join providerDetail in dbContext.ProviderDetail on providerCoi.ProviderId equals providerDetail.ProviderId into providerDetails from providerDetail in providerDetails.DefaultIfEmpty() };我选择了 providerTypes。有表 providerDetails,并且有字段 providerTypeIds - 这是无法更改的。例如providerTypes: [1: 'Type 1', 2: 'Type 2', 3: 'Type 4']和providerTypeIds: '1,2,':从 providerTypes 中选择可以在 providerIdsString 中找到的类型 providerTypes.Where(providerType => providerDetail.ProviderTypeIds.Contains(providerType.ToString())) // => [1: 'Type 1', 2: 'Type 2']比选择字符串表示: .Select(providerType => providerType.Type) // => ['Type 1', 'Type 2']最后将它们全部转换为以逗号分隔的类型字符串: .ToArray<string>() .Aggregate((current, next) => current +", " + current) // => 'Type 1, Type 2这是抛出异常LINQ to Entities 无法识别方法“System.String Aggregate[String](System.Collections.Generic.IEnumerable 1[System.String], System.Func3[System.String,System.String,System.String])”
1 回答
- 1 回答
- 0 关注
- 140 浏览
添加回答
举报
0/150
提交
取消