Re: Of Java and C#
- From: "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 13:01:36 +1300
"LX-i" <lxi0007@xxxxxxxxxxxx> wrote in message
news:d182b$45bea73f$454920f8$8426@xxxxxxxxxxxxxx
andrewmcdonagh wrote:
Doh...oh yes re-reading your post I see that now... Saw the talk about
Java and missed the c# connection to the class.
Not to worry though...whilst I don't know the full c# library yet I do
know OO and c#'s approaches so if you want....
Well, I forgot to e-mail the source to myself... :( But in the mean
time, I have a question for you seasoned OO folks...
Say, for example, that there is a library application where there is a
"book" object with a method of checkMeOut(), that takes a patron object,
and modifies it to indicate that it is now checked out by the given
patron.
Assuming that this is a persistent application, at what point is the
information stored off? Does checkMeOut() do the work of updating the
database *and* updating the object in memory, or should there be a
separate commitChanges() method that would update a data store with the
information contained in the current instance of that object?
The modern approach to this is to use a data adapter and a Dataset that are
"disconnected" (updated offline). The DB Connection is used to run the
query, then dropped. Subsequent processing is against the Dataset
(previously a "result set"). Changes to the dataset can be committed any
time you want, and the connection is re-established automatically.
Synchronization and detection of changes that may have occurred while you
were offline, are all handled by the data adapter, which provides methods
and properties to let you do whatever you want. Here's a link that may help:
http://www.codersource.net/csharp_adonet_tutorial_ed.html
See also the C# "Dataset.AcceptChanges()" method and the
"DataAdapter.Update()" methods. This is very powerful stuff and I am still
getting my head round it. :-) Fortunately, it works as documented...
Your checkMeOut() method could update the Dataset and/or commit the changes,
depending on what you want/need.
(Personally, I'd put the DB stuff into another Class/Method and invoke it
from checkMeOut())
Pete.
.
- References:
- [OT] Of Java and C#
- From: LX-i
- Re: Of Java and C#
- From: andrewmcdonagh
- Re: Of Java and C#
- From: LX-i
- Re: Of Java and C#
- From: andrewmcdonagh
- Re: Of Java and C#
- From: LX-i
- [OT] Of Java and C#
- Prev by Date: [OT] Tall poppy syndrome WAS:Re: [OT] Of Java and C#
- Next by Date: Re: IBM Mainframe - Batch Job to Generate Data Set List?
- Previous by thread: Re: Of Java and C#
- Next by thread: Re: [OT] Of Java and C#
- Index(es):
Relevant Pages
|