views:

15

answers:

1

I'm trying add the the followings in my FNH configuration SessionManager class. I have 20+ Entities to map and they're all sitting in the same project under Entities folder. ie. ProjName.BusinessLogic.Entities The mapping classes are under ProjName.BusinessLogic.Mappings This FNHSessionManager.cs file is under ProjName.BusinessLogic.DAL

var cfg = MsSqlConfiguration.MsSql2005
                    .ConnectionString(c => c.FromAppSetting("connectionString"));

                isf = Fluently.Configure()
                    .Database(cfg)
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<User>())
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Provider>())
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Document>())
                    .BuildSessionFactory();

Is there a better/shorter way to add them in the configuration other than list them all? I don't want to separate the entities in different project to create a new assembly. Or mapping to only 1 entity would do?

This is my first proj using FNH and very new with whole thing. I'm not even sure if I'm on the right track.

Your advice would be much appreciated.

+1  A: 

You only need to provide one mapped class per assembly to AddFromAssembyOf<T> and all the class maps within that assembly will be loaded.

Jamie Ide
Thanks for your answer.
May

related questions