Developers, Technology Evangelists, Bros.

Category: ORM

NHibernate Map by Code Examples – Part 2

This post is the second post in a multi-part series of examples for NHibernate‘s Map by Code feature.  Code in this series has been tested with NHibernate’s latest 4.0 as well as 3.3.3. Part One Many To Many Inverse Bag Part Two (you are here) JoinedSubClassMapping vs SubclassMapping (Discriminators) vs UnionSubclassMapping Part Three ForeignKey “none” IdBag Formula EnumStringType<> JoinedSubClassMapping vs…


Why To Use the Repository Pattern

I felt it was time to update and clarify some previous thoughts on the use of the Repository pattern. Previously, I had indicated that a Repository did not provide much benefit, as ORMs act as a Repository. Although true, I had a very specific context in mind when saying this – anemic domain models. When you’re working with anemic domain…


Why Not to Use the Repository Pattern

The Repository pattern, as described by Edward Hieatt and Rob Mee in Martin Fowler’s Patterns of Enterprise Application Architecture, is a layer of abstraction that is used to mediate interactions between the domain and the data mapping (ORM) layers. You can use a repository to minimize the duplicate query logic that a can arise in larger domains. Often times, I…