Fluent configuration

If you are using FNH for declaring mappings, then loquacious configuration is not an option. This is mainly because loquacious configuration would not be able to recognize fluent mappings. Besides that, FNH offers its own fluent API to configure session factory. The fluent API is more or less similar to loquacious API in terms of functionality offered. But fluent API tries to be less verbose as compared to loquacious. Let's do the same configuration we did using loquacious configuration, but using fluent API this time:

var fluentConfig = Fluently.Configure() .Database(SQLiteConfiguration.Standard.InMemory() .ShowSql().FormatSql()) .Mappings(mapper => { mapper.FluentMappings.Add<EmployeeMappings>(); mapper.FluentMappings .Add<CommunityMappings>(); ...

Get Learning NHibernate 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.