0

我想使用 dapper fastcrud(DLL FOR CRUD Operation in dapper) 和 mariadb(mysql engine) 但是当我想执行我的代码时我有语法错误

似乎当 fastcrud 想要创建查询时,它的默认行为是创建适合 sqlserver 的查询(例如使用 [] ),我想更改此行为以创建查询 mysql 之类的 sqldialetic

如果有人可以帮助我,我将不胜感激

我的示例代码:

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
4

1 回答 1

2

在你的程序开始时,配置 Dapper.FastCRUD 如下:

OrmConfiguration.DefaultDialect = SqlDialect.MySql;
于 2018-08-18T14:05:52.280 回答