Is it possible to create a cross-database query wi

2019-05-17 16:33发布

Pretty much summed up in the title.

Trying to hit a table in one database and join it to a table in another database on the same server.

I would have assumed an attribute for Database that I could decorate the POCO with, but do not see one that would be appropriate.

Currently using this syntax:

var result = db.Select<Model.Dto>(
                    db.From<Data.Dto1>()
                        .Join<Data.Dto2>(d1, d2) => d1.Id == d2.Id));

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-05-17 16:46

There's no specific attribute for specifying an external database but in RDBMS's that support cross-database queries you should be able to use the [Schema] attribute, e.g:

[Schema("Server1.Database1.dbo")]
public class Dto { ... }
查看更多
登录 后发表回答