The Include path expression must refer to a navigation property defined on the type.in eager loading

asp.net c# entity-framework entity-framework-6 linq

Question

I make an effort to use anonymous type, like this: All of it,incomelist additional qualities toCompanyTitle ,PeriodTypeName )

 var incomeList = ctx.IncomeLists.Include(i => new
                {
                    CompanyTitle = i.CompanyId.ToString() + "/" + i.Company.CompanyName,
                    PeriodTypeName = i.ListPeriods.Select(lp => lp.PeriodType.PeriodTypeName)
                }).ToList()

This is how my model part looks: enter image description here

yet, I encounter the following exception:

The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties. Parameter name: path

The datasource for Gridview should be the outcome.

1
15
7/30/2016 5:07:06 PM

Accepted Answer

ZZZ_tmp
23
9/28/2017 5:04:38 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow