Solved

Typed Dataset: what happens if the schema changes?

Posted on 2004-08-15
8
435 Views
Last Modified: 2006-11-17
I'm new to C#, and I've just set up a typed Dataset using VS.NET's little wizard.

I was wondering what happens if the schema of the (in this case) SQL Sever table changes?  How does VS.Net handle this?
0
Comment
Question by:gdbjohnson
  • 4
  • 4
8 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11804677
it depends on the schema change.

if its a relationship change i.e. a constraint has been changed it may fail completely dependant upon the data it receives
if its a datatype change to a column it may or may not fail depending on if it is changing the intrinsic  .net type being used
if a column is added it will work fine.
0
 
LVL 2

Author Comment

by:gdbjohnson
ID: 11805890
so how does VS.Net update the dataset to correct potential failures?  Is it as simple as just re-running the "Generate Dataset" wizard?  I'm trying to guage the kinds of complications that may arise with this feature.  

Do you recommend using Typed Datasets?  They seem powerful, but I've had too much experience with fancy features not working well if you do something that MS doesn't expect to not be careful.

G
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 50 total points
ID: 11805931
I personally do not recommend them but then again I work on very large applications (400 tables is a good example) ... I personally use object persistance layers as they provide a higher level of encapsulation/flexibility. Using typed datasets is fine I am sure for smaller applications ... yes you would need to regenerate the dataset to fix the schema changes.

http://dotnetjunkies.com/WebLog/bsblog/archive/2004/05/04/12748.aspx

search around on them and you will find people saying alot of good and bad things about them
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:gdbjohnson
ID: 11810037
well, this is definately a project of smaller magnitude (development team of 1 :) , so perhaps I will investigate their use.

thanks for your opinion.
0
 
LVL 2

Author Comment

by:gdbjohnson
ID: 11826380
sorry to bug you, especially since I've accepted your answer, but given your experience I'd like your opinion on one more thing:

do you use DataBinding in your apps?  does it work well?

I asked this in another question, and 2 people responded with yes.  I was wondering what you thought about it.

G
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11826566
As any technology it has its benefits and its drawbacks.

Benefits:
Less code !!
Well tested code
when used with objects pushes a mvc pattern

Drawbacks:
Kind of convoluted to do some more advanced features (i.e. it will do it but it takes some getting used to)
A bit less control over the process

Personally I use databinding mostly to objects (not datasets etc) I am estatic to finally have reasonable support for such. Some of the issues I run into are in dealing with collections and hanving to implement IBindingList on my collections if I want to support various things this is not exactly a trivial process, although much can be done in a base class through reflections. Another spot where I currently have a pain is binding image fields... it is easier to just grab a byte array and push it in as a parameter than it is to setup the parsers/formatters to do it (and less code), from what I have seen 2.0 does a much better job on this though.

Overall though I am quite happy with the databinding model and look forward to the new functionalities being added ... I mean there is nothing worse than code like the following ...

TextBox1.Text = Format(obj.Value1);
TextBox2.Text = Format(obj.Value2);
TextBox3.Text = Format(obj.Value3);
.
.
TextBox229.Text = Format(obj.Value229);

now ... another 229 lines of code to set the data back to the object :)
0
 
LVL 2

Author Comment

by:gdbjohnson
ID: 11830178
excellent.  
Thanks alot.  I'd raise the points if I could.  :)

I've been working with VB6 for the last 2 years, and have developed a faint sense of loathing for the language and it's 'features' - especially databinding.

Working in a more solid OOP language like C# is a breath of fresh air - and I[m glad that these features are more robust now.
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11831712
no worries, points and a dollar will get me a cup of coffee ...

they are getting even better in 2.0 ;) check out the beta.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Video Player 12 28
SqlDataBase 7 54
Hey Audio! 9 44
LINQ Select all records by MAX data syntax help 1 18
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project

830 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