Share via


Data Sources Overview

Data sources represent the data available to your application. More specifically, data sources represent the data that you want to work with in your application. Data sources can be obtained from databases (including local database files), services, and objects.

The data sources that you add to your project are displayed in the Data Sources window. In many cases, you can drag data sources to the Windows Forms, WPF, and Silverlight designers to create controls that are bound to the underlying data. For more information, see Binding Controls to Data in Visual Studio.

Visual Studio provides tools for creating and editing data sources in your application. Data sources in Visual Studio projects are represented as Entity Data Models, datasets, proxy objects returned by a service, or other object types, depending on the objects that are returned by the underlying data store.

You create and edit data sources by using the Data Source Configuration Wizard.

Data Sources Created from Databases

You can create a data source from a database by running the Data Source Configuration Wizard and selecting the Database data source type. For more information, see How to: Connect to Data in a Database.

When you create a data source from a database, Visual Studio generates a data model and adds it to your project. A data model is a strongly typed, programmable view of the underlying data in the database. You can use Visual Studio to create the following types of data models:

Data Sources Created from Local Database Files

You can also create data sources from the following types of database files: SQL Server Compact databases (.sdf files), Access databases (.mdb files), SQL Server Express LocalDB databases (.mdf files), and SQL Server Express databases (.mdf files). When you create data sources from these database files, you can add the database files directly to your project. For more information, see the following topics:

Data Sources Created from Services

You can create a data source from a service by running the Data Source Configuration Wizard and selecting the Service data source type. For more information, see How to: Connect to Data in a Service.

When you create a data source from a service, Visual Studio adds a service reference to your project. Visual Studio also creates proxy objects that correspond to the objects that are returned by the service. For example, a service that returns a dataset is represented in your project as a dataset; a service that returns a specific type is represented in your project as the type returned.

You can create a data source from the following types of services:

Data Sources Created from Objects

You can create a data source from any object that exposes one or more public properties by running the Data Source Configuration Wizard and then selecting the Object data source type. All public properties of an object are displayed in the Data Sources window. For more information, see How to: Connect to Data in Objects.

For more information about binding to objects, see Object Binding in Visual Studio.

Data Sources Created from SharePoint Lists

You can create a data source from a SharePoint list by running the Data Source Configuration Wizard and selecting the SharePoint data source type. SharePoint exposes data through WCF Data Services so creating a SharePoint data source is the same as creating a data source from a service. Selecting the SharePoint item in the Data Source Configuration Wizard opens the Add Service Reference dialog box where you connect to the SharePoint data service by pointing to the SharePoint server. For more information, see How to: Connect to Data in a Service.

See Also

Reference

Data Sources Window

Concepts

What's New for Data Application Development in Visual Studio 2012

Binding Windows Forms Controls to Data in Visual Studio

Dataset Designer

Preparing Your Application to Receive Data

Fetching Data into Your Application

Binding Controls to Data in Visual Studio

Editing Data in Your Application

Validating Data

Saving Data

Other Resources

Overview of Data Applications in Visual Studio

Connecting to Data in Visual Studio