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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:39:52+00:00 2026-06-18T17:39:52+00:00

I have a database with a Customer, Supplier, and Services (this is a gross

  • 0

I have a database with a Customer, Supplier, and Services (this is a gross simplification, I really have about 100 tables)

I am developing a new Entity Framework library for accessing these tables.

A Customer has many Suppliers

A Supplier has many Services

I am trying to decide which approach to follow –

A )
Use mapping to connect the Customer to the Supplier and the Supplier to the Services, then every time I load a customer I get all his suppliers and their services (and other tables loaded)

B )
Have no mapping between entities, but provide methods in the relevant repository; e.g. in the supplier repository I’ll have IEnumerable<Supplier> GetSupplierByCustomerID(int customerID)

EDIT Changed above to IEnumerable based on suggestions.

Are these the two main approaches when using EF? Which is considered better, from your perspective.

Is there another approach I’m not considering?

  • 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-06-18T17:39:53+00:00Added an answer on June 18, 2026 at 5:39 pm

    In general I feel like putting a repository over EF is always a good idea. You get to abstract your database logic from your client-side logic (or even business logic). And the specific case that you’re mentioning you would be able to do one other nice benefit: You would only get the information that you want when you specifically call for it (like the GetSupplierByCustomerID example that you mentioned.

    Another approach you might consider is the one that I mentioned in the answer to this question: Bounded Contexts. The more separation of concerns that you have in your application, the better it will be in the long run for you and your fellow programmers (especially when you want to unit test it all).

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

Sidebar

Related Questions

I have such tables in my database like Customer , Member , Instructor ,
I have two tables in my database that look like that: Customer: C_ID city
I have a database, with a few tables. One of them is a customer
I have a database with these two tables: Customer and CustomerStatus . CustomerStatus is
I have ThirdParty entity and two derived entities: Supplier and Customer. I have another
I have a database full of customer data. It's so big that it's really
I'm fairly new to CI. I have a customer database which stores a bunch
I have a database with customer information, orders, etc. I need to run a
I have a database for tracking customer purchases over history. One of my forms
I have a simple database named customer with a single table data.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.