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
2a2ff865
Commit
2a2ff865
authored
Sep 11, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Dapper.Contrib to prefer its attribute but still fall back to others
parent
0ec089b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
SqlMapperExtensions.cs
Dapper.Contrib/SqlMapperExtensions.cs
+10
-6
No files found.
Dapper.Contrib/SqlMapperExtensions.cs
View file @
2a2ff865
...
@@ -290,15 +290,19 @@ private static string GetTableName(Type type)
...
@@ -290,15 +290,19 @@ private static string GetTableName(Type type)
}
}
else
else
{
{
//NOTE: This as dynamic trick should be able to handle both our own Table-attribute as well as the one in EntityFramework
var
tableAttr
=
type
#if NETSTANDARD1_3
#if NETSTANDARD1_3
.
GetTypeInfo
()
var
info
=
type
.
GetTypeInfo
();
#else
var
info
=
type
;
#endif
#endif
.
GetCustomAttributes
(
false
).
SingleOrDefault
(
attr
=>
attr
.
GetType
().
Name
==
"TableAttribute"
)
as
dynamic
;
//NOTE: This as dynamic trick falls back to handle both our own Table-attribute as well as the one in EntityFramework
if
(
tableAttr
!=
null
)
var
tableAttrName
=
info
.
GetCustomAttribute
<
TableAttribute
>(
false
)?.
Name
??
(
info
.
GetCustomAttributes
(
false
).
FirstOrDefault
(
attr
=>
attr
.
GetType
().
Name
==
"TableAttribute"
)
as
dynamic
)?.
Name
;
if
(
tableAttrName
!=
null
)
{
{
name
=
tableAttr
.
Name
;
name
=
tableAttrName
;
}
}
else
else
{
{
...
...
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