How to load only certain columns using fluentnhibernate?

I want to know how I can fill only certain columns when filling an entity object?

I am interested in certain properties of the object and not all.

but when I use the session to retrieve the object, it sends a request, for example, "select * from Customer".

but I want to do "Select customerName from customer."

I think this has something to do with LazyLoad (), but I don’t know exactly how.

Any help would be greatly appreciated.

Thanks Advance, Ashish

+3
source share
1 answer
var defs = session.CreateCriteria(typeof(test));
defs.SetProjection(Projections.ProjectionList()
    .Add(Projections.Property("FirstColumn"));
+2
source

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