2
votes

Can I mix fluent mapping with automapping? If yes how can it be done?

1

1 Answers

0
votes

Just define your mappings and auto mappings ;-) I can't tell exact code since I don't have VS at hands, but you just follow FNH guidelines on creating both types of mapping and that's it, they should work together.

Here's example:

     AutoPersistenceModel mappings = AutoMap
         .AssemblyOf<Order>()
         .IgnoreBase<BaseEntity>()
         .Where(GetAutoMappingFilter)
         .Conventions.Setup(GetConventions())
         .Setup(GetSetup())
         .UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
     // this is for std mapping
    //mappings.AddMappingsFromAssembly(
    //        typeof(Northwind.Data.NHibernateMappings.RouteConditionMap).Assembly);

The last line is commented because I don't need std mappings.

However why would you need that? In automapping you can override the same things.