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
a7ff0b3d
Commit
a7ff0b3d
authored
Feb 08, 2017
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing Firebase Async, issue #695
TODO: All of these need race love in V2, complete re-vamp.
parent
7d49507f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
SqlMapperExtensions.Async.cs
Dapper.Contrib/SqlMapperExtensions.Async.cs
+22
-0
No files found.
Dapper.Contrib/SqlMapperExtensions.Async.cs
View file @
a7ff0b3d
...
...
@@ -429,4 +429,26 @@ public async Task<int> InsertAsync(IDbConnection connection, IDbTransaction tran
return
id
;
}
}
public
partial
class
FbAdapter
{
public
async
Task
<
int
>
InsertAsync
(
IDbConnection
connection
,
IDbTransaction
transaction
,
int
?
commandTimeout
,
string
tableName
,
string
columnList
,
string
parameterList
,
IEnumerable
<
PropertyInfo
>
keyProperties
,
object
entityToInsert
)
{
var
cmd
=
$"insert into
{
tableName
}
(
{
columnList
}
) values (
{
parameterList
}
)"
;
await
connection
.
ExecuteAsync
(
cmd
,
entityToInsert
,
transaction
,
commandTimeout
);
var
propertyInfos
=
keyProperties
as
PropertyInfo
[]
??
keyProperties
.
ToArray
();
var
keyName
=
propertyInfos
.
First
().
Name
;
var
r
=
await
connection
.
QueryAsync
(
$"SELECT FIRST 1
{
keyName
}
ID FROM
{
tableName
}
ORDER BY
{
keyName
}
DESC"
,
transaction
:
transaction
,
commandTimeout
:
commandTimeout
);
var
id
=
r
.
First
().
ID
;
if
(
id
==
null
)
return
0
;
if
(!
propertyInfos
.
Any
())
return
Convert
.
ToInt32
(
id
);
var
idp
=
propertyInfos
.
First
();
idp
.
SetValue
(
entityToInsert
,
Convert
.
ChangeType
(
id
,
idp
.
PropertyType
),
null
);
return
Convert
.
ToInt32
(
id
);
}
}
#endif
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