Thoughts from Dan Miser RSS 2.0
 Friday, February 03, 2006
I keep expecting ADO.NET to work as well as Delphi 1 did 10 years ago with respect to data access, and as a result, my expectations keep getting dashed. Of course, some things (like MIDAS) only materialized in Delphi 3, so that's a scant 8 years ago. :-( It seems that all of the collective wisdom in the .NET world to remote data (via .NET Remoting or Web Services) consists of one of 3 approaches, with zero tolerance for deviation.

  1. The DataSet approach.Use 2 methods for each entity that you want to remote. For example, you find numerous posts in google and references on MSDN where you need to call myAppServer.GetCustomer() to get a DataSet and then call myAppServer.UpdateCustomer(DataSet ds) to update the customer. Repeat this over and over and over again for each entity.
  2. The built-in serialization approach. Failing #1 above, people then start to tell you to create true business objects. You just need to take all of the tables that you use, create a bunch of objects, map the objects to the DB, and you're off and running. You can also use frameworks like Rocky Lhotka's CSLA.
  3. The ORM approach. ObjectSpaces has died, but that doesn't mean ORM is dead. There are a variety of options here. To name a couple that range from free to commercial, and vary in features: NHibernate, which is an open-source port of the Java persistence framework, Hibernate; and LLBlGen Pro. Of course, this means you need to buy into the framework you use.

However, what I really wanted was a way to remote data, and not worry about the more OO-centric techniques at this point. As a result, I wrote a framework, DrTier, to do just that. I now have it working the way I want in .NET. DataSets are streamed between client and server, user code is minimal, the app servers are extensible, and I'm able to take advantage of the best things that .NET has to offer. However, ADO.NET is not among them.

For example, if you have a stateless server, you cannot guarantee the SQL statement that was used to Fill the DataSet will be the same when you get back to the app server to update the data. I ended up using the DataSet.ExtendedProperties property to cache the SQL select statement and pass it around between client and server. By doing this, I can guarantee that I'm building the appropriate INSERT/UPDATE/DELETE SQL statements (DML) when I need to update the DataSet.

Speaking of which, ADO.NET wants you to create DML statements for every table. There are countless posts and articles chastising the use of CommandBuilder (poor performance, unoptimized for MSSQL, etc.). Creating your own DML statements at run-time is no picnic, even after we've solved the above problem. If you get schema information based on your SELECT statement, you will see that the types for each field are provider-specific. That means that you would need to have some kind of mapping between provider-specific types and DbType, or find another solution to parameterize your queries (dynamic type instantiation based on the string types returned in GetSchemaTable comes to mind as one possibility).

Another good lesson learned is that when using the Data Access Block, I have found that I can't take advantage of most of the methods in that block because they aren't customizable at all. You want a DataSet loaded with schema information? Good luck. Now you're using Database.DbProviderFactory to create concrete classes like you do in straight ADO.NET. The helper methods lack extensibility, so you're forced into this pattern. Returning fully formed DbCommands that point to a shared DbConnection isn't really even supported. You need to do that manually, too.

I won't go in-depth on the other features I found lacking (unlike Delphi), like ProviderFlags, UpdateMode, TFields, extensive events during reconciliation, robust error resolving support, etc., etc., etc. It seems that ADO.NET forces you into a pattern, and if you want to deviate from that pattern, you better be prepared to work.

Yes, I have an ulterior motive. I want my app servers written in .NET, and I want them to behave like MIDAS app servers so that I can call them from existing Delphi Win32 clients. Next up, I will need to write the interop code to get things working between MIDAS and DrTier. Once all of that is done, we can get our feet wet in .NET without resorting to a complete and total rewrite on both the client and server. So far, so good, but the finish line is a long way off, and I'm afraid ADO.NET will fight me every step of the way.

