Typed Data Set Generated Code

Whenever you save your data set definition in the designer, a code generation tool runs to define a set of strongly typed classes behind the scenes. These classes correspond to the data set schema elements that you specify with the designer. Like the Windows Forms designer, this code is placed in files with .Designer.cs (or .Designer.vb for a VB project) extensions, and the file is shown in Solution Explorer as a child of the XSD file. Two other designer support files are also generated (with extensions of XSC and XSS). When you look at your typed data set definition in Solution Explorer, you should see something like Figure 2.9.

Figure 2.9. Typed Data Set Definition

Figure 2.9. Typed Data Set Definition

If you open the CustomersDataSet.Designer.es file, you will see that a whole ton of code has been generated for you (over a thousand lines of code per table in the data set). Scrolling through there and trying to make sense of it will be a little overwhelming at first, but Listing 2.3 highlights the most important parts, and you will get experience working with the rest of it throughout the booListing 2.3 shows a highly condensed version of the file with comments added for clarification.

0 0

Post a comment