I am following the tutorial on sharparchitecture.net. I have created a few entities using T4, but I can’t figure out where the mapping to the database is done?
I would like to create some relations in the mapping files, but should I add a new mapping file or are there already created one with T4?
SharpArchitecture uses FluentNHibernate to automagically create NHibernate mappings based on your Entities as defined in project PROJECT.Core. It will define relationships based on the domain model. You will find that you frequently need to customize your mappings.
The project PROJECT.Data is where you will perform overrides to the default mapping. In this project you will find a folder called NHibernateMaps with several classes to setup the default mapping strategy. Step 1 would be to evaluate the default mapping strategy to see if you need to make any systemwide changes to the default strategies. Second, you may want to override a mapping for an specific entity. To do this create a new class called [EntityClass]Map that looks like the following:
Your application ties this all up in the InitializeNHibernateSession method within the global.asax.cs.