Retrieving child data in DAL or BLL



hi all,

If i have a table in my database, and that table contains foreign keys
to other tables, should i extract the data from the other tables at the
same time, or should my business layer call the separate DAL retrieve
methods for each child object?

if i take the example of a company and contact, my contact table
contains a foreign key pointing to the company table.

Now if i want to retrieve the details of the company at the same time
as retrieving the details of the contact, should the DAL call the
CompanyDataService and retrieve that companies details?

Or do i just return the Contact data to the business layer and then my
business layer would call the CompanyDataService to obtain the data for
the company??

If anyone could write a very very short example, to help me understand
i would really appreciate it. Ta

Dave Sexton


You've started 3 related threads in this newsgroup over the past 2 days and I responded to the last two but haven't yet received a
reply. If you have any concerns with my answers to your questions then post a reply and I'll try to address them. Also, you might
want to keep all of these posts on a single thread since they are very closely related. People will read each reply in a single
thread and I'm sure they'll be happy to respond with their thoughts on the matter. By keeping the posts together it will help to
make your questions clearer since previous posts will provide a background for newer ones.

That said, I believe I addressed these questions already in your last thread. If you have any questions about my answers, reply to
me in your last thread.
If anyone could write a very very short example, to help me understand
i would really appreciate it. Ta

I found the following article on MSDN. It seems to address some of your questions with explanations and examples. However, the
examples in the article return a DataTable through the BL and my recommendation is to encapsulate the data in the BL wherever
possible and to create business objects to represent logical entities. Binding was somewhat difficult in VS.NET 2003 without access
to the underlying data structures, however in VS.NET 2005 this is no longer an issues because the designer now supports binding
directly to objects. For this reason the article is a bit out-dated, but it may help.

Building an N-Tier application in .NET (MSDN):



Dave, i am sorry just had so many tings going on, didnt think, thanks
for the answer though, i will read it now

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question