Skip to content

Commit 0862f08

Browse files
committed
edits
1 parent d25040f commit 0862f08

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

docs/data-tools/add-new-data-sources.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.subservice: data-tools
1616
#customer intent: As a developer, I want to add .NET Framework data sources with ADO.NET in Visual Studio, so I can connect data stores to my application.
1717
---
1818

19-
# Add data sources in ADO.NET applications for .NET Framework
19+
# Add data sources in ADO.NET applications (.NET Framework)
2020

2121
When you work with .NET data tools in Visual Studio, you can add *data sources* (.NET objects) to connect your .NET application to information in data stores. The Visual Studio designers can consume the data source output to generate boilerplate code that binds the data to forms when you drag and drop database objects from the **Data Sources** window.
2222

@@ -36,7 +36,7 @@ Examples of data sources include:
3636

3737
## Prerequisites
3838

39-
- An application that implements Windows Forms or Windows Presentation Format (WPF) objects that target the .NET Framework. You can create this type of application by using a template in Visual Studio when your installation includes the **.NET Desktop development** workload. For more information, see [Modify Visual Studio workloads, components, and language packs](../install/modify-visual-studio).
39+
- An application that implements Windows Forms or Windows Presentation Format (WPF) objects that target .NET Framework. You can create this type of application by using a template in Visual Studio when your installation includes the **.NET Desktop development** workload. For more information, see [Modify Visual Studio workloads, components, and language packs](../install/modify-visual-studio.md).
4040

4141
> [!IMPORTANT]
4242
> The features described in this article aren't supported for **.NET Core** development for WPF or Windows Forms.
@@ -46,6 +46,8 @@ Examples of data sources include:
4646
> [!TIP]
4747
> When the application doesn't use one or more of these components, the concept of a "data source" doesn't apply. In these scenarios, you can connect directly to the database by using [SqlCommand class](/dotnet/api/system.data.sqlclient.sqlcommand?view=netframework-4.8.1&preserve-view=true) objects.
4848
49+
<a name="data-sources-window"></a>
50+
4951
## Work with data sources and Windows forms
5052

5153
You create and edit data sources for .NET Framework by using the **Data Source Configuration Wizard** in a Windows Forms or WPF application. You can create a data source from a database, a service, an object, or from a SharePoint list:
@@ -54,7 +56,7 @@ You create and edit data sources for .NET Framework by using the **Data Source C
5456

5557
After you create data sources, they're visible in the **Data Sources** window. When your project is open in Visual Studio, you can access this window by selecting **View** > **Other Windows** > **Data Sources**. You can also use the **Shift**+**Alt**+**D** keyboard shortcut.
5658

57-
In a Windows Forms project that targets the **.NET Framework** (not .NET Core or .NET 5 or later), you can drag a data source from the **Data Sources** window onto a Windows form design surface or control. Some examples of how you can connect a data source with a form include:
59+
In a Windows Forms project that targets **.NET Framework** (not .NET Core or .NET 5 or later), you can drag a data source from the **Data Sources** window onto a Windows form design surface or control. Some examples of how you can connect a data source with a form include:
5860

5961
- Drag a table to get a [BindingNavigator](/dotnet/desktop/winforms/controls/bindingnavigator-control-overview-windows-forms) and a [DataGridView](/dotnet/desktop/winforms/controls/datagridview-control-windows-forms) for the table.
6062

@@ -77,9 +79,7 @@ These actions trigger Visual Studio to generate boilerplate code that displays t
7779

7880
## Create data source from database or database file
7981

