Re: n-tier best practices
From: Andrew Faust (afaust_at_aradymeDOTcom)
Date: 09/14/04
- Next message: Henk Verhoeven: "Re: Textbox updates in single-thread app"
- Previous message: Peter van der Goes: "Re: class design question"
- In reply to: rodchar: "Re: n-tier best practices"
- Next in thread: rodchar: "Re: n-tier best practices"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Sep 2004 11:22:33 -0600
You could have a function of your data class to retrieve the data
set.
"rodchar" <rodchar@discussions.microsoft.com> wrote in message
news:006E609B-539D-4E95-926C-373400529D6A@microsoft.com...
> If I create a business object how would I expose the dataset,
> like to use in
> a datagrid?
>
> "Andrew Faust" wrote:
>
>>
>> "rodchar" <rodchar@discussions.microsoft.com> wrote in message
>> news:B00106D8-5731-4AAD-944B-0AFABBBD38AB@microsoft.com...
>> > The dataset I'm referring to lives in the UI on Form1. What
>> > I'm
>> > wondering is
>> > if, let's say, you have form1 that shows a collection of
>> > parent
>> > records. You
>> > click on one and it takes you to form2 to show the details
>> > of
>> > that parent.
>> > Now, let's say from form2 you can open form3 to display the
>> > chidlren rows.
>> > And then, the user clicks on the collection to view the
>> > child
>> > details on
>> > form4.
>> >
>> > How would I persist the dataset, especially if you're going
>> > back and forth
>> > doing updates between form3 and form4?
>>
>>
>> > My idea, which I'm not sure is a good practice or not is to
>> > pass the
>> > dataset, which lives in form1, byRef between the 4 forms. Or
>> > is
>> > there a
>> > better way?
>>
>> Ok. That gives a bit better clarification. First thing you
>> will
>> usually want to do is to seperate the presentation layer
>> (forms)
>> from the data layer. Don't have the forms themselves doing the
>> data retrieval and updates. Instead create a class that
>> handles
>> all the data operations. Then you could be passing a reference
>> to
>> this class around to all the different forms. This way if you
>> make a change to the data class, then when you refresh your
>> view
>> on the other forms, the updates will appear, because they are
>> referencing the same object.
>>
>> If changes need to be made to your dataset that you are
>> passing
>> around, then I probably wouldn't pass just the plain dataset.
>> I
>> would pass a class which handles all data operations, then let
>> that class make any changes necessary. This way if you ever
>> need
>> to change some crucial pieces about how the data is stored or
>> handled, you can make the changes just in the one class,
>> rather
>> than in all classes that use it.
>>
>> If all these forms are not changing the data, but rather for
>> display only, then I would just go ahead and pass the data
>> set.
>>
>> Hope this helps,
>>
>> Andrew Faust
>>
>>
>>
- Next message: Henk Verhoeven: "Re: Textbox updates in single-thread app"
- Previous message: Peter van der Goes: "Re: class design question"
- In reply to: rodchar: "Re: n-tier best practices"
- Next in thread: rodchar: "Re: n-tier best practices"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|