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]
Saturday, February 04, 2006 8:43:00 PM (Central Standard Time, UTC-06:00)
Hi Dan,



For quite a while i read your blog and your comments on the borland newsgroups and i am of the opinion that you are one of the great DataSnap minds out there.



I want to get your opinion on the following:



This is our current setup, we are using DataSnap, we have multiple transactional data modules with ADO components (connection, queries, stored procs) on them, this transactional Data Modules are sitting off course on MTS and they are connecting to MSSQL Server 2000.



That has being our solution for a while, and it works. My question and this is a BIG question cause i'm always open to improve our current design in order to get better performance is, will you suggest dbExpress components to be used instead of the ADO ones? Notice the existance of the MTS and SQL Server 2000, will i get something better out of dbexpress?



We have Delphi 2006 and the way we design the system will allow us to quickly (kind off) move to dbExpress, BUT, we cant risk stability.



Thanks in advance.
Sunday, February 05, 2006 9:55:00 AM (Central Standard Time, UTC-06:00)
Dan, take a look at DataAbstract from RemObjects. They have a .NET version and allows you to write .NET servers to Win32 clients.
Sunday, February 05, 2006 2:43:00 PM (Central Standard Time, UTC-06:00)
Good point, Erik. I actually have checked this out, and it's rather nice. There are a few problems with how it fits in to my needs, though:

1. DA4.NET is .NET 2.0 only

2. If I use the RO SDK, I can get around that, but I lose the new stuff in DA4.

3. While older versions of RO SDK would probably get me to where I need to go, my primary objective has been to just rewrite the app servers without touching the clients. Shifting both client and app server form MIDAS to RO SDK would definitely require a major time sink.



I'm keeping up on what RO is coming out with, and will continue to check out how it might get used here in the future.
Monday, February 06, 2006 10:38:00 AM (Central Standard Time, UTC-06:00)
[Dan]"Speaking of which, ADO.NET wants you to create DDL statements for every table. There are countless posts and articles chastising the use of CommandBuilder"



Yet another reason amongst the dozens of othes to use stored procedures to perform insert/update operations.
Dave Nielsen
Monday, February 06, 2006 10:55:00 AM (Central Standard Time, UTC-06:00)
SPs would not make the task any easier. You would need to still hook up those SPs and parameterize them appropriately.



Besides, going the SP route means duplicating logic for every DBMS you support, so it's not the most cross-DB friendly approach.
Monday, February 06, 2006 12:59:00 PM (Central Standard Time, UTC-06:00)
Dan, this is just the MS way. Don't like having to write methods to remote a dataset? Shoot, without BDP you have to write a method just to display data in a grid.



Typo: I'm pretty sure that when you say "DDL" in the post you mean "DML."
Monday, February 06, 2006 2:04:00 PM (Central Standard Time, UTC-06:00)
Craig, yeah, I see that and it gets increasingly more frustrating. Check out the return types of GetSchemaTable for ODBC and OLEDB. They return different things (DbType vs. .NET framework type)! What in the world is going on with MS? It's almost like they don't think there are any other DBs other than MSSQL! Oh, wait. I think I get it now. :-)



Thanks for the typo alert. You're correct, and I updated the article.
Tuesday, February 14, 2006 2:56:00 PM (Central Standard Time, UTC-06:00)
Dan:

I believe you are wrong with point #1. Check out the document from MSDN called "Smart Client Architecture and Design Guide", specifically in Chapter 2, Merging Data with Datasets.



"Smart Client requests update from the Web service and the new data being returned as a data transfer object (DTO). A DTO is an enterprise pattern that allows you to package all the data requrired to communicate with a Web service into one object. Using a DTO often means that you can make a single call to a Web service rather thatn multiple calls."
Eric Eggers
Comments are closed.
Navigation
Archive
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
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 2010
Dan Miser
Sign In
Statistics
Total Posts: 339
This Year: 5
This Month: 0
This Week: 0
Comments: 618
All Content © 2010, Dan Miser
DasBlog theme 'Business' created by Christoph De Baene (delarou)