Query partial properties of an object in NHibernate

We can use the classes in the NHibernate.Transform namespace to get partial properties of an object.

 

var rs  =   this .CurrentSession.CreateCriteria < IDiamond > ()
    .CreateAlias(
" Vendor " " Vendor " )
    .SetProjection(
global ::NHibernate.Criterion.Projections.ProjectionList()
        .Add(
global ::NHibernate.Criterion.Projections.Property( " Id " ),  " Id " )
        .Add(
global ::NHibernate.Criterion.Projections.Property( " StockNumber " ),  " StockNumber " )
        .Add(
global ::NHibernate.Criterion.Projections.Property( " Vendor.Name " ),  " VendorName " ))
    .SetResultTransformer(
global ::NHibernate.Transform.Transformers.AliasToBean < TestResult > ())
    .List
< TestResult > ();

 

 

你可能感兴趣的:(properties)