문제

When writing sql, I can do

 BEGIN Trans t;
 SELECT a.name, b.name from db1.dbo.A as a
    JOIN db2.dbo.B as b
    ON b.aId = a.Id
 COMMIT Trans t;

When two databases are on the same database instance.

I am wondering how I can achieve this with database mapping. So that I don't need to create multiple sessions for queries involves different databases.

도움이 되었습니까?

해결책

No, so far I have not seen any other solution then creating a view within one database which does the cross DB query and then use nh mappings on that view, or maybe fully-qualified names. (see duplicate-link below your post).

다른 팁

There is a possibility to do it with DB synonyms. It is not an optimal solution performance-wise, but it might solve your current bind. SQL Server Synonyms

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top