Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CleanArchitecture
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
CleanArchitecture
Commits
a8a837fd
Commit
a8a837fd
authored
Feb 19, 2017
by
Steve Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved event firing to after savechanges
parent
52e0c59c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
AppDbContext.cs
src/CleanArchitecture.Infrastructure/Data/AppDbContext.cs
+5
-1
No files found.
src/CleanArchitecture.Infrastructure/Data/AppDbContext.cs
View file @
a8a837fd
...
...
@@ -20,6 +20,9 @@ namespace CleanArchitecture.Infrastructure.Data
public
override
int
SaveChanges
()
{
int
result
=
base
.
SaveChanges
();
// dispatch events only if save was successful
var
entitiesWithEvents
=
ChangeTracker
.
Entries
<
BaseEntity
>()
.
Select
(
e
=>
e
.
Entity
)
.
Where
(
e
=>
e
.
Events
.
Any
())
...
...
@@ -34,7 +37,8 @@ namespace CleanArchitecture.Infrastructure.Data
_dispatcher
.
Dispatch
(
domainEvent
);
}
}
return
base
.
SaveChanges
();
return
result
;
}
}
}
\ No newline at end of file
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