在dapper fastcrud中为mysql创建查询

5ktev3wc  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(423)

我想在mariadb(mysql引擎)中使用dapper fastcrud(dapper中crud操作的dll),但是当我想执行我的代码时,我有语法错误
似乎当fastcrud想要创建查询时,它的默认行为是创建适合sqlserver的查询(例如使用[]),我想改变这个行为来创建类似sqldialetic的查询mysql
如果有人能帮我,我将不胜感激
我的示例代码:

var TrustedZone = db.Get(new TrustedZone { Id = 1 });

错误:

An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll

Additional information: You have an error in your SQL syntax; 
check the manual that corresponds to your MariaDB server version 
for the right syntax to use near 
'[Id],[IP],[Title],[Description] FROM [TrustedZones] WHERE [Id]=1' at line 1
jutyujz0

jutyujz01#

在程序开始时,按如下方式配置dapper.fastcrud:

OrmConfiguration.DefaultDialect = SqlDialect.MySql;

相关问题