如何在 Linq2db 中访问链接 table 的 Oracle?
How to access an Oracle linked table in Linq2db?
我有一个链接 table 我是这样访问的:
SELECT Id, Name FROM MySchema.Sectors@STATS
如何在 Linq2db 中定义它?
我试过了:
[Table(Schema = "MySchema", Name = "SECTORS@STATS")]
public partial class Sector
但是当我尝试加载它时,我得到
ORA-00942: table or view does not exist
你必须设置 Server
属性:
[Table(Schema = "MySchema", Name = "SECTORS", Server = "STATS")]
public partial class Sector
{
...
}
您也可以在构建查询时动态执行此操作:
var result = db.GetTable<Sector>().ServerName("STATS")
.ToList();
我有一个链接 table 我是这样访问的:
SELECT Id, Name FROM MySchema.Sectors@STATS
如何在 Linq2db 中定义它?
我试过了:
[Table(Schema = "MySchema", Name = "SECTORS@STATS")]
public partial class Sector
但是当我尝试加载它时,我得到
ORA-00942: table or view does not exist
你必须设置 Server
属性:
[Table(Schema = "MySchema", Name = "SECTORS", Server = "STATS")]
public partial class Sector
{
...
}
您也可以在构建查询时动态执行此操作:
var result = db.GetTable<Sector>().ServerName("STATS")
.ToList();