[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

Retrieving Data with One to Many Relationships in N-Tier architecture

Asked by Jayrw in .NET, MS SQL Server, Microsoft Visual Basic.Net

Tags: N-Tier, Object-Oriented, SQL Server, Stored Procedure, VB.NET

Hello, I'm trying to figure out best practices for retrieving data with one-to-many relationships in an N-tier architecture.  I'm using VB.NET in a Web application (both are relatively new to me).  Everything looks clean if I just use customer, but I have customer_address (multiple records per customerID), customer_schoolhist (multiple records per customerID), and several other tables with one-to-many relationships with customer.

As an example, if I want to retrieve "Full" customer profiles for customers within a certain radius of a particular zip code, I've come up with several options:
1)  Create a stored proc for each table.  Have BOL and DAL object for each table.  Seems to be very bad from a performance perspective - essentially, I would have to take several trips up and down through the layers to get my data.
2)  Create one stored proc which returns all combinations of the one-to-many relationships in one result set.  One trip down to the data level, one query, a ton of repeated data.  Within my DAL, parse through the result set and populate my business objects accordingly (for example, if there are 2 addresses and 3 schoolhist records for a customer, there will be 6 records in the resultset but my DAL code will resolve it into one customer record with 2 addresses and 3 schoolhists.
3)  Create one stored proc which returns several result sets (one for customer, one for customer_school, one for customer_address, etc.).  One trip down to the data level, several queries, no "extra" info returned.  But then I think I'd lose the OO-ness, or would have to match up ID's in order to create the true parent-child relationships at the business object level.

...and I'm sure there are other options.  This is actually a fairly simple website, and I'll be doing the maintenance myself, so I'd like a solution which a newbie like me can easily understand and maintain.  After I finished writing this, I'm leaning even more strongly toward option 2, since it seems to strike a balance between decent performance and adhering to OO and N-tier principles.  But let me know if anyone has thoughts/comments/suggestions.
[+][-]04/22/09 12:24 PM, ID: 24208574Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/22/09 12:28 PM, ID: 24208605Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: .NET, MS SQL Server, Microsoft Visual Basic.Net
Tags: N-Tier, Object-Oriented, SQL Server, Stored Procedure, VB.NET
Sign Up Now!
Solution Provided By: TheVeee
Participating Experts: 2
Solution Grade: B
 
[+][-]04/22/09 03:47 PM, ID: 24210442Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/22/09 04:18 PM, ID: 24210596Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04/22/09 04:21 PM, ID: 24210608Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/09 05:04 AM, ID: 24214042Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/23/09 05:55 AM, ID: 24214422Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/23/09 07:56 AM, ID: 24215807Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/13/09 07:40 PM, ID: 24381405Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/14/09 04:44 AM, ID: 24383754Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/14/09 07:49 AM, ID: 24385591Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/14/09 09:36 AM, ID: 24386746Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/14/09 09:40 AM, ID: 24386772Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625