SqlKata - Is there any way to tell the SqlKata compiler to NOT wrap Identifiers when building the query string?

752 Views Asked by At

Is there any way to tell the SqlKata compiler to NOT wrap Identifiers when building the query string? (Double quotes for PostgreSql and Square brackets for SqlServer)

For example, when building a query against a PostgreSql database I would like the compiler to create: SELECT CDR.InstanceID FROM CallDetails as CDR

instead of:

SELECT "CDR"."InstanceID" FROM "CallDetails as "CDR"

1

There are 1 best solutions below

4
On

You can extend the desired compiler and change the default OpeningIdentifier and ClosingIdentifier.

public class MyCompiler: PostgresCompiler
{
    protected override string OpeningIdentifier { get; set; } = "";
    protected override string ClosingIdentifier { get; set; } = "";
}

and use it instead