Mapping changes on specific configuration

3 views
Skip to first unread message

David Perfors

unread,
Dec 18, 2009, 4:38:14 AM12/18/09
to Fluent NHibernate
Hello,

I am working on a project that uses a large legacy database. The old
version of the software makes use of several Access databases. After
some years there came support for MsSql server. There came one
database in MsSql and multiple Access databases where moved there. The
table names got the prefix of the Access database name.
(AccessDb_TableName) except for one large database, that one could
keep it's old table names... Some of the database where never added to
the MsSql server.
We now have the situation where some of our clients use the Access
version of our software (they don't have MsSqlServer) and other are
using the SQL Server version, but we still have to support both of
them.
I am working on a project to create new software based on the old
software and I want to use NHibernate for this. Since mapping these
databases is difficult I decided to use fluent nhibernate, which makes
it a little bit easier.
But, I have no idea what my best options are.

I guess it it will have to use multiple configurations and
sessionfactories, but how do I get the right sessionfactory for the
right functionality? and how do I get the right mapping in the
configuration?

On the Mapping side I probably need to submap my mappings to specify
the right tablename and databasename since I don't think I can use a
constructor that gets the configuration from the software...

Any suggestions?

Farina

unread,
Dec 19, 2009, 11:56:13 AM12/19/09
to Fluent NHibernate
Hi David, take a look into the SessionFactory from NHibernate.
I guess you will have to create a SessionManager in order to control
sessions to different databases.

https://www.hibernate.org/363.html#A4

Regards,
André

Paul Batum

unread,
Dec 20, 2009, 12:22:48 AM12/20/09
to fluent-nhibernate
You might want to ask for some advice on the nhibernate mailing list when it comes to dealing with multiple session factories. The Fluent NHibernate side of things should be relatively straightforward - you should be able to execute Fluently.Configure multiple times, each time building a different session factory. I'm not sure how many people have done this before though so if you think you've encountered a bug, please give us a shout.

--

You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.



Reply all
Reply to author
Forward
0 new messages