Reputation: 23289
We have WebServer (based on Orchard CMS) and two SQL Server databases: master (read-write operations) and slave (only read operations). Databases are synchronized by replication. WebServer uses NHibernate as an ORM.
We want to separate load between these two databases by the following schema. During request processing we should have:
So the idea is to switch to the master database before first change statement (UPDATE, DELETE, INSERT). Important note that existing infrastructure uses .Net TransactionScope class to organize transaction.
So how to achieve this with NHibernate?
Upvotes: 1
Views: 293
Reputation: 30813
some starting points:
session.Disconnect();
session.Reconnect(connection)
to switch connection.Upvotes: 2