Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Dapper
提交
62bdcd1b
D
Dapper
项目概览
int
/
Dapper
11 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dapper
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
62bdcd1b
编写于
8月 28, 2014
作者:
M
Marc Gravell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.33: SqlGeometry (core) and DbGeometry (EF) support
上级
54bc52b3
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
94 addition
and
66 deletion
+94
-66
Dapper NET40/Properties/AssemblyInfo.cs
Dapper NET40/Properties/AssemblyInfo.cs
+2
-2
Dapper NET40/SqlMapper.cs
Dapper NET40/SqlMapper.cs
+8
-5
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
+2
-2
Dapper.Contrib/Properties/AssemblyInfo.cs
Dapper.Contrib/Properties/AssemblyInfo.cs
+2
-2
Dapper.EntityFramework NET40/Dapper.EntityFramework NET40.csproj
...EntityFramework NET40/Dapper.EntityFramework NET40.csproj
+9
-1
Dapper.EntityFramework NET40/Properties/AssemblyInfo.cs
Dapper.EntityFramework NET40/Properties/AssemblyInfo.cs
+0
-36
Dapper.EntityFramework NET45/Dapper.EntityFramework NET45.csproj
...EntityFramework NET45/Dapper.EntityFramework NET45.csproj
+1
-0
Dapper.EntityFramework NET45/DbGeometryHandler.cs
Dapper.EntityFramework NET45/DbGeometryHandler.cs
+45
-0
Dapper.EntityFramework NET45/Handlers.cs
Dapper.EntityFramework NET45/Handlers.cs
+1
-0
Dapper.EntityFramework NET45/Properties/AssemblyInfo.cs
Dapper.EntityFramework NET45/Properties/AssemblyInfo.cs
+0
-1
Dapper.EntityFramework.nuspec
Dapper.EntityFramework.nuspec
+2
-2
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
+2
-2
DapperTests NET35/Properties/AssemblyInfo.cs
DapperTests NET35/Properties/AssemblyInfo.cs
+2
-2
DapperTests NET45/Properties/AssemblyInfo.cs
DapperTests NET45/Properties/AssemblyInfo.cs
+2
-2
Tests/Properties/AssemblyInfo.cs
Tests/Properties/AssemblyInfo.cs
+2
-2
Tests/Tests.cs
Tests/Tests.cs
+12
-6
dapper.nuspec
dapper.nuspec
+2
-1
未找到文件。
Dapper NET40/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -32,5 +32,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
Dapper NET40/SqlMapper.cs
浏览文件 @
62bdcd1b
...
...
@@ -839,11 +839,14 @@ internal static DbType LookupDbType(Type type, string name, out ITypeHandler han
{
return
DbType
.
Object
;
}
if
(
type
.
FullName
==
"Microsoft.SqlServer.Types.SqlGeography"
)
{
handler
=
new
UdtTypeHandler
(
"GEOGRAPHY"
);
AddTypeHandler
(
type
,
handler
);
return
DbType
.
Object
;
switch
(
type
.
FullName
)
{
case
"Microsoft.SqlServer.Types.SqlGeography"
:
AddTypeHandler
(
type
,
handler
=
new
UdtTypeHandler
(
"GEOGRAPHY"
));
return
DbType
.
Object
;
case
"Microsoft.SqlServer.Types.SqlGeometry"
:
AddTypeHandler
(
type
,
handler
=
new
UdtTypeHandler
(
"GEOMETRY"
));
return
DbType
.
Object
;
}
throw
new
NotSupportedException
(
string
.
Format
(
"The member {0} of type {1} cannot be used as a parameter value"
,
name
,
type
));
}
...
...
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
Dapper.Contrib/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
Dapper.EntityFramework NET40/Dapper.EntityFramework NET40.csproj
浏览文件 @
62bdcd1b
...
...
@@ -57,10 +57,15 @@
<Compile
Include=
"..\Dapper.EntityFramework NET45\DbGeographyHandler.cs"
>
<Link>
DbGeographyHandler.cs
</Link>
</Compile>
<Compile
Include=
"..\Dapper.EntityFramework NET45\DbGeometryHandler.cs"
>
<Link>
DbGeometryHandler.cs
</Link>
</Compile>
<Compile
Include=
"..\Dapper.EntityFramework NET45\Handlers.cs"
>
<Link>
Handlers.cs
</Link>
</Compile>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"..\Dapper.EntityFramework NET45\Properties\AssemblyInfo.cs"
>
<Link>
AssemblyInfo.cs
</Link>
</Compile>
<Compile
Include=
"SqlServerTypes\Loader.cs"
/>
</ItemGroup>
<ItemGroup>
...
...
@@ -92,6 +97,9 @@
<Name>
Dapper NET40
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder
Include=
"Properties\"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
Dapper.EntityFramework NET40/Properties/AssemblyInfo.cs
已删除
100644 → 0
浏览文件 @
54bc52b3
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[
assembly
:
AssemblyTitle
(
"Dapper.EntityFramework NET40"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
"Dapper.EntityFramework NET40"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © 2014"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[
assembly
:
ComVisible
(
false
)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[
assembly
:
Guid
(
"85331b38-d6e0-41f6-b1ed-b27a8747f827"
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
Dapper.EntityFramework NET45/Dapper.EntityFramework NET45.csproj
浏览文件 @
62bdcd1b
...
...
@@ -52,6 +52,7 @@
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"DbGeometryHandler.cs"
/>
<Compile
Include=
"DbGeographyHandler.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Handlers.cs"
/>
...
...
Dapper.EntityFramework NET45/DbGeometryHandler.cs
0 → 100644
浏览文件 @
62bdcd1b
using
Microsoft.SqlServer.Types
;
using
System
;
using
System.Data
;
using
System.Data.Entity.Spatial
;
using
System.Data.SqlClient
;
namespace
Dapper.EntityFramework
{
/// <summary>
/// Type-handler for the DbGeometry spatial type
/// </summary>
public
class
DbGeometryHandler
:
Dapper
.
SqlMapper
.
TypeHandler
<
DbGeometry
>
{
/// <summary>
/// Create a new handler instance
/// </summary>
protected
DbGeometryHandler
()
{
}
/// <summary>
/// Default handler instance
/// </summary>
public
static
readonly
DbGeometryHandler
Default
=
new
DbGeometryHandler
();
/// <summary>
/// Assign the value of a parameter before a command executes
/// </summary>
/// <param name="parameter">The parameter to configure</param>
/// <param name="value">Parameter value</param>
public
override
void
SetValue
(
IDbDataParameter
parameter
,
DbGeometry
value
)
{
parameter
.
Value
=
value
==
null
?
(
object
)
DBNull
.
Value
:
(
object
)
SqlGeometry
.
Parse
(
value
.
AsText
());
if
(
parameter
is
SqlParameter
)
{
((
SqlParameter
)
parameter
).
UdtTypeName
=
"GEOMETRY"
;
}
}
/// <summary>
/// Parse a database value back to a typed value
/// </summary>
/// <param name="value">The value from the database</param>
/// <returns>The typed value</returns>
public
override
DbGeometry
Parse
(
object
value
)
{
return
(
value
==
null
||
value
is
DBNull
)
?
null
:
DbGeometry
.
FromText
(
value
.
ToString
());
}
}
}
Dapper.EntityFramework NET45/Handlers.cs
浏览文件 @
62bdcd1b
...
...
@@ -11,6 +11,7 @@ public static class Handlers
public
static
void
Register
()
{
SqlMapper
.
AddTypeHandler
(
DbGeographyHandler
.
Default
);
SqlMapper
.
AddTypeHandler
(
DbGeometryHandler
.
Default
);
}
}
}
Dapper.EntityFramework NET45/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,6 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
Dapper.EntityFramework.nuspec
浏览文件 @
62bdcd1b
...
...
@@ -2,7 +2,7 @@
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<metadata
schemaVersion=
"2"
>
<id>
Dapper.EntityFramework
</id>
<version>
1.
26
</version>
<version>
1.
33
</version>
<title>
Dapper entity framework type handlers
</title>
<authors>
Marc Gravell
</authors>
<owners>
Marc Gravell
</owners>
...
...
@@ -14,7 +14,7 @@
<tags>
orm sql micro-orm
</tags>
<dependencies>
<dependency
id=
"EntityFramework"
version=
"6.1.1"
/>
<dependency
id=
"Dapper"
version=
"1.
26
"
/>
<dependency
id=
"Dapper"
version=
"1.
33
"
/>
</dependencies>
<frameworkAssemblies>
<frameworkAssembly
assemblyName=
"System.Core"
/>
...
...
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
DapperTests NET35/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
DapperTests NET45/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
Tests/Properties/AssemblyInfo.cs
浏览文件 @
62bdcd1b
...
...
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
2
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
3
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
3
.0.0"
)]
Tests/Tests.cs
浏览文件 @
62bdcd1b
...
...
@@ -2986,45 +2986,51 @@ class HazGeo
{
public
int
Id
{
get
;
set
;
}
public
DbGeography
Geo
{
get
;
set
;
}
public
DbGeometry
Geometry
{
get
;
set
;
}
}
class
HazSqlGeo
{
public
int
Id
{
get
;
set
;
}
public
SqlGeography
Geo
{
get
;
set
;
}
public
SqlGeometry
Geometry
{
get
;
set
;
}
}
public
void
DBGeography_SO24405645_SO24402424
()
{
Dapper
.
EntityFramework
.
Handlers
.
Register
();
connection
.
Execute
(
"create table #Geo (id int, geo geography)"
);
connection
.
Execute
(
"create table #Geo (id int, geo geography
, geometry geometry
)"
);
var
obj
=
new
HazGeo
{
Id
=
1
,
Geo
=
DbGeography
.
LineFromText
(
"LINESTRING(-122.360 47.656, -122.343 47.656 )"
,
4326
)
Geo
=
DbGeography
.
LineFromText
(
"LINESTRING(-122.360 47.656, -122.343 47.656 )"
,
4326
),
Geometry
=
DbGeometry
.
LineFromText
(
"LINESTRING (100 100, 20 180, 180 180)"
,
0
)
};
connection
.
Execute
(
"insert #Geo(id, geo
) values (@Id, @Geo
)"
,
obj
);
connection
.
Execute
(
"insert #Geo(id, geo
, geometry) values (@Id, @Geo, @Geometry
)"
,
obj
);
var
row
=
connection
.
Query
<
HazGeo
>(
"select * from #Geo where id=1"
).
SingleOrDefault
();
row
.
IsNotNull
();
row
.
Id
.
IsEqualTo
(
1
);
row
.
Geo
.
IsNotNull
();
row
.
Geometry
.
IsNotNull
();
}
public
void
SqlGeography_SO25538154
()
{
Dapper
.
SqlMapper
.
ResetTypeHandlers
();
connection
.
Execute
(
"create table #SqlGeo (id int, geo geography)"
);
connection
.
Execute
(
"create table #SqlGeo (id int, geo geography
, geometry geometry
)"
);
var
obj
=
new
HazSqlGeo
{
Id
=
1
,
Geo
=
SqlGeography
.
STLineFromText
(
new
SqlChars
(
new
SqlString
(
"LINESTRING(-122.360 47.656, -122.343 47.656 )"
)),
4326
)
Geo
=
SqlGeography
.
STLineFromText
(
new
SqlChars
(
new
SqlString
(
"LINESTRING(-122.360 47.656, -122.343 47.656 )"
)),
4326
),
Geometry
=
SqlGeometry
.
STLineFromText
(
new
SqlChars
(
new
SqlString
(
"LINESTRING (100 100, 20 180, 180 180)"
)),
0
)
};
connection
.
Execute
(
"insert #SqlGeo(id, geo
) values (@Id, @Geo
)"
,
obj
);
connection
.
Execute
(
"insert #SqlGeo(id, geo
, geometry) values (@Id, @Geo, @Geometry
)"
,
obj
);
var
row
=
connection
.
Query
<
HazSqlGeo
>(
"select * from #SqlGeo where id=1"
).
SingleOrDefault
();
row
.
IsNotNull
();
row
.
Id
.
IsEqualTo
(
1
);
row
.
Geo
.
IsNotNull
();
row
.
Geometry
.
IsNotNull
();
}
public
void
TypeBasedViaDynamic
()
...
...
dapper.nuspec
浏览文件 @
62bdcd1b
...
...
@@ -2,7 +2,7 @@
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<metadata
schemaVersion=
"2"
>
<id>
Dapper
</id>
<version>
1.3
2
</version>
<version>
1.3
3
</version>
<title>
Dapper dot net
</title>
<authors>
Sam Saffron,Marc Gravell
</authors>
<owners>
Sam Saffron,Marc Gravell
</owners>
...
...
@@ -19,6 +19,7 @@
<frameworkAssembly
assemblyName=
"Microsoft.CSharp"
targetFramework=
".NETFramework4.0-Client, .NETFramework4.0"
/>
</frameworkAssemblies>
<releaseNotes>
* 1.33 - Support for SqlGeometry (core) and DbGeometry (EF)
* 1.32 - Support for SqlGeography in core library
* 1.31 - Fix issue with error message when there is a column/type mismatch
* 1.30 - Better async cancellation
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录