NHibernate
NHibernate

Recently Oren (Ayende) had a serious of posts on NHibernate mappings and the various options you can configure using Xml mappings. This series of posts takes those examples and shows how you can use FluentNHibernate to configure the same mappings. This is a companion post for Oren’s post on the <any> mapping in NHibernate, here. I recommend reading his post before venturing forward. In Fluent NHibernate you can use the ReferencesAny mapping method to output a <any> mapping: ReferencesAny(mapping => mapping.Payment)     .EntityTypeColumn("PaymentType")     .EntityIdentifierColumn("PaymentId") ...


Recently Oren (Ayende) had a serious of posts on NHibernate mappings and the various options you can configure using Xml mappings. This series of posts takes those examples and shows how you can use FluentNHibernate to configure the same mappings. This is a companion post for Oren’s post on the <join> mapping in NHibernate, here. I recommend reading his post before venturing forward. To create a joined table mapping using FluentNHibernate you need to use the WithTable mapping function and specify the JoinedPart definition: WithTable("Addresses", join =>                            { ...


Recently Oren (Ayende) had a serious of posts on NHibernate mappings and the various options you can configure using Xml mappings. This series of posts takes those examples and shows how you can use FluentNHibernate to configure the same mappings. This is a companion post for Oren’s post on the <one-to-one> mapping in NHibernate, here. I recommend reading his post before venturing forward. In FluentNHibernate one-to-one mappings are achieved by using the HasOne mapping method on the parent and the References method on the child. Below is the mapping for the Person entity that has a one-to-one...


Recently Oren (Ayende) had a serious of posts on NHibernate mappings and the various options you can configure using Xml mappings. This series of posts takes those examples and shows how you can use FluentNHibernate to configure the same mappings. This is a companion post for Oren’s post on the <set> mapping in NHibernate, here. I recommend reading his post before venturing forward. A <set> element in NHibernate’s mapping refers to a one-to many mapping. This can be represented simply in FluentNHibernate using the HasMany mapping method:  HasMany(prop => prop.Comments); The HasMany statement simply...


[Edit: Reformatted code snippets and removed unnecessary line breaks] Recently Oren (Ayende) had a serious of posts on NHibernate mappings and the various options you can configure using Xml mappings. This series of posts takes those examples and shows how you can use FluentNHibernate to configure the same mappings. This is a companion post for Oren’s post on <component> mappings in NHibernate, here. I recommend reading his post before venturing forward. In this post I’ll show how you use FluentNHibernate instead of using NHibernate’s xml mapping files. Based on Oren’s original post on <component>...


Recently Oren (Ayende) had a serious of posts on NHibernate mappings and the various options you can configure using Xml mappings. This series of posts takes those examples and shows how you can use FluentNHibernate to configure the same mappings. This is a companion post for Oren’s post on property mappings in NHibernate, here. I recommend reading his post before venturing forward. In this post I’ll show how you use FluentNHibernate instead of using NHibernate’s xml mapping files. Based on Oren’s original post on <property> mapping, here is the full mapping file: ...


This is part of a continuing series of posts on Fluent NHiberate. Using Fluent NHibernate in Rhinestone – Part I In this part I’ll show how you can map custom user types using Fluent NHibernate. In a previous post I had discussed the need to use custom user types in Rhinestone and had ended with a promise to have a follow up post on the details on implementing the custom user type and provide mappings for using that custom user type in NHibernate....


[You can catch up with previous posts on Rhinestone here.] Okay, so based on my last post a rough domain model was defined as well as the database model. I’ve removed the previous Rhinestone.Shared project, and it’s related test project, as that has now been encapsulated in NCommon. So the next step is to setup the mapping layer between the ORM framework of my choice and the database model. Since we I am going to use NHibernate in Rhinestone that involves setting up NHibernate and the mappings that will allow NHibernate to hydrate result sets returned from...


Since my last post on the NCommon project, I’ve been looking at using NCommon as the base framework for Rhinestone. Jumping back into Rhinestone I realized that I first need an implementation of RepositoryBase and UnitOfWork for NHibernate. I decided to go ahead and create implementations of RepositoryBase and UnitOfWork for NHibernate, Linq To SQL and Entity Framework (that last one giving me the most head ache). While developing these implementations, some changes were made to NCommon. Here are some of the changes. Save on IRepository changed to Add and Update ...


In the previous post; The Unit of Work Pattern I put down some thoughts on the Unit of Work pattern. In this post I delve into implementing a Unit of Work framework that allows persistence ignorance and provides a base for a unit of work component that I can use in Rhinestone. Note: It would be highly rude of me to not mention that a lot of the ideas around UnitOfWork comes from Aynde’s excellent implementation of the pattern in Rhino.Commons. Even though Aynde’s implementation can be taken as is, I wanted to start with a framework that provided...