The fastest and easiest way to configure NHibernate / LINQ without HBM files

I would like to create a very simple demo application that includes LINQ over NHibernate. While I wait for an answer, I perform other tasks :)

  • I don't like HBM files at all
  • I need to set up a very simple database schema (3 tables)
  • I would not want to start with the database. Maybe a cool model might be a better start.
  • I did not select the target database: maybe MySQL

I know how to create a data model from HBM files. I know how to extract a data model from a database in the .NET Entity Framework, but I believe that my demo could be better done using NHibernate.

Can you offer me a quick start tutorial? I knew there was an old annotation-based NH plugin: this might be a suitable starting point ...

+4
source share
1 answer

As Adam suggested, one option for you is to use FluentNHibernate and Auto Match . Although, since your installation is very small, you can use Fluent mapping .

Besides the FluentNHibernate wiki , here are some resources:
Your first NHibernate app by Gabriel Scheker
Getting started with full NHibernate and auto mapping in C # by Jason Mitchell

Another alternative with a later version of NHibernate is code matching . This SO question contains more than enough links, so I will not repeat them here.

Regarding attribute mapping, I suggest you avoid this . They are not used so much, and you kind of poison the classes of your domain / POCO with data access problems.

+1
source

All Articles