80-
You can create a dataset or an Entity Framework model to use as a data source for a database or database file with the **Data Source Configuration Wizard**. If your configuration uses Entity Framework, first create your [Entity classes](#create-entity-framework-classes), and then use the wizard to create data sources.
81-
82-
For detailed instructions to complete the wizard, see [Create and configure datasets in the .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
82+
You can create a dataset or an Entity Framework model to use as a data source for a database or database file with the **Data Source Configuration Wizard**. If your configuration uses Entity Framework, first create your [Entity classes](#create-entity-framework-model-as-data-source), and then use the wizard to create data sources.
8383

8484
### Create dataset as data source
8585

@@ -97,6 +97,8 @@ Follow these steps to create a dataset as a data source:
9797

9898
1. Select the database objects to include in the dataset, and complete the wizard.
9999

100+
For detailed instructions to complete the wizard, see [Create and configure datasets in .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
101+
100102
### Create Entity Framework model as data source
101103

102104
When your configuration uses Entity Framework, you first create your Entity classes and then use the **Data Source Configuration Wizard** to create the data source.
@@ -129,9 +131,13 @@ Follow these steps to create an Entity Framework model as a data source with the
129131

130132
For detailed instructions to complete the wizard, see [Create Model Classes with the Entity Framework (C#)](/aspnet/mvc/overview/older-versions-1/models-data/creating-model-classes-with-the-entity-framework-cs).
131133

132-
The generated classes for the model are now available in the **Data Source Configuration Wizard** when you choose the **Objects** category. You can select the tables (or individual columns), stored procedures, functions, and views from the model to use in the dataset.
134+
1. After you generate classes for the model, you can create a data source from an object with the **Data Source Configuration Wizard**.
133135

134-
:::image type="content" source="./media/raddata-data-source-configuration-wizard-with-entity-classes.png" alt-text="Screenshot that shows the generated Entity classes for the model in the Data Source Configuration Wizard.":::
136+
- Select the tables (or individual columns), stored procedures, functions, and views from the model for use in the dataset.
137+
138+
:::image type="content" source="./media/raddata-data-source-configuration-wizard-with-entity-classes.png" alt-text="Screenshot that shows the generated Entity classes for the model in the Data Source Configuration Wizard.":::
139+
140+
For detailed instructions, see [Create data source from object](#create-data-source-from-object).
135141

136142
## Create data source from service
137143

@@ -156,14 +162,17 @@ Follow these steps to create a data source from a service:
156162

157163
The **Add Service Reference** dialog opens. You can also access this dialog by right-clicking your project in **Solution Explorer** and selecting **Add service reference**.
158164

159-
For detailed instructions to complete the wizard, see [Create and configure datasets in the .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
165+
For detailed instructions to complete the wizard, see [Create and configure datasets in .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
160166

161167
## Create data source from object
162168

163169
The **Data Source Configuration Wizard** also lets you create a data source from any object that exposes one or more public properties.
164170

165171
All public properties of an object are visible in the **Data Sources** window. If you're using Entity Framework with a generated model, this window shows the entity classes that are the data sources for your application.
166172

173+
> [!NOTE]
174+
> To support drag-and-drop data binding, objects that implement the <xref:System.ComponentModel.ITypedList> or <xref:System.ComponentModel.IListSource> interface must have a default constructor. Otherwise, Visual Studio can't instantiate the data-source object and shows an error when you drag the item to the design surface.
175+
167176
Follow these steps to create a data source from an object:
168177

169178
1. In Visual Studio, select **Project** > **Add New Data Source** to open the **Data Source Configuration Wizard**.
@@ -181,10 +190,7 @@ Follow these steps to create a data source from an object:
181190
> [!NOTE]
182191
> You might need to build the project that contains your objects before the objects appear in the tree view.
183192
184-
For detailed instructions to complete the wizard, see [Create and configure datasets in the .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
185-
186-
> [!NOTE]
187-
> To support drag-and-drop data binding, objects that implement the <xref:System.ComponentModel.ITypedList> or <xref:System.ComponentModel.IListSource> interface must have a default constructor. Otherwise, Visual Studio can't instantiate the data-source object and shows an error when you drag the item to the design surface.
193+
For detailed instructions to complete the wizard, see [Create and configure datasets in .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
188194

189195
## Create data source from SharePoint list
190196

@@ -201,9 +207,9 @@ Follow these steps to create a data source from a SharePoint list:
201207

202208
1. Use the **Add Service Reference** dialog to connect to the SharePoint data service by pointing to the SharePoint Server.
203209

204-
For detailed instructions to complete the wizard, see [Create and configure datasets in the .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
210+
For detailed instructions to complete the wizard, see [Create and configure datasets in .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md).
205211

206212
## Related content
207213

208214
- Explore [Visual Studio data tools for .NET](visual-studio-data-tools-for-dotnet.md)
209-
- [Create and configure datasets in the .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md)
215+
- [Create and configure datasets in .NET Framework with Visual Studio](create-and-configure-datasets-in-visual-studio.md)
Loading

0 commit comments

Comments
 (0)