Using the Lite version of Entity in nHibernate Relationships?

It is a good idea to create a lighter version of Entity in some cases only for performance reasons, pointing to the same table, but with fewer columns mapped. For example, if I have a contact table in which there are 50 columns, and in some of the related objects I may be interested in the FirstName and LastName property, then it’s nice to create a light version of the contact table. For instance.

public class ContactLite
{
   public int Id {get; set;}
   public string FirstName {get; set;}
   public string LastName {get; set;}

}

Is it also possible to map multiple classes in one table?

+5
source share
3 answers

. , Transformers.AliasToBean LINQ.

:

var lightContacts = (from contact in session.Linq<Contact>()
                     where contact.Country = "Argentina"
                     select new LightContact
                            {
                                Id = contact.Id
                                FirstName = contact.FirstName,
                                LastName = contact.LastName
                            })
                    .ToList();

, .

, LINQ , , , .

+4

. , , , , . "" .

+5

Entity BLOB- ( ..).

, , :

public class ImageWithData:

, NHibernate, ImageWithData , ( BelongsTo HasMany).

NHibernate , = "", ( , ).

, , , .

+1

All Articles