Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# - Add and Update Records
Message
From
09/04/2008 10:53:50
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
09/04/2008 10:44:45
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01309187
Message ID:
01309352
Views:
17
Hi Bonnie,

>
>>Doesn't the chain of responsibility sort of take care of itself with regards to the Form knowing if the record is a new or an edit? The form in his case is instantiated with a -1 for the PK, then it needs to call a method on the Biz Obj that passes back data with any default values included first in the new row. Like you said, the biz obj can take care of everything, but the form is going to know because it is in the chain of responsibility.
>
>If the Form *needs* to know, yes it would know because it *does* receive the key. However, you're most likely calling the same Biz method regardless of the value of the key and the Biz method determines whether to retrieve data from the database or send you a new dataset with defaults. So, the form really doesn't care.
>
Very true

>Now, that said, we use Web Services, so our process *is* slightly different. As I mentioned before, if you know you're adding new data, why bother hitting the database. When I mentioned that before, it was in relation to the Form directly calling a biz method (not going through a Web Service method) and the biz method decides whether to hit the database or not. Well the same applies when using a Web Service, however in this case, you don't want to "pass the buck" on to the biz method through the Web Service if you're not even going to be hitting the database.

I guess the circumstances do dictate wether or not to even call the biz obj or not. I would suspect if you are using any type of typed Entity objects you need to call the biz obj and if you are using typed datasets you need to as in either case you are probably binding to them in the form. Thus it would I think be necessary to get them returned from the biz obj. If it is a new record and you are not binding this way, then yeah, why bother.
>
>In this scenario, the Form *does* check to see if the key is -1 (or 0, or whatever you're using to determine this). If not, it calls the Web Service method. If so, then we call a client-side biz method. Most of our biz classes are strictly server-side, because they use DataAccess classes and methods. But we also have what we call client-side Biz classes that live in either layer (client or server), but contain no DataAccess at all.

Good points about the web service; I am just getting ready to do this myself and will be posting about this shortly.
>

Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform