Integrating Telerik® Data Access using NuGet packages
Telerik Data Access has four NuGet packages which allow you to integrate it into your solution - Telerik.DataAccess.Fluent, Telerik.DataAccess.Core, Telerik.DataAccess.Web, and Telerik.DataAccess.Profiler. They will enable you to develop and deploy applications which are using Telerik Data Access on machines which do not have it installed. In this article you will learn the purpose of those packages and how to use them.
- Telerik.DataAccess.Fluent package
- Telerik.DataAccess.Core package
- Telerik.DataAccess.Web package
- Telerik.DataAccess.Profiler package
Telerik.DataAccess.Fluent package
The Telerik.DataAccess.Fluent package is designed to be used in the data access layer of your application - where your Telerik Data Access model will reside. The package includes a .targets file, the Telerik Data Access Enhancer tool together with its dependencies. The Enhancer is automatically called as a post-build step to provide the persistent capability, change tracking and lazy loading functionality to your model. The Fluent package is dependent on the Telerik.DataAccess.Core package.
Installing Telerik.DataAccess.Fluent
- Right-click on the project which will hold your Telerik Data Access model.
- Select the Manage NuGet Packages... option.
-
In the NuGet packages manager, select the Online node and search for Telerik.DataAccess.Fluent.
Select the Telerik.DataAccess.Fluent package and click the install button. This will install both Telerik.DataAccess.Fluent package and its dependency Telerik.DataAccess.Core.
As a result of the installation, the following items will be added to the project:
- The OpenAccessNuGet.targets file.
- A reference to Telerik.OpenAccess assembly.
- A reference to Telerik.OpenAccess.Runtime assembly.
- A reference to Telerik.OpenAccess.35.Extensions assembly.
- A reference to Telerik.OpenAccess.40.Extensions assembly.
In addition, the Enhancer together with its dependencies will be deployed in the Telerik.DataAccess.Fluent folder found in the packages directory of your solution.
After installing the Fluent package, you are ready to start defining your Fluent Model. For more information about doing so you may refer to this section or check out our Telerik.DataAccess.Fluent.Sample NuGet which illustrates the structure of a basic Fluent Model in C#.
An alternative workflow to install the Telerik.DataAccess.Fluent package is:
- Open Package Manager Console from the Tools \ Library Package Manager menu in Visual Studio.
- Run the command provided in NuGet Gallery.
Telerik.DataAccess.Core package
The Telerik.DataAccess.Core package is designed to be used within projects which are consuming an already existing Telerik Data Access model and do not define persistent classes themselves. The package provides the Telerik Data Access runtime assemblies required to work with persistent classes and XML files for InteliSense support.
Installing Telerik.DataAccess.Core
- Right-click on the project which will be consuming your Telerik Data Access model.
- Select the Manage NuGet Packages... option.
-
In the NuGet packages manager, select the Online node and search for Telerik.DataAccess.Core.
Select the Telerik.DataAccess.Core package and click the install button.
As a result of the installation, references to the following assemblies will be added to the project:
- Telerik.OpenAccess
- Telerik.OpenAccess.Runtime
- Telerik.OpenAccess.35.Extensions
- Telerik.OpenAccess.40.Extensions
Those assemblies, together with the XML files required for the InteliSense support are located in the Telerik.DataAccess.Core folder found in the packages directory of your solution.
After installing the Core package you are ready to consume Telerik Data Access models from within your application as you usually would:
- Add a reference to the model`s project and the respective using/Imports statement.
- Use an instance of the model`s context to perform CRUD operations as required by your scenario.
using (var context = new YourContextClassName())
{
//........
}
Using context As New YourContextClassName()
'........
End Using
An alternative workflow to install the Telerik.DataAccess.Core package is:
- Open Package Manager Console from the Tools \ Library Package Manager menu in Visual Studio.
- Run the command provided in NuGet Gallery.
Telerik.DataAccess.Web package
The Telerik.DataAccess.Web NuGet package is designed to help you develop ASP.NET applications. It delivers the Telerik.OpenAccess.Web40 assembly, which contains the OpenAccessLinqDataSource control, and adds a reference to it in your project.
Installing Telerik.DataAccess.Web
- Right-click on the project which will be consuming OpenAccessLinqDataSource.
- Select the Manage NuGet Packages... option.
-
In the NuGet packages manager, select the Online node and search for Telerik.DataAccess.Web.
Select the Telerik.DataAccess.Web package and click the install button.
As a result of the installation, a reference to the Telerik.OpenAccess.Web40 assembly will be added to the project. After it you are ready to consume OpenAccessLinqDataSource.
An alternative workflow to install the Telerik.DataAccess.Web package is:
- Open Package Manager Console from the Tools \ Library Package Manager menu in Visual Studio.
- Run the command provided in NuGet Gallery.
Telerik.DataAccess.Profiler package
The Telerik.DataAccess.Profiler NuGet package is designed to help you profile the behavior of Data Access during runtime. It delivers the Telerik.OpenAccess.ServiceHost assembly and adds a reference to it in your project. Combining this package with the configuration suggested in How to: Configure Fluent Model For Monitoring and Profiler and Tuning Adviser will allow you to monitor various metrics of your data access layer.
Installing Telerik.DataAccess.Profiler
- Right-click on the project which contains your data access layer.
- Select the Manage NuGet Packages... option.
-
In the NuGet packages manager, select the Online node and search for Telerik.DataAccess.Profiler.
Select the Telerik.DataAccess.Profiler package and click the install button.
As a result of the installation, a reference to the Telerik.OpenAccess.ServiceHost assembly will be added to the project. After it you need to configure the model project for real-time profiling and to start the service host from the project that consumes the data access layer. You can find the necessary details in the How to: Configure Fluent Model For Monitoring article.
An alternative workflow to install the Telerik.DataAccess.Profiler package is:
- Open Package Manager Console from the Tools \ Library Package Manager menu in Visual Studio.
- Run the command provided in NuGet Gallery.