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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:34:55+00:00 2026-05-28T20:34:55+00:00

In my project, I have a Customers table, with 3 foreign keys to the

  • 0

In my project, I have a Customers table, with 3 foreign keys to the Addresses table. One for MainAddress, one for BillingAddress and one for ShippingAddress.

I am using a unit of work and repository pattern with a CustomerRepository and AddressRepository.

Occasionally I will need to work with the addresses on their own, but most of the time they will be part of the Customers domain object.

My question is a best practices design question. Should the business logic layer be responsible for calling both the CustomerRepository and AddressRepository to add/update, or should the CustomerRepository be smart enough to add/update addresses so that the BLL needs only call “AddCustomer” or “EditCustomer” and all the addresses tables are automatically added/updated?

  • 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-28T20:34:56+00:00Added an answer on May 28, 2026 at 8:34 pm

    I would let the CustomerRepository also handle the update of the Addresses. I assume you are using an object model where a customer object has a generic collection of addresses using a
    “has a” relationship (i.e. a customer has addresses). If you are using an ORM under the hood of your repository it will handle the update of this object and its relationships anyway. I see no benefit to have each repository handle the individual objects of this relationship or with your business logic needing to handle updates of this relationship. I would use the AddressRepository only when working directly with addresses. That is my advice for this example of a simple “has a” relationship. There will be times with more complex relationships where you will want to have the business logic handle this for you instead of the repository. An example might be when the objects are distributed across different data stores.

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

Sidebar

Related Questions

I have a scenario where customers are asking to develop a new project on
I am using hibernate, struts, extjs in my project. I have a Customer object
I have project in Dropbox and two running laptops: one with Ubuntu and one
I have an ASP.NET 3.5 webforms project written in VB that involves a multi-table
I'm working on an integration project and have created a batchlog table where I
I have a rails project and have a model customers and suppliers . I
I have a Solution with multiple projects. One project is my DataAccess project with
I have EF 4 implemented in the project. Within it, there are tables customer
I'm working on a SaaS project that will have each customer having an instance
I have a project which it's domain contain following classes: Courier Customer Food Order

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.