Merge pull request #856 from wch1618/master

IsGenericTypeDefinition
This commit is contained in:
IGeekFan 2021-08-19 12:43:51 +08:00 committed by GitHub
commit e86eb1a29c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,8 +171,12 @@ namespace FreeSql
if (string.IsNullOrEmpty(_masterConnectionString) && _connectionFactory == null) throw new Exception("参数 masterConnectionString 不可为空,请检查 UseConnectionString"); if (string.IsNullOrEmpty(_masterConnectionString) && _connectionFactory == null) throw new Exception("参数 masterConnectionString 不可为空,请检查 UseConnectionString");
IFreeSql<TMark> ret = null; IFreeSql<TMark> ret = null;
var type = _providerType; var type = _providerType;
if (type?.IsGenericType == true) type = type.MakeGenericType(typeof(TMark)); if (type != null)
if (type == null) {
if (type.IsGenericTypeDefinition)
type = type.MakeGenericType(typeof(TMark));
}
else
{ {
Action<string, string> throwNotFind = (dll, providerType) => throw new Exception($"缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType})"); Action<string, string> throwNotFind = (dll, providerType) => throw new Exception($"缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType})");
switch (_dataType) switch (_dataType)