You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
问题:.net6 WebAPI项目 打包成单个文件发布,运行报错(2秒输出一次)(如果不打包成单个文件,运行正常):
【FreeSql: Master Database】Next recovery time: 08/09/2022 11:02:25 (The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.)
2022/8/9 11:02:25【FreeSql: Master Database】Next recovery time: 08/09/2022 11:02:27 (The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.)
The given key '0' was not present in the dictionary.
The given key '25653' was not present in the dictionary.
The given key '26995' was not present in the dictionary.
The given key '28261 was not present in the dictionary.
The given key '65535' was not present in the dictionary.
The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.
Parameter '@xxx' must be defined.
new FreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.Sqlite,@"Data Source=db1.db",typeof(FreeSql.Sqlite.SqliteProvider<>)).UseAutoSyncStructure(true).Build()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
1、 .net6 WebAPI项目 打包成单个文件发布
问题:.net6 WebAPI项目 打包成单个文件发布,运行报错(2秒输出一次)(如果不打包成单个文件,运行正常):
【FreeSql: Master Database】Next recovery time: 08/09/2022 11:02:25 (The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.)
2022/8/9 11:02:25【FreeSql: Master Database】Next recovery time: 08/09/2022 11:02:27 (The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.)
MySql.Data不支持单文件打包
回答:删除
FreeSql.Provider.MySql
,更换FreeSql.Provider.MySqlConnector
回答:如果你使用 FreeSql.Provider.MySql 发生了以下错误,请替换到 FreeSql.Provider.MySqlConnector:
The given key '0' was not present in the dictionary.
The given key '25653' was not present in the dictionary.
The given key '26995' was not present in the dictionary.
The given key '28261 was not present in the dictionary.
The given key '65535' was not present in the dictionary.
The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.
Parameter '@xxx' must be defined.
2、 WPF NETFramework、Winfrom、ASP.NET
缺少 FreeSql 数据库实现包:FreeSql.Provider.Sqlite.dll,可前往 nuget 下载;如果存在 FreeSql.Provider.Sqlite.dll 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof(FreeSql.Sqlite.SqliteProvider<>)
回答:老的Nuget分层项目打包存在问题,请在启动项目,引用 freesql.provider.xxx,
3、Sqlite 加密/Linux的ARM架构/MAUI Android/ios等
4、 多语言配置
默认根据当前操作系统语言来,如果想在中文系统下,显示英文的错误信息,又不想改变
CurrentUICulture
的值,可通过如下方式5、 找不到方法:“xxx”
比如:找不到方法:“Boolean FreeSql.Internal.ObjectPool.ObjectPool`1.SetUnavailable(System.Exception)”
回答:当升级包时,未统一升级FreeSql的引用包,需要统一FreeSql的版本
6、Oracle 数据库中文显示乱码问题
https://www.cnblogs.com/FreeSql/p/16614808.html
C#.NET ORM FreeSql 读取使用 US7ASCII 的 Oracle 数据库中文显示乱码问题
7 首次预热机制是默认的
如果想取消预热有二种方式
UseConnectionFactory(DataType.Sqlite, () => new Microsoft.Data.SqliteConnection(…))
替换
UseConnectionString
8 内置的连接重试机制如何禁用
内部存在定时请求数据库处理,如何通过代码禁用此默认行为。
同上,使用此方式
.UseConnectionFactory(DataType.SqlServer, () => new SqlConnection(...))
替换UseConnectionString(DataType.SqlServer,“”)
9、同时安装了FreeSql.Provider.MySql和FreeSql.Provider.MySqlConnector 无法使用 ExecuteMySqlBulkCopy 方法
二个共存时,默认根据 FreeSql.Provider.MySql 得到 的MySqlProvider 实现 ,可在UseConnectionStrings中第三个参数指定Type
10、 DataReader associated
检查异步方法是否都带了 await 或者AOP中异步是否正确,事务不在 ioc scope 生命周期内使用,异步必须带 await等待。
Beta Was this translation helpful? Give feedback.
All reactions