Get DialectProvider database type

I’m developing a custom extension method for SqlExpression and I need to get which database type is targeted by the query DialectProvider.

How can I do that?

The reason is because I need to write some db functions that you currently don’t support, and I need to get which DBMS I’m targeting.

Thanks

It’s tied to DB Provider when it’s created and needs to be passed in the constructor:

I’m sorry but I could not understand your answer.

Right now I’m using something like that:

switch (query.DialectProvider)
{
    case SqlServerOrmLiteDialectProvider _:
    ... bla bla
    case PostgreSqlDialectProvider _:
    ... bla bla
}

It seems a bit “forced” to me…

1 Like