Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Change the Dialect in Dapper Extensions?

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

like image 602
M K. Price Avatar asked Apr 01 '13 17:04

M K. Price


1 Answers

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();
like image 144
2 revs, 2 users 50% Avatar answered Sep 22 '22 16:09

2 revs, 2 users 50%