O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Mapping a simple domain using XML

In this example, we want to create a very simple domain model and map it using XML files. We will then let NHibernate create a SQL schema generation script based on these mapping files.

  1. Start Visual Studio and create a new project. Choose Console Application as the project template. Name the project XmlMappingSample.
  2. Add references to the assembly NHibernate.dll to the project.
  3. Add a new folder to the solution. Call the folder Schema.
  4. Add the file nhibernate-mapping.xsd, which is located in the lib folder, to the Schema folder. (If the said file is not yet located in your lib folder, then please extract it from the ZIP file containing the NHibernate binaries—that you downloaded in Chapter 2—and copy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required