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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:48:46+00:00 2026-05-10T17:48:46+00:00

The project I’m working is using n-tier architecture. Our layers are as follows: Data

  • 0

The project I’m working is using n-tier architecture. Our layers are as follows:

  • Data Access
  • Business Logic
  • Business Entities
  • Presentation

The Business Logic calls down into the data access layer, and the Presentation layer calls down into the Business Logic layer, and the Business entities are referenced by all of them.

Our business entities essentially match our data model 1-1. For every table, we have a class. Initially when the framework was designed, there was no consideration for managing master-detail or child-parent relationships. So all of the Business logic, data access, and business entities, only referenced a single table in the database. Once we started developing the application it quickly became apparent that not having these relationships in our object model was severely hurting us.

All of your layers (including the database) are all generated from an in-house metadata-database which we use to drive our home-grown code generator.

The question is what is the best way to load or lazy load the relationships in our entities. For instance Let’s say we have a person class that has a master-child relationship to an address table. This shows up in the business entity as a collection property of Addresses on the Person object. If we have a one-to-one relationship then this would show up as a single entity property. What is the best approach for filling and saving the relationship objects? Our Business entities have no knowledge of the Business Logic layer, so it can’t be done internally when the property get’s called.

I’m sure there is some sort of standard patter out there for doing this. Any suggestions?

Also, one caveat is that the DataAcess layer uses reflection to build our entities. The stored procedures return one result selt based on one table, and using reflection we populate our business object by matching the names of the properties with the names of the columns. So doing joins would be difficult.

  • 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. 2026-05-10T17:48:46+00:00Added an answer on May 10, 2026 at 5:48 pm

    I highly recommend looking at Fowler’s Patterns of Enterprise Architecture book. There are a few different approaches to solving this sort of problem that he outlines nicely, including entity relationships.

    One of the more compelling items would be the Unit Of Work pattern, which is basically a collector, that observes the actions performed on your entities, and once your done with your action, it batches the appropriate database calls, and makes the request to the database. This pattern is one of the central concepts used by NHibernate, which uses an object which implements IDisposable to signal the end of the ‘work’. This allows you to wrap your actions in a using, and have the unit of work deal with the actions for you.

    Edit: Additional Information

    This is a link to the basic class structure of the Unit of Work…not really the most exciting thing in the world. Fowler provides more details in his book, some of which you can see here. You can also look at the Session object from NHibernate as a possible implementation ( I was able to track down the ISession interface…not sure where the implementation lives)

    Hope this helps.

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

Sidebar

Related Questions

Project Scenario Technology : Dotnetnuke (Approx. 100 - 150 screens) Data Architecture : LINQ
A project I'm working on at the moment involves refactoring a C# Com Object
My project is currently using a svn repository which gains several hundred new revisions
Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on
The project I'm working on allows an end-user to modify CSS code to integrate
I project I have been working on has now been split between me and
A project I have been working on for the past year writes out log
I'm working on a project in C# w/ XNA, and I want to reorganize
Project Darkstar was the topic of the monthly JavaSIG meeting down at the Google
Every project invariably needs some type of reporting functionality. From a foreach loop in

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.