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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:36:14+00:00 2026-05-16T07:36:14+00:00

I have a problem I want to know your opinion. I am trying to

  • 0

I have a problem I want to know your opinion.

I am trying to use Repository Pattern. I have a repository object which load data to a POCO. I have also created a Business logic layer which adds a little bit of functionality but basically wraps the POCO. So in the end I have a BLL which loads DAO with usage of repository.

I am not very happy with this solution. I have a three layers but I feel that BLL is not providing enought functionality to keep it there. On the other hand I do not want to put my logic in the repository layer nor data access layer?

So my question is where should I put logic for application? Which solution do you use(DAO + repo or DAO + BLL + rep or any other)?

  • 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-16T07:36:15+00:00Added an answer on May 16, 2026 at 7:36 am

    There are two basic ways to think about business rules when designing your domain.

    1.) The domain entities are basic POCO/DTOs. And you hand them off to domain services. These services could be as simple as another class, or they really could be actual services sitting on another server.

    var user = repository.Find(x => x.UserName == userName);
    if (userLogonService.IsValidUser(user, password)) {
       userLogonService.UpdateUserAsLoggedOn(user);
    }
    repository.SaveChanges();
    

    2.) The domain entities contain their own operation logic. This is closer to what many MVC patterns will follow. And since you asked, this is the model that I prefer.

    var user = repository.Find(x => x.UserName == userName);
    if (user.CheckPassword(password)) {
        user.LogOnNow();
    }
    repository.SaveChanges();
    

    Both are completely valid patterns. #1 has a discrete business operation tier, but suffers from an Anemic Domain Model. #2 can lead to big domain entities if you domain starts to become complicated, or if a model can do a lot of things.

    EDIT #1: Response to John Kraft

    Oven.Bake(myPizza) vs. myPizza.Bake()

    I mostly agree. Do you have a single Oven service, or do you have dozens of available ovens stored in an oven repository where oven is just another domain entity? In #2, the oven is part of the domain. The way I tend to do domain modeling, most nouns are domain entities, unless you are 100% sure that there is exactly one of the thing.

    But something does happen to pizza when it is baked.

    interface ICanBeBaked {
        int BakeMinutes { get; }
        int BakeTemp { get; }
        void Bake();
    }
    class Pizza : ICanBeBaked {
        int BakeMinutes { get { return 15; } }
        int BakeTemp { get { return 425; } }
        void Bake() {
            // melt cheese!
            this.isBaked = true;
        }
    }
    class Oven {
        void Bake(ICanBeBaked thingToBake) {
            // set the temp, reserve this oven for the duration, etc.
            thingToBake.Bake();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem but first i want to know if im working on
I have a problem and I want to implement the MVC pattern to my
I have a problem when I want to sending data using byte format in
I just want to know what is your opinion about how to fingerprint/verify html/links
I have a problem here and I need your help. Im trying to retrieve
I have this problem: I want to generate a new source code file from
I am using GWT/JAVA for development. I have following problem: I want to remove
I have problem, when I want add Node to my GUI from other Thread.
I have problem with fancybox. I want to write a function that will run
I have problem with HTTP headers, they're encoded in ASCII and I want to

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.