How to: Separate Datasets and TableAdapters into Different Projects
Typed datasets have been enhanced so that the TableAdapters and dataset classes can be generated into separate projects. This enables you to quickly separate application layers and generate n-tier data applications.
The following procedure describes the process of using the Creating and Editing Typed Datasets to generate dataset code into a project that is separate from the project that contains the generated TableAdapter code.
When you separate dataset code from TableAdapter code, the project that will contain the dataset code must be located in the current solution. If this project is not located in the current solution, it will not be available in the DataSet Project list in the Properties window.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.
To separate the dataset into a different project
Open a solution that contains a dataset (.xsd file).
If the solution does not contain the project into which you want to separate your dataset code, create it, or add an existing project to the solution.
Double-click a typed dataset file (an .xsd file) in Solution Explorer to open the dataset in the Dataset Designer.
Click an empty area of the Dataset Designer.
Locate the DataSet Project node in the Properties window.
In the DataSet Project list, click the name of the project into which you want to generate the dataset code.
After you click the project into which you want to generate the dataset code, the DataSet File property is populated with a default file name. You can change this name if you have to. Additionally, if you want to generate the dataset code into a specific directory, you can set the Project Folder property to the name of a folder.
When you separate datasets and TableAdapters (by setting the DataSet Project property), existing partial dataset classes in the project will not be moved automatically. Existing dataset partial classes must be manually moved to the dataset project.
Save the dataset.
The dataset code is generated into the project selected in the DataSet Project property, and the TableAdapter code is generated into the current project.
By default, after you separate the dataset and TableAdapter code, the result is a discrete class file in each project. The original project has a file that is named DatasetName.Designer.vb (or DatasetName.Designer.cs) that contains the TableAdapter code. The project designated in the Dataset Project property has a file that is named DatasetName.DataSet.Designer.vb (or DatasetName.DataSet.Designer.cs) that contains the dataset code.
With the dataset or TableAdapter project selected, click Show All Files in Solution Explorer to view the generated class file.