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

  • SEARCH
  • Home
  • 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 7679893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:59:04+00:00 2026-05-31T17:59:04+00:00

I seem to stumble on problem after problem giving my entities behaviour. I have

  • 0

I seem to stumble on problem after problem giving my entities behaviour.

I have a system where a user gets a notification when someone comments his article. Right now it is via an e-mail.

I’m struggling how to implement this the DDD way.

Option 1

User entity has a Notify method: User.Notify()
The method uses C# built in classes to send an e-mail notification via e-mail

The problem with having this in the domain is that it is technology specific, and how a user is notified might change in the future. I feel this belongs to infrastructure, but how then can a user have behavior?

Option 2

I create a Service: NotificationService.Notify(User)
The Service uses C# built in classes to send an e-mail

The pro is that the service could be an Application Service, and as far as I know an application service can use the infrastructure and call things like the System.Net.Mail and repositories for that sake.

How would you implement this?

  • 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-05-31T17:59:05+00:00Added an answer on May 31, 2026 at 5:59 pm

    This operation doesn’t seems to be natural part of User entity. This operation is stateless. So, it seems to me that notification is responsibility of service.

    This is not domain service, because its not about business logic. Notification service abstracts infrastructure implementations from your domain (User). Notification could use Emails, MSMQ or put messages to database. This should not affect your domain model. So, thats definitely goes to infrastructure.

    So, I’d go for option 2. Infrastructure service.

    PS Consider about more descriptive method name NotifyCommentAdded

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

Sidebar

Related Questions

I seem to have stumbled over a problem regarding saving an xml file from
Seem's to be a stupid problem but here I go... I have a table
I seem to always have problems with converting data to and from XML in
We have a C# logging class that uses System.Diagnostics.StackTrace and StackFrame to obtain information
I am trying to DRY up some code in HAML, but seem to have
When following the procedure on wikipedia for wheel factorization , I seem to have
After being recommended to use adehabitat to calculate volume of intersection I have stumbled
I Have stumbled across CNN's website today http://edition.cnn.com/TECH/ they seem to have several other
Seem to be having an issue with std::auto_ptr and assignment, such that the object
I seem to be missing something about LINQ. To me, it looks like it's

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.