The fact that you inherit from EntityBase doesn't matter to NHibernate. Just map the class as if it had contained the Id property itself. Note that all properties must be "virtual".
/G 2017-12-17 14:57 GMT+01:00 Abdul Samad <[email protected]>: > If you use Fluent NHibernate, You can create a ProductMap class which > automatically does few mappings except for ForiegnKeys. > > Also if you dont want to use Fluent, then you may need to go with XML > Mapping files .hbm. > > Please refer the below link for Fluent https://github.com/ > jagregory/fluent-nhibernate/wiki/Fluent-mapping > > > On Thursday, December 14, 2017 at 5:35:34 PM UTC+5:30, [email protected] > wrote: >> >> Thanks first! >> >> I'm new to NHibernate. I use version 4.X. >> >> I have a base entity class like this: >> public abstract class EntityBase<TId> >> { >> public TId Id { get; set; } >> >> // omit other method members >> } >> >> then, I have a derived class like this: >> public class Product:EntityBase<int> >> { >> public string Name { get; set; } >> public decimal Price { get; set } >> >> // omit other members >> } >> >> Now, could anybody teach me how to map Id, Name, Price these three >> properties into one data table like this: >> >> ------------------------------------- >> Id | Name | Price >> ------------------------------------- >> >> Thanks anyway! >> >> -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
