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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:55:36+00:00 2026-05-20T12:55:36+00:00

Assuming my application did not warrant a full blown DDD setup, would Repositories still

  • 0

Assuming my application did not warrant a full blown DDD setup, would Repositories still be useful? I like the way they shield from implementation details (such as use of Entity Framework) underneath. However Repositories tend to be tied to Aggregate Roots (the concept is still a holy grail to me) by definition.

I suppose the question could also be put as such: if I have a typical 3-tier application, with a business layer facade consisting of “logical grouping” classes based on functionality (rather than aggregate roots as in DDD) such as TradingManager and ContactsManager, would it make sense to also create “logical grouping” repositories. Or perhaps a Data Access Object, which I believe is like a Repository without the aggregate root requirement. Of course I will still have a Model (EF POCOs) that will be passed up and down between the layers.

Also, is what I just described would be considered as a Transaction Script approach? It’s certainly not DDD, and not Active Record. I’m not even sure if Active Record exists with EF4 like it does with Nhibernate.

I am trying to understand how others structure n-layered applications when they do not follow DDD.

  • 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-20T12:55:37+00:00Added an answer on May 20, 2026 at 12:55 pm

    As you’ve hinted, it sounds like your going more for a DAO. I think DAOs are very useful in non-DDD projects where you want to abstract the data layer technology completely away.

    As far as transaction script goes, it is orthogonal to your data layer design. Transaction script implies that each business operation is grouped into a procedural call. Example: the transaction script pattern is often used in WCF service calls on the server side, with each service method following the transaction script pattern. Think of it this way: with transaction script, the actual business logic is not in objects, rather it’s written right in the transaction script procedure call. Common business logic may be shared between transaction scripts, but it’s usually done through static methods, helpers, etc… and not through “pure” OO.

    Here’s a bit of pseudo-code

    // traditional transaction script
    public class MailService
    {
        public void UpdateEmail(string userName, string newEmail)()
        {
           if(db.UserExists(userName))
           {
              if(EmailHelper.ValidateEmailFormat(newEmail))
              {
                 db.UpdateEmail(userName, newEmail);
              }
           } 
        }
    }
    
    // transaction script with anemic domain objects
    public class MailService
    {
        public void UpdateEmail(string userName, string newEmail)()
        {
           var userDAO = new UserDAO();
           var emailDAO = new EmailDAO();
    
           var existingUser = userDAO.GetUserByName(userName);       
    
           if(existingUser != null)
           {
              if(EmailHelper.ValidateEmailFormat(newEmail))
              {
                 emailDAO.UpdateEmail(existingUser, newEmail);
              }
           } 
        }
    }  
    
    // More of an OO / DDDish approach
    public class MailService
    {
        public void UpdateEmail(string userName, string newEmail)()
        {
           var userRepository = new Repository<User>();
    
           var userToUpdate = userRepository.Where(x => x.UserName = userName).FirstOrDefault();
    
           if(userToUpdate != null)
           {
               userToUpdate.Email = newEmail;
    
               if (user.IsValid())
               {
                   userRepository.Update(userToUpdate);
               } 
           }
        }
    }
    

    Obviously the first example isn’t OO at all. The 2nd example is more object-based than OO as all of the business logic happens in the MailService call. The third example is traditional OO. Only the control flow occurs in the service call; all of the business logic is handled in the User.IsValid() method.

    It all boils down to where you put the business logic.

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

Sidebar

Related Questions

Assuming my web application has full support of PUT and DELETE on the server
I wrote a facebook application but authentication is not working properly. Despite of googling
I have a little application, let's call it launch.exe. It is a c++ appl.
As an example, I have the following draw function in some OpenGL application: void
We are rewriting an old site for a client, from Classic ASP to ASP.NET
I'm curious about the current trend these days for ajax-applications. Is it acceptable to
Long time listener, first time caller… I've got two questions in a form, the
I'm working on an ASP.NET MVC site, using EF4 and Automapper. I'm making good
Hi all this is my post on stackoverflow. I am normally a lurker and

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.