0

Im trying to find a way to invoke the USE statement in NHibernate.

In SQL I can write something like this

USE MyDatabase;
SELECT * FROM Stuff

USE OtherDatabase;
SELECT * FROM OtherStuff

Is there a way to achieve this behavior in NHibernate?

The second database is within the same authentication context (same server as well) hence there should be no need to switch the entire connectionstring.

Thanks

4

1 回答 1

0

显然我可以做到这一点

using (ISession session = SessionFactory.OpenSession())
{
    session.CreateSQLQuery("USE OtherDatabase").ExecuteUpdate();
    // ...
}
于 2013-02-03T14:03:46.720 回答