1

I have continually run into problems trying to repair code from another developer, and one method I opted to go with was manually changing the generated dataset.designer.vb file to include overloaded database CRUD methods... After some searching, and poking around the code files, I still cannot figure out what source is being used to generate those files... I understand its the MSDataSetTool that is actually generating it, however, rather than disable it and have to manually refactor EVERY method in the dataset, I'd rather leave it on, and just change whatever source file its getting its design from...

Where does the MSDataSetGenerator look to decide how to generate/regenerate the designer.vb files?This is the info message box i get once it has regenerated the file

William Tolliver
  • 305
  • 1
  • 2
  • 16

1 Answers1

2
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:4.0.30319.42000
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Right. You don't want to touch that.

But you should have an xsd file which contains the data model. Adding a new DataSet to my solution, all the files are automatically generated.

enter image description here

But you wouldn't want to edit even the xsd file manually. There is a graphical interface which allows you to manage tables.

enter image description here

Just double-click the xsd file in the solution explorer to bring it up and manage the data set.

djv
  • 15,168
  • 7
  • 48
  • 72
  • I see thanks... Well here though, is my predicament... I'm seeing CRUD method overloads in the original dataset that im modeling a new one after, that arent being generated when I create the tables in the GUI. For example, there is an INSERT method in the .vb of the dataset, however it requires 12 parameters, whereas the actual table has 22 columns. When actually being invoked in the code, it allows for 12 parameters, from the dataset "a" But when i create dataset "b" and make that SAME EXACT table, it generated an insert method that takes 22 params... Why is this? – William Tolliver Nov 30 '16 at 20:21
  • If I were you, I'd identify the overloads and move them all into an intermediary layer (file). By mucking around in there you are just perpetuating a poor programming pattern :) , while you have a chance to make things right. One way to do this is to use a partial class to add overloads, another is to subclass the model and add your functionality. – djv Nov 30 '16 at 20:48
  • 1
    Idk why i didnt think of that(probably because i've never created a partial class). So I can just create another file for the partial class and add all the necessary overloads without interfering with the generated code? – William Tolliver Dec 01 '16 at 17:29
  • 1
    Yes in fact the DataSet class is automatically declared `Partial` with this being the intent, so you can go right ahead and do that. Make sure your file is in the same Namespace and Assembly. Here is the automatic declaration of the DataSet I generated: `Partial Public Class DataSet1 Inherits Global.System.Data.DataSet ...` – djv Dec 01 '16 at 18:21
  • Do i put this into the "Dataset.vb" file itself? Its empty and i imagine thats what its for, just trying to be sure – William Tolliver Dec 01 '16 at 19:27
  • 1
    I would just create another file near the DataSet. – djv Dec 01 '16 at 19:30