Solved

Reflection or Strongly Typed data sets

Posted on 2004-08-01
5
254 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

23 Experts available now in Live!

Get 1:1 Help Now