Fluent NHibernate-mappings-Add from Namespace

146 views
Skip to first unread message

rema

unread,
Oct 31, 2012, 2:54:06 PM10/31/12
to fluent-n...@googlegroups.com
I am working on a project with multiple databases. I want to have all my entities and mappings in the same assembly (to reduce assembly load time).
So I have
Project
 - Database1
 -- Entities     
 -- Mapping
 -- Repositories
 
 - Database2
 -- Entities
 -- Mapping
 -- Repositories
 
And when creating session factories use like this:
 
When session factory for Database1 is needed use: only the .Mappings(x=>x.FluentMappings (add from namespace Project1.Database1)
 
When session factory for Database2 is needed use: only the .Mappings(x=>x.FluentMappings (add from namespace Project1.Database2)
 
This way the mappings loaded are only as needed (thereby reducing the mappings load time).
 
I know that I can use AutoMapping and use namespace but I do not want to use AutoMapping. I have to use FluentMapping.
 
I know that I can put different databases in different assemblies and then use AddFromAssemblyOf but that will increase the number of assemblies and I will prefer not to do that.
 
Is there any way to do that while in the same project?
 
Any ideas? Any code samples?
 
Thanks
Reply all
Reply to author
Forward
0 new messages