Hi all, I am working on designing a solution that will have an asp.net front
end and sql back-end. Due to the constantly evolving nature of the
application, I will be using vb.net classes and objects to represent data
and pass them back and forth between tiers. This is all great except when it
comes to storing the data in the sql db. I am currently weighing the pros
and cons between (i) actually setting up tables and columns to store the
fields in the objects OR to (ii) serialize the objects and store them as
binary data. Option 2 gives me good flexibility when schemas change. I can
just update the objects through inheritance and dont have to worry about db
schema changes. Conversely, Option 1 makes my reporting capabilities easier.
i.e. I can directly pull columns from tables instead of converting binary
data to a .net class and then reading the properties. Also probably Option 1
will have better performance than Option 2. Does anyone have any
recommendations or can they offer some insight into these 2 methods for
persisting data in the db?
TIA!
richlm - 18 Apr 2005 22:24 GMT
There's a 3rd option - code generation.
I have worked on an in-house utility to generate data entities and data
access code directly from the database schema, based on XSLT templates. It's
also possible to go the other way i.e. generate your database schema from
'metadata' in your code (although I think that has limitations when
considering changes to the schema - OK for creating new empty databases).
There are a number of 3rd party and share/freeware tools around -
"Codesmith" has been around for a while, and I have heard good reports about
"LLBLGEN".
param@community.nospam - 19 Apr 2005 01:52 GMT
That is an option too. I am trying to go with the best possible combination
of simplicity, performance, scalability and one that has the lowest overhead
in terms of upgrading and maintanence.
thanks
> There's a 3rd option - code generation.
>
[quoted text clipped - 7 lines]
> "Codesmith" has been around for a while, and I have heard good reports
> about "LLBLGEN".
[MSFT] - 19 Apr 2005 03:49 GMT
I will choose (i) for compatibility. These data in database will be easily
re-used and better understand by other applications. I prefer serialization
when pass object between layers. To save it in database, I think (i) should
be a better solution.
Luke
Eric Giles - 21 Apr 2005 03:48 GMT
There are so many times when having specific data in specific fields within
the DB is advantageous. Consider joining across tables...
Also, relational DBs really are designed (up until now) to house data held
within specific fields. There are many functions available to you and
performance optimisations that you will only benefit from if you break your
object apart and handle it's loading/unloading to db.
With the onset of SQL 2005 however, there may be lots of reasons to store
this stuff within an XML field. XQuery will means that you can efficiently
get to the stuff contained within your XML structures and use the specific
elements/attributes etc. to join across other DB tables. There is still going
to be processing overhead to do it this way however it will be reduced and
better integrated into the DB software. Certainly, the decision has to be
based on how much more convenient it would be to store the data in XML and
avoid changes to the DB schema Vs difficulty and performance.
You might also like to step outside the relational DB zone and consider some
of the object databases now available. Some of them are pretty good and this
issue becomes a mute point when used properly.
The last option you have is to provide an additional layer to your app to
handle ORM (Object Relational Mapping) and actually modify/extend your DB
schema as your requirements evolve. This may not be the best solution though.
> Hi all, I am working on designing a solution that will have an asp.net front
> end and sql back-end. Due to the constantly evolving nature of the
[quoted text clipped - 13 lines]
>
> TIA!
param@community.nospam - 22 Apr 2005 01:55 GMT
Good points. I guess I have to consider the pros and cons of each method. I
also need to try and determine what types of changes and maintanence will
occur more frequently. Schema changes or reporting needs as an example.
thanks
> There are so many times when having specific data in specific fields
> within
[quoted text clipped - 50 lines]
>>
>> TIA!