2
I have a queryable (Linq to entities) in the Entityframework and I’m not able to pull data from two or more tables.
For example:
var model = _service.List().Where(m => m.DS_GRUPO.Contains(searchString)).Select(m => new { m.PK_GRUPO, m.DS_GRUPO, m.SUBGRUPO.DS_SUBGRUPO }).ToList();
Here I do a search and from the search result I select only the data I will use, they are: the properties m.PK_GRUPO and m.DS_GRUPO are OK, both are string type already a m SUBGROUP is a Icollection of the Subgroup class and need to take also m.SUBGRUPO.DS_SUBGRUPO that I’m not getting.
Does anyone know how I can get this other property?
The Include method does not appear! The people here in the service use a service that instantiates a repository. So _service.List().
– Trxplz0
Got it. Some method returns a
DbSet
? You can ask your question about the repository implementation?– Leonel Sanches da Silva
I figured out the mistake, I made a mix-up in setting the parameters. In case I need to list the Group and not in the Subgroup, because the Group should contain a list of sub groups. Thanks anyway! How should I proceed to finalize this question? I request the exclusion or put the answer?
– Trxplz0
@Trxplz0 Post your reply and mark it as accepted.
– Leonel Sanches da Silva