Solved

Typed Dataset: what happens if the schema changes?

Posted on 2004-08-15
8
426 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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

22 Experts available now in Live!

Get 1:1 Help Now