Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8825927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:59:52+00:00 2026-06-14T06:59:52+00:00

So my question is very much related to this one: Entity persitance inside Domain

  • 0

So my question is very much related to this one: Entity persitance inside Domain Events using a repository and Entity Framework?

EDIT: A much better discussion on the topic is also here: Where to raise persistence-dependent domain events – service, repository, or UI?

However my question is rather more simple and technical, assuming that I’m taking the right approach.

Let’s suppose I have the following projects:

MyDomainLayer -> very simple classes, Persitence Ignorance, a.k.a POCOs
MyInfrastructureLayer -> includes code for repositories, Entity Framework
MyApplicationLayer -> includes ASP.Net MVC controllers 
MyServicesLayer -> WCF-related code 
MyWebApplication -> ASP.Net MVC (Views, Scripts, etc)

When an event is raised (for example a group membership has been granted),
then two things should be done (in two different layers):

  1. To Persist data (insert a new group membership record in the DB)
  2. To Create a notification for the involved users (UI related)

I’ll take a simple example of the last reference I wrote in the introduction:

The domain layer has the following code:

public void ChangeStatus(OrderStatus status)
{
    // change status
    this.Status = status;
    DomainEvent.Raise(new OrderStatusChanged { OrderId = Id, Status = status });
}

Let’s assume the vent handler is in MyApplicationLayer (to be able to talk to the Services Layer).
It has the following code:

DomainEvent.Register<OrderStatusChanged>(x => orderStatusChanged = x);

How does the wire-in happen? I guess is with structuremap, but how does this wire-in code looks exactly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:59:53+00:00Added an answer on June 14, 2026 at 6:59 am

    First, your layering isn’t exactly right. Corrections:

    Application Layer – ASP.NET MVC controllers are normally thought of as forming an adapter between your application layer and HTTP/HTML. Therefore, the controllers aren’t themselves part of the application layer. What belongs in application layer are application services.

    MyServicesLayer – WCF-related code. WCF implemented services are adapters in the hexagonal architecture referenced by Dennis Traub.

    MyWebApplication – ASP.Net MVC (Views, Scripts, etc). Again, this forms an adapter in a hexagonal architecture. MVC controllers belong here as well – effectively they are implementation detail of this adapter. This layer is very similar to service layer implemented with WCF.

    Next, you describe 2 things that should happen in response to an event. Persistence is usually achieved with committing a unit of work within a a transaction, not as a handler in response to an event. Also, notifications should be made after persistence is complete, or in other words after the transaction is committed. This is best done in an eventually consistent manner that is outside of the unit of work that generated the domain event in the first place.

    For specifics on how to implement a domain event pub/sub system take a look here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Important : Please see this very much related question: Return multiple values in C++
Very much related to my previous question , but I found this to be
This question is very much related to: A) How to separate CUDA code into
I had asked a question very much similar to this in the thread: https://stackoverflow.com/questions/11259474/store-the-numericals-in-char-array-into-an-integer-variable-in-vc
This is the first time i ask question here so thanks very much in
Not really a programming related question but... I'd like very much to experiment with
Edited 3.9.2011 to add one more related question Hello, I'm very new to WCF
My question is very much like Getting the return value of a PL/SQL function
I'm doing something very similar to the stackoverflow question preview only much more basic.
My question is very similar to this question - Addin parameter for Oracle except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.