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?
. , Transformers.AliasToBean LINQ.
Transformers.AliasToBean
:
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 , , , .
. , , , , . "" .
Entity BLOB- ( ..).
, , :
public class ImageWithData:
, NHibernate, ImageWithData , ( BelongsTo HasMany).
NHibernate , = "", ( , ).
, , , .