I am working on a large database project (see article on news aggregator for trading) and don’t want to a) use stored procedures and b) don’t want to have to code loads of NHibernate mapping files and logic. I looked at various different technologies for code generation and chose CodeSmith mainly because I still have [...]
Archive for the ‘NHibernate’ Category
Using CodeSmith and Plinqo templates to generate NHibernate ORM layer
Posted in Automated Code Generation, NHibernate, ORM, tagged codesmith, NHibernate, plinqo on February 28, 2012 | Leave a Comment »
Setting up Castle Windsor IOC for web applications
Posted in Architecture, Castle Windsor, Design Patterns, IOC, NHibernate, ORM, TDD, tagged c#, Castle Windsor, Design Patterns, domain, IOC, loosely coupled, Mapping files, NHibernate, ORM, separation of concerns, test driven design, web architecture on September 27, 2010 | 2 Comments »
I recently wrote a post about how to set up CW’s IOC container for applications. This post covered the most basic implementation to get an IOC container up and running. It is now time to cover a proper architecture for using IOC specifically for web applications / sites. The main problem with the previous implementation [...]
Debugging NHibernate with log4net
Posted in NHibernate, tagged debugging, log4net, NHibernate, ORM on April 11, 2010 | Leave a Comment »
Why are the errors to do with mapping from NHibernate so damn cryptic! As NHibernate uses Log4Net I added the following XML to an app.config file to my test project, included the log4net.dll reference and added this line of code to the TestFixture method to initialize Log4Net. log4net.Config.XmlConfigurator.Configure(); The config xml is: <?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> [...]
NHibernate sessions and units of work
Posted in Architecture, NHibernate, ORM, TDD, tagged loosely coupled, NHibernate, ORM, separation of concerns, sessions, unit of work, web architecture on April 5, 2010 | Leave a Comment »
My understanding of the NHibernate Session is that in the case of a web application, the ISession should be created and destroyed with each HttpRequest. This is probably the most efficient use of the session and enables easy use of lazy loading within a single request. Sessions do not require much overhead to create and [...]
Many to Many insert in NHibernate
Posted in NHibernate, ORM, TDD, tagged many to many, Mapping files, NHibernate, ORM on April 5, 2010 | Leave a Comment »
This has probably been covered in a thousand blogs and technical articles but I couldn’t find one that covered this exact scenario, so here goes.. When adding a row to the link table between two entities in a many to many relationship, I wanted to make sure a single row is saved in the database but both [...]
NHibernate with reserved SQL words
Posted in NHibernate, ORM, tagged Mapping files, NHibernate, ORM, reserved words on April 1, 2010 | Leave a Comment »
I am working on a legacy system where some of the database tables are called the same names as SQL reserved words. One example is the the table User. If you define your class as the name of the table, i.e. User, then the mapping will succeed but any queries will fail. If you are [...]
Not using Castle Active Record
Posted in Architecture, Castle Active Record, NHibernate, ORM, tagged active record, Castle Active Record, fluent hibernate, Mapping files, NHibernate, ORM on March 30, 2010 | Leave a Comment »
After a lot of thought I have decided not to use Castle’s Active Record. (http://www.castleproject.org/ActiveRecord/) The main reason for this is that I don’t see much benefit to adding properties to my classes other than not having to change things in both the class and XML, and the hassle of finding a code generator for [...]
Code Generation for Castle Active Record
Posted in Castle Active Record, NHibernate, ORM on March 30, 2010 | 2 Comments »
As I am going to be using an Active Record as the pattern of choice to access my repository, I decided to use Castle’s Active Record as this comes highly recommended to me from colleagues and I use the Windsor framework for IoC so I know they are good. The first thing I wanted was a [...]
NHibernate – No persisters found for MyClass
Posted in NHibernate, ORM, tagged domain, IOC, Mapping files, NHibernate, ORM on March 28, 2010 | 1 Comment »
I recently cam across this error when using NHibernate mapping files. I googled this issue and found a wide variety of solutions that other developers had marked as successful, however none of them worked for me. I put together a small test project to experiment with why this error appears and have found the following [...]