Musings<Biefeld>
- curiosities of development, life, the universe and everything -
Archive for the ‘Uncategorized’ Category
Monday, February 1st, 2010

How are things…
Things are things
People are people
I am neither
Things nor people
I am me
you are you
Next time ask
How do you do

Monday, July 13th, 2009

A while ago I was having issues using configuring fluent NHibernate with an external configuration file. I kept running into the issue of mappings not being registered. I was finally able to get it working appropriately and thought I would share my solution. The key is to configure the normal mappings first and then pass that configuration in when configuring fluent NHibernate.

string configFile = "hibernate.cfg.xml";

//setup the normal map configuration
Configuration normalConfig = new Configuration().Configure(configFile);

//setup the fluent map configuration
Fluently.Configure(normalConfig)
.Mappings(
m => m.FluentMappings
.ConventionDiscovery.Add(DefaultLazy.AlwaysFalse())
.AddFromAssemblyOf<UserMap>())
.BuildConfiguration();

Musings<Biefeld> is proudly powered by WordPress
Entries (RSS) and Comments (RSS).