Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Linq2db
提交
788ce099
L
Linq2db
项目概览
jobily
/
Linq2db
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
Linq2db
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
788ce099
编写于
7月 03, 2022
作者:
M
MaceWindu
提交者:
GitHub
7月 03, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix sql server custom types metadata provider (#3641)
* fix sql types metadata provider * revert public surface changes
上级
76858c24
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
52 addition
and
12 deletion
+52
-12
Source/LinqToDB/DataProvider/SqlServer/SystemDataSqlServerAttributeReader.cs
...aProvider/SqlServer/SystemDataSqlServerAttributeReader.cs
+52
-12
未找到文件。
Source/LinqToDB/
Metadata
/SystemDataSqlServerAttributeReader.cs
→
Source/LinqToDB/
DataProvider/SqlServer
/SystemDataSqlServerAttributeReader.cs
浏览文件 @
788ce099
...
@@ -7,6 +7,7 @@ namespace LinqToDB.Metadata
...
@@ -7,6 +7,7 @@ namespace LinqToDB.Metadata
{
{
using
Common
;
using
Common
;
using
Extensions
;
using
Extensions
;
using
LinqToDB.DataProvider.SqlServer
;
using
Mapping
;
using
Mapping
;
/// <summary>
/// <summary>
...
@@ -17,30 +18,71 @@ namespace LinqToDB.Metadata
...
@@ -17,30 +18,71 @@ namespace LinqToDB.Metadata
/// </summary>
/// </summary>
public
class
SystemDataSqlServerAttributeReader
:
IMetadataReader
public
class
SystemDataSqlServerAttributeReader
:
IMetadataReader
{
{
readonly
AttributeReader
_reader
=
new
AttributeReader
();
static
readonly
ConcurrentDictionary
<
MemberInfo
,
object
>
_cache
=
new
();
static
readonly
AttributeReader
_reader
=
new
();
private
static
readonly
Type
[]
_sqlMethodAttributes
;
static
readonly
Type
[]
_sqlMethodAttributes
;
private
static
readonly
Type
[]
_sqlUserDefinedTypeAttributes
;
static
readonly
Type
[]
_sqlUserDefinedTypeAttributes
;
// TODO: v5 convert to Instance field
static
SystemDataSqlServerAttributeReader
()
static
SystemDataSqlServerAttributeReader
()
{
{
// try/catch applied as Type.GetType(throwOnError: false) still can throw for sfx builds
// see https://github.com/linq2db/linq2db/issues/3630
Type
?
methodAttr1
=
null
;
Type
?
methodAttr2
=
null
;
Type
?
methodAttr3
=
null
;
Type
?
typeAttr1
=
null
;
Type
?
typeAttr2
=
null
;
Type
?
typeAttr3
=
null
;
try
{
methodAttr1
=
Type
.
GetType
(
"Microsoft.SqlServer.Server.SqlMethodAttribute, System.Data.SqlClient"
,
false
);
typeAttr1
=
Type
.
GetType
(
"Microsoft.SqlServer.Server.SqlUserDefinedTypeAttribute, System.Data.SqlClient"
,
false
);
}
catch
{
}
try
{
methodAttr2
=
Type
.
GetType
(
"Microsoft.Data.SqlClient.Server.SqlMethodAttribute, Microsoft.Data.SqlClient"
,
false
);
typeAttr2
=
Type
.
GetType
(
"Microsoft.Data.SqlClient.Server.SqlUserDefinedTypeAttribute, Microsoft.Data.SqlClient"
,
false
);
}
catch
{
}
// added since https://github.com/dotnet/SqlClient/releases/tag/v5.0.0-preview3
try
{
methodAttr3
=
Type
.
GetType
(
"Microsoft.SqlServer.Server.SqlMethodAttribute, Microsoft.SqlServer.Server"
,
false
);
typeAttr3
=
Type
.
GetType
(
"Microsoft.SqlServer.Server.SqlUserDefinedTypeAttribute, Microsoft.SqlServer.Server"
,
false
);
}
catch
{
}
_sqlMethodAttributes
=
new
[]
_sqlMethodAttributes
=
new
[]
{
{
methodAttr1
,
methodAttr2
,
methodAttr3
,
#if NETFRAMEWORK
#if NETFRAMEWORK
typeof
(
Microsoft
.
SqlServer
.
Server
.
SqlMethodAttribute
),
typeof
(
Microsoft
.
SqlServer
.
Server
.
SqlMethodAttribute
),
#endif
#endif
Type
.
GetType
(
"Microsoft.SqlServer.Server.SqlMethodAttribute, System.Data.SqlClient"
,
false
),
}.
Where
(
t
=>
t
!=
null
).
Distinct
().
ToArray
()!;
Type
.
GetType
(
"Microsoft.Data.SqlClient.Server.SqlMethodAttribute, Microsoft.Data.SqlClient"
,
false
)
}.
Where
(
_
=>
_
!=
null
).
Distinct
().
ToArray
()!;
_sqlUserDefinedTypeAttributes
=
new
[]
_sqlUserDefinedTypeAttributes
=
new
[]
{
{
typeAttr1
,
typeAttr2
,
typeAttr3
,
#if NETFRAMEWORK
#if NETFRAMEWORK
typeof
(
Microsoft
.
SqlServer
.
Server
.
SqlUserDefinedTypeAttribute
),
typeof
(
Microsoft
.
SqlServer
.
Server
.
SqlUserDefinedTypeAttribute
),
#endif
#endif
Type
.
GetType
(
"Microsoft.SqlServer.Server.SqlUserDefinedTypeAttribute, System.Data.SqlClient"
,
false
),
}.
Where
(
t
=>
t
!=
null
).
Distinct
().
ToArray
()!;
Type
.
GetType
(
"Microsoft.Data.SqlClient.Server.SqlUserDefinedTypeAttribute, Microsoft.Data.SqlClient"
,
false
)
}.
Where
(
_
=>
_
!=
null
).
Distinct
().
ToArray
()!;
}
}
public
T
[]
GetAttributes
<
T
>(
Type
type
,
bool
inherit
)
public
T
[]
GetAttributes
<
T
>(
Type
type
,
bool
inherit
)
...
@@ -49,8 +91,6 @@ public T[] GetAttributes<T>(Type type, bool inherit)
...
@@ -49,8 +91,6 @@ public T[] GetAttributes<T>(Type type, bool inherit)
return
Array
<
T
>.
Empty
;
return
Array
<
T
>.
Empty
;
}
}
static
readonly
ConcurrentDictionary
<
MemberInfo
,
object
>
_cache
=
new
ConcurrentDictionary
<
MemberInfo
,
object
>();
public
T
[]
GetAttributes
<
T
>(
Type
type
,
MemberInfo
memberInfo
,
bool
inherit
)
public
T
[]
GetAttributes
<
T
>(
Type
type
,
MemberInfo
memberInfo
,
bool
inherit
)
where
T
:
Attribute
where
T
:
Attribute
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录