Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
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
CAP
Commits
b3d64a80
Commit
b3d64a80
authored
Aug 25, 2018
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement SqlServerCapTransaction
parent
d753b1a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
ICapTransaction.SqlServer.cs
src/DotNetCore.CAP.SqlServer/ICapTransaction.SqlServer.cs
+33
-3
No files found.
src/DotNetCore.CAP.SqlServer/ICapTransaction.SqlServer.cs
View file @
b3d64a80
...
@@ -25,7 +25,21 @@ namespace DotNetCore.CAP
...
@@ -25,7 +25,21 @@ namespace DotNetCore.CAP
protected
override
void
AddToSent
(
CapPublishedMessage
msg
)
protected
override
void
AddToSent
(
CapPublishedMessage
msg
)
{
{
var
transactionKey
=
((
SqlConnection
)((
IDbTransaction
)
DbTransaction
).
Connection
).
ClientConnectionId
;
var
dbTransaction
=
DbTransaction
as
IDbTransaction
;
if
(
dbTransaction
==
null
)
{
if
(
DbTransaction
is
IDbContextTransaction
dbContextTransaction
)
{
dbTransaction
=
dbContextTransaction
.
GetDbTransaction
();
}
if
(
dbTransaction
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
DbTransaction
));
}
}
var
transactionKey
=
((
SqlConnection
)
dbTransaction
.
Connection
).
ClientConnectionId
;
if
(
_diagnosticProcessor
.
BufferList
.
TryGetValue
(
transactionKey
,
out
var
list
))
if
(
_diagnosticProcessor
.
BufferList
.
TryGetValue
(
transactionKey
,
out
var
list
))
{
{
list
.
Add
(
msg
);
list
.
Add
(
msg
);
...
@@ -39,12 +53,28 @@ namespace DotNetCore.CAP
...
@@ -39,12 +53,28 @@ namespace DotNetCore.CAP
public
override
void
Commit
()
public
override
void
Commit
()
{
{
throw
new
NotImplementedException
();
switch
(
DbTransaction
)
{
case
IDbTransaction
dbTransaction
:
dbTransaction
.
Commit
();
break
;
case
IDbContextTransaction
dbContextTransaction
:
dbContextTransaction
.
Commit
();
break
;
}
}
}
public
override
void
Rollback
()
public
override
void
Rollback
()
{
{
throw
new
NotImplementedException
();
switch
(
DbTransaction
)
{
case
IDbTransaction
dbTransaction
:
dbTransaction
.
Rollback
();
break
;
case
IDbContextTransaction
dbContextTransaction
:
dbContextTransaction
.
Rollback
();
break
;
}
}
}
public
override
void
Dispose
()
public
override
void
Dispose
()
...
...
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