Concurrency management in XML Files

G

Guest

Hi,

I was wondering how it is possible to manage optimistic concurrency in XML
files.

Indeed, i store my data in xml files in an asp.net application.

My data access layers accepts custom entities, and then uses
dataset.WriteXml() to write the new data.
The problem is that this way of doing erases all file content, and writes
the content of the dataset.
If a user wrote his changes just before we write ours his changes are lost.

Is there a simple way to manage optimistic concurrency, like what we can do
with a DataAdpter with SQL databases?

Thanks a lot for your help


PS: I use .net v1.1 ;)
 
C

Cor Ligthert [MVP]

Kerd,

In my opinion is using XML datasets is very dangerous in an aspnet
application.

However if you use them in a static/shared class (C# it is called Static and
VBNet shared) than we tell it in the Dutch language like this: "It is
probably not impossible" (I never tried it). this has another meaning than
"it is possible". However be aware that it will give a lot of things to
check before you use it in producktion.

If you use a static/shared class than you access only on one place the
xmldataset for all your users because a static/shared class belongs in
ASPNET to all clients. It needs of course much more management than with a
normal database.

Be aware that it is a file in memory, therefore with any accident you lost
everything.

And never forget with a xml.dataset to check if the new one is completly
written before you delete the old one. (Renaming the old one in advance is
one method for that).

I hope this gives an idea, otherwise reply.

However repeating, it is in my opinion surely not the best and for sure it
is a dangerous way.

Cor
 
M

Mark Rae

I was wondering how it is possible to manage optimistic concurrency in XML
files.

Hmm - I'm pretty sure that if this isn't actually impossible, it's probably
far too difficult to even bother with...
Indeed, i store my data in xml files in an asp.net application.

That's a REALLY bad idea, and not at all what XML was designed for. I
suggest you store your data in a proper database - that's what they are
designed for...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top