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 6538067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:41:30+00:00 2026-05-25T10:41:30+00:00

This forms part of a series based around me getting my head around DDD

  • 0

This forms part of a series based around me getting my head around DDD 🙂

Following on from a previous question, but the background knowledge is not needed: System consuming WCF services from another system, when underlying databases have relationships

There is a Document System and an HR System. The HR System needs to save a document and also some HR specific data relating to the document.

My first thought was that the call to Document System should be in the Application Service of HR System (unnessacery code stripped out):

public class HRDocumentService
{
    public void SaveDocument(string filename, string employee)
    {
        long documentLibraryId = _documentLibraryService.SaveDocument(filename);
        HRDocument hrDocument = HRDocument.CreateDocument(documentLibraryId, employee);
        _hrDocumentRepository.Save(hrDocument);
    }
}

and the Repository is like this:

public class HRDocumentRepository
{
    public long Save(HRDocument hrDocument)
    {
        _session.Save(hrDocument);
    }
}

But Jak Charlton says in this article “What Sits Behind A Repository? Pretty much anything you like. Yep, you heard it right. You could have a database, or you could have many different databases. You could use relational databases, or object databases. You could have an in memory database, or a singleton containing a list of in memory items. You could have a REST layer, or a set of SOA services, or a file system, or an in memory cache…”

So now I’m thinking the service should just be this:

public class HRDocumentService
{
    public void SaveDocument(string filename, string employee)
    {
        HRDocument hrDocument = HRDocument.CreateDocument(documentLibraryId, employee);
        _hrDocumentRepository.Save(hrDocument);
    }
}

and calls to the Document Library service in the repository like this:

public class HRDocumentRepository
{
    public long Save(HRDocument hrDocument)
    {
        long documentLibraryId = _documentLibraryService.SaveDocument(filename);
        hrDocument.DocumentLibraryId = documentLibraryId;
        _session.Save(hrDocument);
    }
}

This way, arguably, the repsository is still only responsible for persistence.

Am I on the right lines here or way off?

  • 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-25T10:41:31+00:00Added an answer on May 25, 2026 at 10:41 am

    It seems that repositories accessing application services from other systems is quite accepted practice. The Microsoft Application Architecture Guide advocates this in the form of a ‘Service Agent’, and the Jak Charlton quote above also supports it. If using NHibernate for data access, you can do this by implementing IUserType, As I mention in this post: NHibernate: Lazy loading of IUserType. It’s not a universal solution – for example, it has poor performance if you are returning a collection and each entity has to make a WCF call for it’s child entity. When asking about integrating systems, people often advocate messaging and CQRS, but even Udi Dahan himself claims this is not suitable for the vast majority of systems.

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

Sidebar

Related Questions

i am following this tutorial: http://tutorial.symblog.co.uk/docs/validators-and-forms.html at the swift mailer part i am not
This is part question, and part hope for confirmation. I have my suspicions about
One part of web development (from a front-end perspective) is laying out forms. There
Note : Part of a series: C#: Accessing form members from another class and
I am using this form as a file upload form(as part of a larger
I'm rather new to Django and I'm using Django 1.0. I have this: forms.py:
If you saw the railscasts on nested forms this is the helper method to
http://weblog.rubyonrails.org/2009/1/26/nested-model-forms This post helped in learning how to handle multiple models in a rails
Ok, firstly this is not about forms this is about consistent layout as a
I have several forms like this: <table width=100% border=0 cellpadding=0 cellspacing=0 class=table_std> <tr id=exam_String_newValue_row>

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.