How Do I Change the Dialect in Dapper Extensions?

c# dapper postgresql

Question

By default, the RDBMS dialect for dapper extensions is SqlServer. How do I change this to another dialect?

I've figured I can do: (I'm just quickly throwing together a pgsql dialect)

var conf = new DapperExtensionsConfiguration(typeof(AutoClassMapper<>), new List<Assembly>(), new DapperExtensions.Sql.PostgreSqlDialect());

but what do I do with this conf? Do I set it to the connection or to a static method somewhere?

Thanks

Popular Answer

The solution is:

DapperExtensions.DapperExtensions.SqlDialect = new PostgreSqlDialect();

Please note that the dialect must be manually set for asynchronous extensions as well:

DapperExtensions.DapperAsyncExtensions.SqlDialect = new PostgreSqlDialect();


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why