[quoted text, click to view] Spam Catcher wrote:
> Is there a reason you like to do this? ADO.NET can be used to update a
> remote database.
Like via a direct connection to the database you mean? If so then that
would be the reason I want to do it via a middle tier - there's no way
I'm opening a port on the internet to my DB Server and besides, running
queries directly against the database will quickly get inefficient in a
distributed application (sometimes all I need to pass to the middle tier
is a little packet of data which the server deals with by issuing 10-15
serparate queries... if I ran those directly against the SQL Server over
the WAN then the same operation would take about 20-30 times as long).
[quoted text, click to view] >> 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
>
> Absolutely, writing such a layer is not trival... You're better off
> using an ORM mapper for this type of work - like LLBLGen Pro. LLBLGen
> Pro has a dynamic SQL engine which you can leverage for this type of
> stuff. Other popular ORM mappers include Codesmith and NHibernate.
Yeah I've been looking at one (which I already own by default, becuase
of a subscription I have) called XPO (Xpress Persistent Objects). So far
I haven't had much luck with it - in a local app the framework is great
but I can't seem to persuade any objects I derive from their base class
to serialize.
[quoted text, click to view] > You'll also have to build a robust security layer since you're exposing
> the entire database.
Indeed - I had planned on the security layer anyway.
[quoted text, click to view] >> 1. Is there anything I should know about why using DataSets + Remoting
>> might be a bad idea?
>
> Datasets and remoting are not inherently bad - but they should be used
> in moderation. Sending too much data across the wire (in your case
> entire tables) could quickly swamp network resources.
I hadn't actually planned on sending entire tables - the DataSet in my
case will include DataTables but these DataTables won't include ALL of
the information in the underlying database table... in the GetDataSet
method for my remoting service I was going to pass in various
criteria/filters so that this would return only pages of data (ala
google search results).
[quoted text, click to view] > Also, since datasets are disconnected, you'll have to reconcile changes
> - so perhaps it's best sending as little data as possible to client.
Agreed - I see the DataSet has a GetChanges method for this purpose
which I can use to send the Delta back to the server.
[quoted text, click to view] > If you want to send table dumps across the network, there are better
> protocols out there. Perhaps dump the raw CSV, or the database's native
> features like Bulk Updates, DTS or SQL Server Integration Server.
As I say, I have no interest in sending a dump of an entire database
table - the DataSet just seemed an appropraite container for the limited
result sets that I wanted to pass back since it took care of stuff like
marking records as Inserted/Deleted/Updated, generating Deltas and just
generally being a data centric class that I could easily map all my DB
records to whilst maintaining compile time type checking.
[quoted text, click to view] > Also from a SOA/tier design perspective, clients who use your generic
> database server will need to have intimate knowledge of the DB schema.
That's OK - I'm not building this app for other people to consume - only
inhouse clients. Remoting was simply going to be communication channel
between the various processes involved in the solution.
[quoted text, click to view] > In that case, why not connect directly to the database with enterprise
> manager or ADO.NET - you're sort of reinventing the wheel?
Surely I don't have to describe the benefits of using a middle tier in
the remoting newsgroup? I'm familiar with distributed application
architectures and programming in general.
[quoted text, click to view] > exposing database tables to end users (developers?) who may not know the
> database well, you should expose specific function calls like in a web
> service. For example: ListUser, AddUser, DeleteUser, SaveUser, etc.
That would be one approach but, as I say, this service isn't being built
to be consumed by the public at large and the building of specific
methods like that would just slow down development and testing.
Internally all those methods would use a generic/refactored internal
method anyway so why not just promote that generic method to the service
interface?
I have written distributed applications (in other frameworks) using both
of the approaches (one set of methods per object type and then just one
set of generic getdata/updatedata methods) and the later is by far
superior. Now I'm just trying to work out how this can be done in remoting.
[quoted text, click to view] > Sending datasets is nothing magical in remoting ... but I think where
> you're having trouble is in your generic data layer? The problem you
> seem to be having is how to build the generic connectors required to
> access a table in a generic fashion? If that's the case - that is more
> of which how to implement your data access layer than a remoting
> problem?
>
> Remoting datasets should serialize fine ... so you should be able to get
> the dataset as an object on both sides of the connection.
Exactly - I can send back a particular datatable and update this using a
method that makes use of a proprietary DataAdapter (code generated by
the DataSet wizard) for this particular table but that's not what I
want. I want a generic DataAdapter that will allow me to update any of
the tables that is defined in the dataset.
I can do this very easily using the remoting framework that I have been
using to date (RemObjects and DataAbstract) so I was kind of surprised
that something which people have to do so commonly in distributed
applications (retrieve and update data) seems to be so inordinately
difficult using Microsoft's remoting framework.
Best Regards,
James Crosswell
Microforge.net LLC