Home > front end >  How to access an Oracle linked table in Linq2db?
How to access an Oracle linked table in Linq2db?

Time:10-06

I have a linked table I access like this:

SELECT Id, Name FROM MySchema.Sectors@STATS 

How do I define that in Linq2db?

I tried:

[Table(Schema = "MySchema", Name = "SECTORS@STATS")]
public partial class Sector

but when I try to load it, I get

ORA-00942: table or view does not exist

CodePudding user response:

You have to set Server property:

[Table(Schema = "MySchema", Name = "SECTORS", Server = "STATS")]
public partial class Sector
{
   ...
}

Also you can do that dynamically when building query:

var result = db.GetTable<Sector>().ServerName("STATS")
   .ToList();
  • Related