Disable table name quotes for querying through Oracle DBLINK
See original GitHub issueTL/DR: Is there a way to disable adding double quotes for table names like
MY_TABLE@MY_LINK_NAME
when usingSystem.Data.Linq.Mapping
attributes?
Hello,
I have a large application migrated from BLToolkit to Linq2db.
Everything works great so far except for external tables accessed via Oracle DBLINK.
Tables accessed via DBLINK are named like this: MY_TABLE@MY_LINK_NAME
:
SELECT ID, NAME FROM MY_TABLE@MY_LINK_NAME
Note that it looks like a table name with special symbols in it, but in fact it isn’t.
Database entities are annotated using System.Data.Linq.Mapping
attributes:
[Table(Name = "MY_TABLE@MY_LINK_NAME")]
public class MyTable
{
[Column(Name = "ID")]
public long ID { get; set; }
}
BLToolkit used to generate table name as is:
SELECT ID, NAME
FROM MY_TABLE@MY_LINK_NAME
But Linq2db detects a ‘@’ symbol and quotes the table name:
SELECT ID, NAME
FROM "MY_TABLE@MY_LINK_NAME"
Which is an error because such table doesn’t exist in the database.
I don’t seem to be able to find a workaround so far.
I found a compatibility option OracleTools.DontEscapeLowercaseIdentifiers
that affects
table names with lowercase letters, but there is no such an option for the DBLINK @
character.
Environment details
linq2db version: 3.0.0.0 Database Server: Oracle Database Provider: OracleManaged Operating system: Windows .NET Framework: 4.6.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Technically, you can also replace SystemDataLinqAttributeReader with own implementation, which split table name into Name/Server parts
Thanks for the
ServerName
extension method workaround: