Solved

Reflection or Strongly Typed data sets

Posted on 2004-08-01
5
253 Views
Last Modified: 2010-04-15
I've been using reflection for some time now to easily translate database schema's to c# objects. Basically my reflection updates/Inserts/ deletes itself from a database. I also have an init function that uses a stored procedure to get it's own data from the database.

The beauty of this thing is that when I add a column to a table all I have to do is update the stored procedures that I'm using and add a property in the object. I don't have to manually create and fill out more properties.

I'm wondering if I should move to strongly typed data sets or not? I've tried to read up on it but I'm still a little unsure as to how they work and the pros and cons of em.

Please some information on this subject would be most helpful.

I'm looking for a solution that is flexible enough to handle changes to the underlying schema and is easy to maintain.
0
Comment
Question by:jayrod
  • 2
  • 2
5 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 250 total points
ID: 11689125

have you considerred looking at an object persistance layer ? take a look at gentle.net or dataobjects.net both do VERY well at this task ... it would actually only be adding a property and an attribute in your class ...

as for typed datasets, I personally don't like them ... one of the main problems I have been seeing in MS lately is a division between the object persistance people and the typed dataset people. Due to this choosing which way to go is becoming difficult as some things offer support for one and not the other.

One advantage of moving towards a persistance layer is that yukon essentially contains a persistance layer in the database which will make moving your code to it a bit easier with a persistance layer than with typed datasets.
0
 
LVL 20

Assisted Solution

by:TheAvenger
TheAvenger earned 250 total points
ID: 11691694
I think the answer to the quesion lays in the needs you have. If you want to update objects that have a structure you don't know or which changes often, I would not go for a typed dataset. However if you objects have a relatively stable structure and you don't have to work with any kind of objects, then using a typed dataset will make your development life much easier, will save you some mistakes, etc.
0
 
LVL 3

Author Comment

by:jayrod
ID: 11693307
I guess often is a word that has to be defined :P  I would say that the schema can change often enough to cause annoying problems.

I looked into gentle.net and looks like a great Idea.. I spent some time trying to use it but haven't gotten it to work just yet.

Thank you both.
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11694905
TheAvenger: I know I am stepping into a religious war here ... but are true object persistance layers not more flexible than types datasets ?
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 11694950
gregoryyoung: Unfortunately I have no info about object persistance layers... I can only guess what it is by the name. And would expect the answer to your question to be: yes, they are. But look at my post: it said that typed datasets would be better only if the data structure is well fixed, does not change, is known at design time, etc. In this case the complexity of an additional layer just to have the data in a more flexible (which is not needed in such case) format....

So, if you are working with a fixed database, I would suggest typed datasets - easy to implement, designer supported, go for it and make it fast and clean. If the case is not such one, other options have to be considered and then I suppose your answer will be just OK
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now