Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Efcore.Pg
提交
db80fec8
E
Efcore.Pg
项目概览
jobily
/
Efcore.Pg
9 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Efcore.Pg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
db80fec8
编写于
1月 16, 2023
作者:
S
Shay Rojansky
提交者:
GitHub
1月 16, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support xid8 (#2619)
Closes #2618
上级
3e4ef719
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
4 deletion
+55
-4
src/EFCore.PG/Storage/Internal/Mapping/NpgsqlULongTypeMapping.cs
...ore.PG/Storage/Internal/Mapping/NpgsqlULongTypeMapping.cs
+37
-0
src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs
src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs
+14
-4
test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingSourceTest.cs
test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingSourceTest.cs
+4
-0
未找到文件。
src/EFCore.PG/Storage/Internal/Mapping/NpgsqlULongTypeMapping.cs
0 → 100644
浏览文件 @
db80fec8
namespace
Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public
class
NpgsqlULongTypeMapping
:
NpgsqlTypeMapping
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public
NpgsqlULongTypeMapping
(
string
storeType
,
NpgsqlDbType
npgsqlDbType
)
:
base
(
storeType
,
typeof
(
ulong
),
npgsqlDbType
)
{}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected
NpgsqlULongTypeMapping
(
RelationalTypeMappingParameters
parameters
,
NpgsqlDbType
npgsqlDbType
)
:
base
(
parameters
,
npgsqlDbType
)
{}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected
override
RelationalTypeMapping
Clone
(
RelationalTypeMappingParameters
parameters
)
=>
new
NpgsqlULongTypeMapping
(
parameters
,
NpgsqlDbType
);
}
src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs
浏览文件 @
db80fec8
...
...
@@ -129,8 +129,9 @@ static NpgsqlTypeMappingSource()
private
readonly
NpgsqlPolygonTypeMapping
_polygon
=
new
();
private
readonly
NpgsqlCircleTypeMapping
_circle
=
new
();
// uint mappings
// uint
/ulong
mappings
private
readonly
NpgsqlUintTypeMapping
_xid
=
new
(
"xid"
,
NpgsqlDbType
.
Xid
);
private
readonly
NpgsqlULongTypeMapping
_xid8
=
new
(
"xid8"
,
NpgsqlDbType
.
Xid8
);
private
readonly
NpgsqlUintTypeMapping
_oid
=
new
(
"oid"
,
NpgsqlDbType
.
Oid
);
private
readonly
NpgsqlUintTypeMapping
_cid
=
new
(
"cid"
,
NpgsqlDbType
.
Cid
);
private
readonly
NpgsqlUintTypeMapping
_regtype
=
new
(
"regtype"
,
NpgsqlDbType
.
Regtype
);
...
...
@@ -326,6 +327,7 @@ static NpgsqlTypeMappingSource()
{
"circle"
,
new
[]
{
_circle
}
},
{
"xid"
,
new
[]
{
_xid
}
},
{
"xid8"
,
new
[]
{
_xid8
}
},
{
"oid"
,
new
[]
{
_oid
}
},
{
"cid"
,
new
[]
{
_cid
}
},
{
"regtype"
,
new
[]
{
_regtype
}
},
...
...
@@ -533,7 +535,7 @@ protected virtual void SetupEnumMappings(ISqlGenerationHelper sqlGenerationHelpe
}
// Map arbitrary user POCOs to JSON
if
(
storeTypeName
==
"jsonb"
||
storeTypeName
==
"json"
)
if
(
storeTypeName
is
"jsonb"
or
"json"
)
{
return
new
NpgsqlJsonTypeMapping
(
storeTypeName
,
clrType
);
}
...
...
@@ -614,9 +616,17 @@ protected virtual void SetupEnumMappings(ISqlGenerationHelper sqlGenerationHelpe
return
mapping
;
}
if
(
clrType
==
typeof
(
uint
)
&&
mappingInfo
.
IsRowVersion
==
true
)
if
(
mappingInfo
.
IsRowVersion
==
true
)
{
return
_xid
;
if
(
clrType
==
typeof
(
uint
))
{
return
_xid
;
}
if
(
clrType
==
typeof
(
ulong
))
{
return
_xid8
;
}
}
}
...
...
test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingSourceTest.cs
浏览文件 @
db80fec8
...
...
@@ -35,6 +35,8 @@ public class NpgsqlTypeMappingSourceTest
[
InlineData
(
"geometry(pointz, 4326)"
,
typeof
(
Point
),
null
,
false
)]
[
InlineData
(
"geography(LineStringZM)"
,
typeof
(
LineString
),
null
,
false
)]
[
InlineData
(
"geometry(POLYGONM)"
,
typeof
(
Polygon
),
null
,
false
)]
[
InlineData
(
"xid"
,
typeof
(
uint
),
null
,
false
)]
[
InlineData
(
"xid8"
,
typeof
(
ulong
),
null
,
false
)]
public
void
By_StoreType
(
string
typeName
,
Type
type
,
int
?
size
,
bool
fixedLength
)
{
var
mapping
=
CreateTypeMappingSource
().
FindMapping
(
typeName
);
...
...
@@ -138,6 +140,8 @@ public void By_ClrType_and_precision(Type clrType, string expectedStoreType)
[
InlineData
(
"dummyrange"
,
typeof
(
NpgsqlRange
<
DummyType
>))]
[
InlineData
(
"geometry"
,
typeof
(
Geometry
))]
[
InlineData
(
"geometry(Point, 4326)"
,
typeof
(
Geometry
))]
[
InlineData
(
"xid"
,
typeof
(
uint
))]
[
InlineData
(
"xid8"
,
typeof
(
ulong
))]
public
void
By_StoreType_with_ClrType
(
string
storeType
,
Type
clrType
)
{
var
mapping
=
CreateTypeMappingSource
().
FindMapping
(
clrType
,
storeType
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录