FluentNHibernate
FluentNHibernate

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: ...


[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...