Re: DataSet and serialization is dangerous
From: ABad (anonymous_at_discussions.microsoft.com)
Date: 02/04/05
- Next message: Sahil Malik: "Re: Migrating bulk data from one database to another having table schema"
- Previous message: ABad: "Re: DataSet and serialization is dangerous"
- In reply to: ABad: "Re: DataSet and serialization is dangerous"
- Next in thread: Mauricio Pires: "Re: DataSet and serialization is dangerous"
- Reply: Mauricio Pires: "Re: DataSet and serialization is dangerous"
- Reply: Mauricio Pires: "Re: DataSet and serialization is dangerous"
- Messages sorted by: [ date ] [ thread ]
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
> >
> >
>
>
- Next message: Sahil Malik: "Re: Migrating bulk data from one database to another having table schema"
- Previous message: ABad: "Re: DataSet and serialization is dangerous"
- In reply to: ABad: "Re: DataSet and serialization is dangerous"
- Next in thread: Mauricio Pires: "Re: DataSet and serialization is dangerous"
- Reply: Mauricio Pires: "Re: DataSet and serialization is dangerous"
- Reply: Mauricio Pires: "Re: DataSet and serialization is dangerous"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|