Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Dapper
提交
8fcb8ebb
D
Dapper
项目概览
int
/
Dapper
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
8fcb8ebb
编写于
8月 26, 2014
作者:
M
Marc Gravell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
r1.31; Issue 148/149: error message on bad column maps borked due to sequential access
上级
3691fe13
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
46 addition
and
28 deletion
+46
-28
Dapper NET40/Properties/AssemblyInfo.cs
Dapper NET40/Properties/AssemblyInfo.cs
+2
-2
Dapper NET40/SqlMapper.cs
Dapper NET40/SqlMapper.cs
+13
-13
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.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
+17
-0
dapper.nuspec
dapper.nuspec
+2
-1
未找到文件。
Dapper NET40/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -32,5 +32,5 @@
...
@@ -32,5 +32,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Dapper NET40/SqlMapper.cs
浏览文件 @
8fcb8ebb
...
@@ -3285,7 +3285,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3285,7 +3285,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
bool
first
=
true
;
bool
first
=
true
;
var
allDone
=
il
.
DefineLabel
();
var
allDone
=
il
.
DefineLabel
();
int
enumDeclareLocal
=
-
1
;
int
enumDeclareLocal
=
-
1
,
valueCopyLocal
=
il
.
DeclareLocal
(
typeof
(
object
)).
LocalIndex
;
foreach
(
var
item
in
members
)
foreach
(
var
item
in
members
)
{
{
if
(
item
!=
null
)
if
(
item
!=
null
)
...
@@ -3300,6 +3300,8 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3300,6 +3300,8 @@ public static void SetTypeMap(Type type, ITypeMap map)
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [target][target][reader][index][index]
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [target][target][reader][index][index]
il
.
Emit
(
OpCodes
.
Stloc_0
);
// stack is now [target][target][reader][index]
il
.
Emit
(
OpCodes
.
Stloc_0
);
// stack is now [target][target][reader][index]
il
.
Emit
(
OpCodes
.
Callvirt
,
getItem
);
// stack is now [target][target][value-as-object]
il
.
Emit
(
OpCodes
.
Callvirt
,
getItem
);
// stack is now [target][target][value-as-object]
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [target][target][value-as-object][value-as-object]
StoreLocal
(
il
,
valueCopyLocal
);
Type
colType
=
reader
.
GetFieldType
(
index
);
Type
colType
=
reader
.
GetFieldType
(
index
);
Type
memberType
=
item
.
MemberType
;
Type
memberType
=
item
.
MemberType
;
...
@@ -3332,7 +3334,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3332,7 +3334,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
StoreLocal
(
il
,
enumDeclareLocal
);
// stack is now [target][target]
StoreLocal
(
il
,
enumDeclareLocal
);
// stack is now [target][target]
il
.
Emit
(
OpCodes
.
Ldtoken
,
unboxType
);
// stack is now [target][target][enum-type-token]
il
.
Emit
(
OpCodes
.
Ldtoken
,
unboxType
);
// stack is now [target][target][enum-type-token]
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
Type
).
GetMethod
(
"GetTypeFromHandle"
),
null
);
// stack is now [target][target][enum-type]
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
Type
).
GetMethod
(
"GetTypeFromHandle"
),
null
);
// stack is now [target][target][enum-type]
il
.
Emit
(
OpCodes
.
Ldloc_2
);
// stack is now [target][target][enum-type][string]
LoadLocal
(
il
,
enumDeclareLocal
);
// stack is now [target][target][enum-type][string]
il
.
Emit
(
OpCodes
.
Ldc_I4_1
);
// stack is now [target][target][enum-type][string][true]
il
.
Emit
(
OpCodes
.
Ldc_I4_1
);
// stack is now [target][target][enum-type][string][true]
il
.
EmitCall
(
OpCodes
.
Call
,
enumParse
,
null
);
// stack is now [target][target][enum-as-object]
il
.
EmitCall
(
OpCodes
.
Call
,
enumParse
,
null
);
// stack is now [target][target][enum-as-object]
il
.
Emit
(
OpCodes
.
Unbox_Any
,
unboxType
);
// stack is now [target][target][typed-value]
il
.
Emit
(
OpCodes
.
Unbox_Any
,
unboxType
);
// stack is now [target][target][typed-value]
...
@@ -3460,6 +3462,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3460,6 +3462,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
il
.
BeginCatchBlock
(
typeof
(
Exception
));
// stack is Exception
il
.
BeginCatchBlock
(
typeof
(
Exception
));
// stack is Exception
il
.
Emit
(
OpCodes
.
Ldloc_0
);
// stack is Exception, index
il
.
Emit
(
OpCodes
.
Ldloc_0
);
// stack is Exception, index
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is Exception, index, reader
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is Exception, index, reader
LoadLocal
(
il
,
valueCopyLocal
);
// stack is Exception, index, reader, value
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
SqlMapper
).
GetMethod
(
"ThrowDataException"
),
null
);
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
SqlMapper
).
GetMethod
(
"ThrowDataException"
),
null
);
il
.
EndExceptionBlock
();
il
.
EndExceptionBlock
();
...
@@ -3635,36 +3638,33 @@ private static void LoadLocalAddress(ILGenerator il, int index)
...
@@ -3635,36 +3638,33 @@ private static void LoadLocalAddress(ILGenerator il, int index)
/// <summary>
/// <summary>
/// Throws a data exception, only used internally
/// Throws a data exception, only used internally
/// </summary>
/// </summary>
/// <param name="ex"></param>
[
Obsolete
(
"Intended for internal use only"
)]
/// <param name="index"></param>
public
static
void
ThrowDataException
(
Exception
ex
,
int
index
,
IDataReader
reader
,
object
value
)
/// <param name="reader"></param>
public
static
void
ThrowDataException
(
Exception
ex
,
int
index
,
IDataReader
reader
)
{
{
Exception
toThrow
;
Exception
toThrow
;
try
try
{
{
string
name
=
"(n/a)"
,
v
alue
=
"(n/a)"
;
string
name
=
"(n/a)"
,
formattedV
alue
=
"(n/a)"
;
if
(
reader
!=
null
&&
index
>=
0
&&
index
<
reader
.
FieldCount
)
if
(
reader
!=
null
&&
index
>=
0
&&
index
<
reader
.
FieldCount
)
{
{
name
=
reader
.
GetName
(
index
);
name
=
reader
.
GetName
(
index
);
try
try
{
{
object
val
=
reader
.
GetValue
(
index
);
// if there throw an exception, then I got one message, but Which column?
if
(
value
==
null
||
value
is
DBNull
)
if
(
val
==
null
||
val
is
DBNull
)
{
{
v
alue
=
"<null>"
;
formattedV
alue
=
"<null>"
;
}
}
else
else
{
{
value
=
Convert
.
ToString
(
val
)
+
" - "
+
Type
.
GetTypeCode
(
val
.
GetType
());
formattedValue
=
Convert
.
ToString
(
value
)
+
" - "
+
Type
.
GetTypeCode
(
value
.
GetType
());
}
}
}
}
catch
(
Exception
valEx
)
catch
(
Exception
valEx
)
{
{
v
alue
=
valEx
.
Message
;
formattedV
alue
=
valEx
.
Message
;
}
}
}
}
toThrow
=
new
DataException
(
string
.
Format
(
"Error parsing column {0} ({1}={2})"
,
index
,
name
,
v
alue
),
ex
);
toThrow
=
new
DataException
(
string
.
Format
(
"Error parsing column {0} ({1}={2})"
,
index
,
name
,
formattedV
alue
),
ex
);
}
}
catch
catch
{
// throw the **original** exception, wrapped as DataException
{
// throw the **original** exception, wrapped as DataException
...
...
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Dapper.Contrib/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
DapperTests NET35/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
DapperTests NET45/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Tests/Properties/AssemblyInfo.cs
浏览文件 @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Tests/Tests.cs
浏览文件 @
8fcb8ebb
...
@@ -3476,6 +3476,23 @@ public void SO25069578_DynamicParams_Procs()
...
@@ -3476,6 +3476,23 @@ public void SO25069578_DynamicParams_Procs()
tran
.
Rollback
();
tran
.
Rollback
();
row
.
X
.
IsEqualTo
(
"bar"
);
row
.
X
.
IsEqualTo
(
"bar"
);
}
}
public
void
Issue149_TypeMismatch_SequentialAccess
()
{
string
error
;
Guid
guid
=
Guid
.
Parse
(
"cf0ef7ac-b6fe-4e24-aeda-a2b45bb5654e"
);
try
{
var
result
=
connection
.
Query
<
Issue149_Person
>(
@"select @guid as Id"
,
new
{
guid
}).
First
();
error
=
null
;
}
catch
(
Exception
ex
)
{
error
=
ex
.
Message
;
}
error
.
IsEqualTo
(
"Error parsing column 0 (Id=cf0ef7ac-b6fe-4e24-aeda-a2b45bb5654e - Object)"
);
}
public
class
Issue149_Person
{
public
string
Id
{
get
;
set
;
}
}
public
class
HazX
public
class
HazX
{
{
public
string
X
{
get
;
set
;
}
public
string
X
{
get
;
set
;
}
...
...
dapper.nuspec
浏览文件 @
8fcb8ebb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<metadata
schemaVersion=
"2"
>
<metadata
schemaVersion=
"2"
>
<id>
Dapper
</id>
<id>
Dapper
</id>
<version>
1.3
0
</version>
<version>
1.3
1
</version>
<title>
Dapper dot net
</title>
<title>
Dapper dot net
</title>
<authors>
Sam Saffron,Marc Gravell
</authors>
<authors>
Sam Saffron,Marc Gravell
</authors>
<owners>
Sam Saffron,Marc Gravell
</owners>
<owners>
Sam Saffron,Marc Gravell
</owners>
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<frameworkAssembly
assemblyName=
"Microsoft.CSharp"
targetFramework=
".NETFramework4.0-Client, .NETFramework4.0"
/>
<frameworkAssembly
assemblyName=
"Microsoft.CSharp"
targetFramework=
".NETFramework4.0-Client, .NETFramework4.0"
/>
</frameworkAssemblies>
</frameworkAssemblies>
<releaseNotes>
<releaseNotes>
* 1.31 - Fix issue with error message when there is a column/type mismatch
* 1.30 - Better async cancellation
* 1.30 - Better async cancellation
* 1.29 - Make underscore name matching optional (opt-in) - this can be a breaking change for some people
* 1.29 - Make underscore name matching optional (opt-in) - this can be a breaking change for some people
* 1.28 - Much better numeric type conversion; fix for large oracle strings; map Foo_Bar to FooBar (etc); ExecuteScalar added; stability fixes
* 1.28 - Much better numeric type conversion; fix for large oracle strings; map Foo_Bar to FooBar (etc); ExecuteScalar added; stability fixes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录