Re: Remoting and DataSets
- From: "msgroup" <nospam@xxxxxxxxx>
- Date: Mon, 26 Feb 2007 11:06:16 -0500
Hi, James:
Let me give you inputs about my concerns. See my inline comments.
"James Crosswell" <james@xxxxxxxxxxxxxx> wrote in message
news:%23Y7naj4VHHA.5068@xxxxxxxxxxxxxxxxxxxxxxx
I've put together a basic server and client in remoting. In order to pass
data around I presumed you'd use the detached objects like DataSet,
DataTable and DataRow so I figured I'd define a DataSet class in an
assembly that was shared by the client/server (along with the interfaces
for the server) and then add a couple of methods:
Fill(ref DataSet aDataSet, string aTableName);
UpdateData(DataSet aDataSet);
Overall, I don't recommend you to remote dataset or datatable across
across machines. It is a wrong approach unless you are sure that your server
just supports a limited number of clients on LAN only.
The idea being that these would be generic methods allowing the client to
pass a DataSet object to the server to have one of it's tables filled or
to send updates back to the server.
It seems like there's actually a fair amount of work involved in order to
write the generic UpdateData method though - I have to build up a
DataAdapter, set the TableMappings and the FieldMappings and finally build
the Update, Insert and Delete statements (all of which I was just going to
generate automatically - for example, to do an update I'd do "Update [All
fields except the PK] WHERE PK = [Original PK]" - in my case if I want to
do anything fancy then I'll typically do it in the triggers for the
table/view that I'm updating in the actual databases themselves, so no
need to do anything but plain jane default stuff in the
insert/update/delete statements in the .NET remoting server).
If I were you, I will use parameterized statements for insert, update and
delete. Suppose that you need to update a set of records, I will use
something following:
Update Table MyTableName Set AColum = ?, MySecondColumn = ? Where
SomeKeyColumn = ?.
Use this way is perferred for better generics and speed. Note that ADO.NET
doesn't have so good generic data accessing support as OLEDB. You may be
forced to use OLEDB .NET provider. You can also see our sample at
http://www.udaparts.com/document/articles/asyniis.htm. Inside the sample,
you will find a simple to show you how to use parameterized statements for
these purpose. That sample supports all of data sources (Access, MS SQL,
Oracle, DB2, mySQL, ......) through OLEDB technology.
Then I got to thinking, this is ridiculous - surely someone has bumped
into this problem before me so I went scouring the internet for all and
any posts I could find relating to remoting and datasets. Remarkably I
came back with very little and certainly nothing that discussed sending
updates back to the server or handling these.
I did find the odd post from folks that suggested DataSets + Remoting was
a bad idea, with various others fervently replying that they agreed, but
they didn't go into any details as to why this might be the case. Perhaps
it was for performance reasons in which case maybe simply serializing the
datasets in binary format rather than XML would help or using something
like GenuineChannels might do the trick.
GenuineChannels solves a set of problems that MS .NET remoting should not
have. MS remoting implementation is really BAD from my view, although it has
a good archtecture. However, I do NOT think that GenuineChannels is able to
help your application performance at all.
So, a couple of questions:
1. Is there anything I should know about why using DataSets + Remoting
might be a bad idea?
It depends on how many clients and network types. It may work very well with
a few clients + LAN networks.
2. Presuming it's not such a bad idea as all that (it seems like the docs
for .NET encourage using these in remoting situations at least) does
anyone know of examples or tutorials or even just passing
conversations/blogs anywhere that discuss more specifically sending
DataSet updates back to a remoting server and handling these?
Actually, it is bad idea. You can't assume it is a good idea.
Any help appreciated.
Best Regards,
James Crosswell
Microforge.net LLC
http://www.microforge.net
.
- Follow-Ups:
- Re: Remoting and DataSets
- From: James Crosswell
- Re: Remoting and DataSets
- References:
- Remoting and DataSets
- From: James Crosswell
- Remoting and DataSets
- Prev by Date: Re: Help on proper method ????
- Next by Date: Re: Tools for Implementing Remoting
- Previous by thread: Re: Remoting and DataSets
- Next by thread: Re: Remoting and DataSets
- Index(es):
Relevant Pages
|