Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FluentNhibernate, add mappings from multiple assemblies

I've tried to add mapping classes manually, by using multiple .Mappings extension calls, but it seems only to include the last one. So how do I add several selected class maps, or multiple assemblies?

My fluent configuration looks typically like this:

 Return Fluently.Configure() _
                .Database(SQLiteConfiguration.Standard.ConnectionString(connectionString) _
                .Cache(Function(c) c.UseQueryCache())) _
            .Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of AccountMap)() _
                .Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never())) _
            .ExposeConfiguration(Function(c) InlineAssignHelper(cfg, c)) _
            .BuildSessionFactory()
like image 486
bretddog Avatar asked Jan 19 '23 16:01

bretddog


1 Answers

Just specify all of your assemblies.

m.FluentMappings
    .AddFromAssemblyOf(Of AccountMap)()
    .AddFromAssemblyOf(Of SomeOtherMap)();
like image 192
Vadim Avatar answered Jan 28 '23 02:01

Vadim