Is it possible for you to upload some sample code of your "record
containers".
Actually, I was also looking for same kind of implementation to avoid
DataReader
& DataSet.
Thanks & Regards,
-Javed
________________________________________________________________________
Message: 1
Date: Sat, 25 Dec 2004 09:30:47 -0700
From: "Bob Grommes" <[EMAIL PROTECTED]>
Subject: Re: Architecture
Paul,
I don't know as I'd go so far as to call DataSets "the work of the
devil"
but I regard them as a general-purpose abstraction that is okay for
quick
and dirty work but not really optimal. On the other hand I regard
*typed*
DataSets as the work of the devil because I really don't think the
object
model is well thought out at all. There seems to be little effort at
making
things polymorphic, for example.
I like more of an ORM type of design where things come out of the DB and
get
cast to native types right away and stay that way until they are ready
to be
returned to the back end for updating by parameter objects.
I use something similar to your "value objects" -- I call them "record
containers" and the classes that define them are produced by a code
generator. All of them inherit from an AbstractRecordContainer class
that
manages a dirty flag, supports null as needed, has constructors that
will
create the whole from a DataReader or DataRow or another object of the
same
type, etc. A strongly typed collection is also generated at the same
time,
so that you have the option to create a typed collection of a particular
type of record container.
I have a business object and a data object corresponding to each record
container, and a "business view" that is a sort of mediator object that
manipuluates various record containers, record container collections and
associated business objects according to the needs of the application or
a
portion of an application. Lastly I have a DataLayerContext class that
defines an object that's passed to the constructors of all business
views
and business objects, and holds the connection object and manages
transactions. Usually there are just one of these context objects per
application. My code generator also generates most of the data object
class
and the basic insert/update/delete SPs for SQL Server.
The whole thing works fine in the lab, now I am feeling my way through
making it all work smoothly in the UI with data binding. Although I
*do*
consider WinForms data binding to be the work of the devil (it fails the
KISS principle miserably), my system will probably coexist with it as a
practical matter (I can retrofit different business and data tiers into
an
existing system with relative ease but it would usually be
cost-prohibitive
to change to my own data binding mechanism.). As for ASP.NET, I'm still
exploring. I would be most interested to know how your value objects
work
with data binding (especially complex data binding, and particularly to
datagrids).
--Bob
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/CSharpNET/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