Friday, February 03, 2006 5:12:00 PM (Central Standard Time, UTC-06:00)  #    Comments [8] -
Delphi
Tracked by:
http://9nd-information.info/74245956/index.html [Pingback]
http://9np-information.info/43172697/index.html [Pingback]
http://9nt-information.info/67227196/index.html [Pingback]
http://9nx-information.info/71486603/index.html [Pingback]
http://9ne-information.info/39130761/index.html [Pingback]
http://9nk-information.info/62297906/index.html [Pingback]
http://9nl-information.info/11028342/index.html [Pingback]
http://9nu-information.info/36140732/index.html [Pingback]
http://9nx-information.info/71486603/horse-jobs-california.html [Pingback]
http://9nr-information.info/42350850/wolvrine-boots-home.html [Pingback]
http://9nw-information.info/39515352/index.html [Pingback]
http://9nw-information.info/96573940/index.html [Pingback]
http://9ne-information.info/85427995/survey-equipment-rental-gta.html [Pingback]
http://9nw-information.info/36656865/index.html [Pingback]
http://9qe-information.info/06996654/flashgame-line-ride.html [Pingback]
http://9qs-information.info/91028566/index.html [Pingback]
http://9on-information.info/99605449/anthony-bourdain-recipes.html [Pingback]
http://9oj-information.info/85507321/smart-wire-software.html [Pingback]
http://9om-information.info/14420422/index.html [Pingback]
http://9qm-information.info/65097929/orchestra-live-sagra.html [Pingback]
http://9qi-information.info/57464798/index.html [Pingback]
http://9om-information.info/70688871/index.html [Pingback]
http://9st-information.info/60172244/index.html [Pingback]
http://9st-information.info/74943558/deficit-ferro.html [Pingback]
http://9rq-information.info/53205723/fogranger-lights.html [Pingback]
http://9rf-information.info/22392487/index.html [Pingback]
http://9ry-information.info/13514290/index.html [Pingback]
http://9re-information.info/79435121/glass-for-furniture.html [Pingback]
http://9rl-information.info/97037118/index.html [Pingback]
http://9sh-information.info/13966261/index.html [Pingback]
http://9sg-information.info/22701847/index.html [Pingback]
http://9rd-information.info/46373003/index.html [Pingback]
http://9uafg-le-informazioni.info/34887296/index.html [Pingback]
http://9uaea-le-informazioni.info/45505675/index.html [Pingback]
http://9uafi-le-informazioni.info/95152351/definizione-procacciatore-assicurativ... [Pingback]
http://9uafh-le-informazioni.info/43569879/pizza-franchise.html [Pingback]
http://9uaen-le-informazioni.info/17376023/index.html [Pingback]
http://9uaed-le-informazioni.info/02085548/index.html [Pingback]
http://9uafa-le-informazioni.info/14957568/index.html [Pingback]
http://9uaej-le-informazioni.info/32606090/laringectomia.html [Pingback]
http://9uagk-le-informazioni.info/93276815/index.html [Pingback]
http://9uags-le-informazioni.info/61121066/index.html [Pingback]
http://9uaga-le-informazioni.info/09790753/index.html [Pingback]
http://9uahf-le-informazioni.info/88523822/download-zip-genius.html [Pingback]
http://9uahk-le-informazioni.info/29715598/angels-devils-it.html [Pingback]
http://9uaht-le-informazioni.info/99643679/svezzamento-frequenza-poppate-latte-a... [Pingback]
http://9uagk-le-informazioni.info/02351222/computer-and-internet.html [Pingback]
http://9uahq-le-informazioni.info/21113014/index.html [Pingback]
http://9uagi-le-informazioni.info/87830632/index.html [Pingback]
http://9uahj-le-informazioni.info/44722711/index.html [Pingback]
Navigation
Archive
<July 2008>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Dan Miser
Sign In
Statistics
Total Posts: 306
This Year: 21
This Month: 0
This Week: 0
Comments: 603
All Content © 2008, Dan Miser
DasBlog theme 'Business' created by Christoph De Baene (delarou)