entity framework - Get just Count values from EF -
I have a table table, I need a way that returns a person by ID, number of cars, Number of houses, etc.
Do I have to load this table together? I see that SEL generated by EF is a monster.
Ex:
get public people () {reference context. People include ("car"). "Houses"). Where (x => x.Id = 1). first (); }
My view used:
name: & lt;% = people.Name% & gt; Cars: & lt;% = people.Cars.Count% & gt; Houses: & lt;% = People. House.Count% & gt;
you can do
var results = (In PTX with PEs, where people select PIID == 1 new {person = P, cars = p.seres.count (), house = p.house.count ()}) first orphalt ();
That will just bring back what matters.
Comments
Post a Comment