在 Dapper FastCRUD 中为 mysql 创建查询
create query for mysql in Dapper FastCRUD
我想将 dapper fastcrud(DLL FOR CRUD Operation in dapper)与 mariadb(mysql 引擎)一起使用,但是 当我想执行我的代码时出现语法错误
似乎当 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
在程序的开头,按如下方式配置Dapper.FastCRUD:
OrmConfiguration.DefaultDialect = SqlDialect.MySql;