
NHibernate XML got you down? Fluent NHibernate attempts to balance a fluent interface and convention over configuration to make it easier to map business entities to your database without XML.
Using Fluent NHibernate, NHibernate Mappings may look like this-
public CustomerMap : ClassMap<Customer>
{
public CustomerMap()
{
Id(x => x.ID);
Map(x => x.Name);
Map(x => x.Credit);
HasMany<Product>(x => x.Products)
.AsBag();
Component<Address>(x => x.Address, m =>
{
m.Map(x => x.AddressLine1);
m.Map(x => x.AddressLine2);
m.Map(x => x.CityName);
m.Map(x => x.CountryName);
});
}
You can learn more about Fluent NHibernate here.
A new book coming out on NHibernate as well. I am reading it now:
NHibernate in Action
Related Posts: