Nhibernate linq: projecting on DTO and columns

I recently upgraded the Linq provider to the new AST. (NH3 on NuGet)

With the previous provider, I used linq to do in-built forecasts for my DTO "for example

from o in Session.Query<MyObject>() 
select new MyObjectDTO { 
Name = o.Name, 
SubName = o.OtherObject.Name, 
Sub2NAme = o.OtherObject2.Name 
} 

and it will create

SELECT o.Name, sn1.Name, sn2.Name FROM ..... 
JOIN.... JOIN....

statement.

As soon as I updated my provider, I found many select suggestions, shot. (My projected object is more complex than higher). I came through Fetch / FetchMany, which can help with the number of requests, but as far as I can tell, this means that the full object will be back for every flattened field that I need.

Is there a way to get the minimum possible number of columns needed to select a projection, instead of loading the complete object graph into the project using <

Thank you, Chris

+3
1

- (, IQueryable), - - , .

, SQL.

+1

Source: https://habr.com/ru/post/1774986/


All Articles