Came up with a useful little extension method today. I wanted the fluent nhibernate configuration to export the hbm files when the site is being run in debug mode.Where the path refers to an application setting in the app.config.
Thursday, 23 September 2010
Monday, 24 May 2010
Tuesday, 4 May 2010
For several of my projects I use a repository pattern for the data access layer which sits above Fluent NHibernate. Using generics I can then replicate the same features for all entity repositories.
An example of the base interface is shown below.
Then a base class to implement this interface - as follows:
Then say if I have an entity called 'Mountain' I would name a repository 'MountainRepository' which implements the interface IMountainRepository:
and concrete implementation:
So the repository classes are all simpler and I have still access to the 20 odd base methods which have all the basic NHibernate functionality required.