简体   繁体   中英

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

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM