We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using FreeSql; using FreeSql.DataAnnotations; using (var fsql = new FreeSqlBuilder() .UseConnectionString(DataType.Sqlite, "data source=111.db") .UseAutoSyncStructure(true) .UseNoneCommandParameter(true) .UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText + "\r\n")) .Build()) { var table = fsql.CodeFirst.DynamicEntity("user", new TableAttribute { Name = "t_user" }) .Property("id", typeof(int), new ColumnAttribute { IsIdentity = true, IsPrimary = true }) .Property("username", typeof(string), new ColumnAttribute { StringLength = 32 }) .Property("adminIds", typeof(string), new ColumnAttribute { StringLength = -1 }) .Build(); //如果有必要,请将 table 缓存起来 if (fsql.DbFirst.ExistsTable(table.DbName) == false) fsql.CodeFirst.SyncStructure(table.Type); //创建表 var dict = new Dictionary<string, object>(); dict["username"] = "aaa"; dict["adminIds"] = ",1,2,3,4,5"; object obj = table.CreateInstance(dict); var insNum = fsql.Insert<object>().AsType(table.Type).AppendData(obj).ExecuteAffrows(); ///这里输出的sql语句替换参数化的地方是能查询出来的,但是代码返回结果为空数组 var list = fsql.Select<object>().AsType(table.Type).Where("adminIds like '%,@a,%'", new { a = 1 }).ToList(); Console.ReadLine(); }
Sqlite
FreeSql.All 3.2.821
The text was updated successfully, but these errors were encountered:
adminIds like @p1
要这样写,你写的被当成了字符串
Sorry, something went wrong.
No branches or pull requests
问题描述及重现代码:
数据库版本
Sqlite
安装的Nuget包
FreeSql.All 3.2.821
.net framework/. net core? 及具体版本
The text was updated successfully, but these errors were encountered: