Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
451d50ba
Commit
451d50ba
authored
Aug 06, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.29: make Underscore_Names opt-in
parent
ce23d47d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
47 additions
and
24 deletions
+47
-24
AssemblyInfo.cs
Dapper NET40/Properties/AssemblyInfo.cs
+2
-2
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+20
-6
AssemblyInfo.cs
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
Dapper.Contrib/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
DapperTests NET35/Properties/AssemblyInfo.cs
+2
-2
Tests.cs
DapperTests NET35/Tests.cs
+11
-3
AssemblyInfo.cs
DapperTests NET45/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
Tests/Properties/AssemblyInfo.cs
+2
-2
dapper.nuspec
dapper.nuspec
+2
-1
No files found.
Dapper NET40/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
Dapper NET40/SqlMapper.cs
View file @
451d50ba
...
...
@@ -4678,25 +4678,39 @@ public SqlMapper.IMemberMap GetConstructorParameter(ConstructorInfo constructor,
public
SqlMapper
.
IMemberMap
GetMember
(
string
columnName
)
{
var
property
=
_properties
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
,
StringComparison
.
Ordinal
))
??
_properties
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
,
StringComparison
.
OrdinalIgnoreCase
))
??
_properties
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
.
Replace
(
"_"
,
""
),
StringComparison
.
Ordinal
))
??
_properties
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
,
StringComparison
.
OrdinalIgnoreCase
));
if
(
property
==
null
&&
MatchNamesWithUnderscores
)
{
property
=
_properties
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
.
Replace
(
"_"
,
""
),
StringComparison
.
Ordinal
))
??
_properties
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
.
Replace
(
"_"
,
""
),
StringComparison
.
OrdinalIgnoreCase
));
}
if
(
property
!=
null
)
return
new
SimpleMemberMap
(
columnName
,
property
);
var
field
=
_fields
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
,
StringComparison
.
Ordinal
))
??
_fields
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
,
StringComparison
.
OrdinalIgnoreCase
))
??
_fields
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
.
Replace
(
"_"
,
""
),
StringComparison
.
Ordinal
))
??
_fields
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
,
StringComparison
.
OrdinalIgnoreCase
));
if
(
field
==
null
&&
MatchNamesWithUnderscores
)
{
field
=
_fields
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
.
Replace
(
"_"
,
""
),
StringComparison
.
Ordinal
))
??
_fields
.
FirstOrDefault
(
p
=>
string
.
Equals
(
p
.
Name
,
columnName
.
Replace
(
"_"
,
""
),
StringComparison
.
OrdinalIgnoreCase
));
}
if
(
field
!=
null
)
return
new
SimpleMemberMap
(
columnName
,
field
);
return
null
;
}
/// <summary>
/// Should column names like User_Id be allowed to match properties/fields like UserId ?
/// </summary>
public
static
bool
MatchNamesWithUnderscores
{
get
;
set
;
}
}
/// <summary>
/// Implements custom property mapping by user provided criteria (usually presence of some custom attribute with column to member mapping)
/// </summary>
...
...
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
Dapper.Contrib/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
DapperTests NET35/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
DapperTests NET35/Tests.cs
View file @
451d50ba
...
...
@@ -17,9 +17,17 @@ public void TestBasicStringUsage()
}
public
void
TestClassWithStringUsage
()
{
var
oldMatch
=
Dapper
.
DefaultTypeMap
.
MatchNamesWithUnderscores
;
try
{
DefaultTypeMap
.
MatchNamesWithUnderscores
=
true
;
var
arr
=
connection
.
Query
<
BasicType
>(
"select 'abc' as [Value], '123' as [Another_Value] union all select @txt, @txt2"
,
new
{
txt
=
"def"
,
txt2
=
"456"
}).
ToArray
();
arr
.
Select
(
x
=>
x
.
Value
).
IsSequenceEqualTo
(
new
[]
{
"abc"
,
"def"
});
arr
.
Select
(
x
=>
x
.
AnotherValue
).
IsSequenceEqualTo
(
new
[]
{
"123"
,
"456"
});
}
finally
{
DefaultTypeMap
.
MatchNamesWithUnderscores
=
oldMatch
;
}
}
class
BasicType
{
...
...
DapperTests NET45/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
Tests/Properties/AssemblyInfo.cs
View file @
451d50ba
...
...
@@ -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.2
8
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
8
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.2
9
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.2
9
.0.0"
)]
dapper.nuspec
View file @
451d50ba
...
...
@@ -2,7 +2,7 @@
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<metadata
schemaVersion=
"2"
>
<id>
Dapper
</id>
<version>
1.2
8
</version>
<version>
1.2
9
</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.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.27 - Fixes for type-handler parse; ensure type-handlers get last dibs on configuring parameters
* 1.26 - New type handler API for extension support
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment