English 中文(简体)
How to map the NHibernate Data Model to the Domain Model?
原标题:

I started creating a domain model and now I asking myself, how can I map this domain model to a NHibernate Data Model ((using Fluent NHibernate)? Is there anywhere a good and simple example of how to do that?

With Data Model I didn t think about the physical/relational Database Model(!) What I meant was the Data Model in the Data Access Layer. So maybe I should change the term into Data Access Layer Data Model?! I hope some of you can follow me^^

最佳回答

I d start reading the NHibernate manual, it s not very long and in chapter 5 covers many details about the different options that exist in the mappings. I find also important chapter 6 about collection mapping an 8 about inheritance.

Maybe you can start with the getting started page from fluent nhibernate, but to understand all the options you will have to lookup their meaning in the NH manual as Fluent NHibernate assumes that you are already familiar with the XML.

I don t have enough information about NHibernate in Action but the good old Hibernate in Action was also useful because the mapping examples for the Java version are in most cases valid on .NET and provides examples and detailed information on each parameter.

问题回答

This is the easiest one for getting started in a step-by-step manner that I have come across Your very first NHibernate application – Part 1

However, I would recommend that you simply download the latest binaries from the Fluent NHibernate download area rather than getting the source from Subversion, installing Ruby and building it locally on your machine but that s up to you.

Well, have you tried www.nhforge.org and http://fluentnhibernate.org/ ? Both have excellent introductory guides.

Take a look at the Getting started page on the Fluent NHibernate site. And definitely take a look at the Auto Mappings capabilities. I was up and running in a couple of hours. Good luck!





相关问题
nHibernate one-to-many inserts but doesnt update

Instead of getting into code, I have a simple question. Default behavior for a simple one-to-many is that it inserts the child record then updates the foreign key column with the parent key. Has ...

How Do I copy an existing nhibernate object as a new object?

I a persisted NHibernate object that I would like to repersist as a new entity. How do I get NHibernate to save this object as if it was a new? I am thinking I might create a session interceptor to ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

NHibernate Search in a List using ICriteria

I have my class X : public class ClassX { public virtual IList<ClassY> ListY { get; set; } ... } My ClassX mapping (using Fluent) ... HasMany<ClassX>(x => x.ListY ) ....

热门标签