Is it possible to create a cross-database query with ServiceStack ORMLite?

為{幸葍}努か 提交于 2019-12-07 18:42:04

问题


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:


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 { ... }


来源:https://stackoverflow.com/questions/40467072/is-it-possible-to-create-a-cross-database-query-with-servicestack-ormlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!