Re: DataSet and serialization is dangerous

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: ABad (anonymous_at_discussions.microsoft.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 08:42:47 -0500

In other words change you client side logic From:
     - Delete Father1 from Father Table
     - Add Father1 to Father Table
     - Add Child1 to Child Table with relationship to Father1 in Father
Table

To:
     - Delete Father1 from Father Table
     - Undo Father1 delete or rollback
     - Add Child1 to Child Table with relationship to Father1 in Father
Table

"ABad" <anonymous@discussions.microsoft.com> wrote in message
news:%23UH$$2rCFHA.1836@tk2msftngp13.phx.gbl...
> I don't think you are getting what I'm trying to show you. Take a step
back
> and look at what your example is doing at the *client only* for second.
>
> Original state:
> - Father1 in Father Table
>
> Changes done by your example:
> - Delete Father1 from Father Table
> - Add Father1 to Father Table
> - Add Child1 to Child Table with relationship to Father1 in Father
Table
>
> The client side XML changes that are being sent to the server are:
> Before Snapshot:
> - Father1 in Father Table
> Proposed Changes
> - Insert Father1 to Father Table
> - Add Child1 to Child Table with relationship to Father1 in Father
> Table
>
> Do you see the problem in the client side XML changes that you sending to
> the server? Look closely. You are telling the server that Father1 already
> exists but *insert* another Father1 with a new Child1. The server doesn't
do
> the proposed changes of insert Father1 and Child1 because there is a
unique
> constraint on the Father table, and you are telling it to insert a
duplicate
> record. The result is the server only shows the Before Snapshot. My
example
> where the events are attached show this is exactly what is happening.
>
> If you look at the XML changes from my final example you will see:
> Before Snapshot:
> - Father1 in Father Table
> Proposed Changes
> - Modified Father1 to Father Table
> - Add Child1 to Child Table with relationship to Father1 in Father
> Table
>
> Do you see the difference? These XML changes do not try to insert another
> Father1 record but modifies it. This is why my example works and this is
> what your final XML changes should have when sent to the server.
>
> - ABad
>
>
>
> "Mauricio Pires" <MauricioPires@discussions.microsoft.com> wrote in
message
> news:5CB5B45B-68F5-40D7-9F77-F3613418EB70@microsoft.com...
> > Hi ABad,
> > Excuse me, but I think your code doesn't actually represent the remoting
> > process (or am I wrong?).
> > I did some changes in your code (sub Main() only) that I think be more
> > similar to remoting process. The child row vanished.
> > Thanks.
> >
> > Sub Main()
> > 'dsOriginal is the server copy
> > Dim dsOriginal As DataSet = CreateOriginalDataset()
> >
> > 'dsWorking is the client copy
> > 'starts off with original copy
> > Dim dsWorking As DataSet = dsOriginal.Copy
> > 'client copy is modified
> > WorkWithDataset(dsWorking)
> >
> > 'get changes to send to the server<===
> > Dim dsChanges As DataSet = dsWorking.GetChanges
> >
> > 'persist out the changes (remoting process) <===
> > dsChanges.WriteXml("myFileName.xml", XmlWriteMode.DiffGram)
> >
> > 'read back in the changes (remoting processs) <===
> > Dim dsRead As New DataSet
> > CreateSchema(dsRead)
> > dsRead.ReadXml("myFileName.xml", XmlReadMode.DiffGram)
> >
> > 'merge client side changes to the server copy
> > dsOriginal.Merge(dsRead.GetChanges)
> > dsOriginal.AcceptChanges()
> >
> > Console.WriteLine("")
> > Console.WriteLine("****
> > ORIGINAL*****************************************************")
> > Console.WriteLine("")
> > dsOriginal.WriteXml(Console.Out)
> >
> > Console.WriteLine("")
> > Console.WriteLine("**** WORKING
> > *****************************************************")
> > Console.WriteLine("")
> > dsWorking.WriteXml(Console.Out)
> > Console.ReadLine()
> > End Sub
> >
> >
>
>



Relevant Pages

  • Re: DataSet and serialization is dangerous
    ... The dataset deserialization is based on XML. ... perl client, etc. ... Your server can only depend on the ... The client could have deleted/added Father1 a 100 ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DataSet and serialization is dangerous
    ... Imagine a server giving the dataset to a client application. ... Sub CreateSchema ... These XML changes do not try to insert another ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DataSet and serialization is dangerous
    ... and look at what your example is doing at the *client only* for second. ... - Delete Father1 from Father Table ... The client side XML changes that are being sent to the server are: ... Do you see the problem in the client side XML changes that you sending to ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)