How to: Use Telerik® Data Access Without Installing It
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
In this topic you will learn how to integrate the Telerik Data Access Enhancer in MSBuild task. If you have added Telerik Data Access Domain Model via the "Add New Item" command to your project, the enhancement is already added to the MsBuild project file and no changes are necessary. However, this scenario only works if you have Telerik Data Access installed on your build machines.
To integrate the Telerik Data Access Enhancer in MSBuild task:
-
In Windows Explorer, navigate to your Project folder containing Telerik Data Access Domain Model (.rlinq file). Create a new folder named OpenAccessAssemblies.
-
Copy the following Telerik Data Access dlls in the OpenAccessAssemblies folder:
- ~OpenAccess Installation Folder/sdk/CecilLicense.txt
- ~OpenAccess Installation Folder/sdk/enhancer.exe
- ~OpenAccess Installation Folder/sdk/enhancer.exe.config
- ~OpenAccess Installation Folder/sdk/Mono.Cecil.dll
- ~OpenAccess Installation Folder/sdk/Mono.Cecil.Pdb.dll
- ~OpenAccess Installation Folder/sdk/OpenAccess.targets
- ~OpenAccess Installation Folder/sdk/Telerik.OpenAccess.SDK.dll
- ~OpenAccess Installation Folder/sdk/VEnhance.exe
- ~OpenAccess Installation Folder/sdk/venhance.exe.config
- ~OpenAccess Installation Folder/bin/Telerik.OpenAccess.35.Extensions.dll
- ~OpenAccess Installation Folder/bin/Telerik.OpenAccess.Config.dll
- ~OpenAccess Installation Folder/bin/Telerik.OpenAccess.dll
- ~OpenAccess Installation Folder/bin/Telerik.OpenAccess.Runtime.dll
-
Open your solution in Visual Studio.
The first step is to modify your project. Right-click on your project in the Solution Explorer and select Unload Project.
-
Again in the Solution Explorer, right-click on the unloaded project and select Edit {ProjectName}.csproj.
-
In your csproj file, find a line like this one:
<Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccess.targets')" Project="$(MSBuildExtensionsPath)\OpenAccess.targets" />
And replace it with the following (where OpenAccessAssemblies is the name of the folder you've created in step 1):
<Import Project="OpenAccessAssemblies\OpenAccess.targets" />
Save your changes. Right-click on your project in the Solution Explorer and select Reload Project.
-
The next step is to modify the Telerik Data Access.targets file. In the Solution Explorer, select the Telerik Data Access.targets and open it for edit.
-
In the file, locate the following lines (at the beginning of the file):
<PropertyGroup> <!-- Additional Data Access related information --> <OpenAccessPath Condition="'$(OpenAccessPath)'==''">c:\Program Files\Telerik\OpenAccess ORM</OpenAccessPath> <EnhancerAssembly Condition="'$(EnhancerAssembly)'==''">$(OpenAccessPath)\sdk\enhancer.exe</EnhancerAssembly> <!-- Additional Data Access related information --> </PropertyGroup>
And modify the <PropertyGroup></PropertyGroup> section as shown below:
<PropertyGroup> <!-- Additional Data Access related information --> <OpenAccessPath Condition="'$(OpenAccessPath)'==''">OpenAccessAssemblies</OpenAccessPath> <EnhancerAssembly Condition="'$(EnhancerAssembly)'==''">enhancer.exe</EnhancerAssembly> <!-- Additional Data Access related information --> </PropertyGroup>
Save the changes. In the end, you need to replace your Telerik Data Access references. By default, when you create a new Telerik Data Access Domain Model, references to the Telerik Data Access assemblies are automatically added. However, those assemblies are located in the Telerik Data Access installation folder. Since you want to build your project on a machine where Telerik Data Access is not installed, you have to modify the Telerik Data Access references. Delete the existing Telerik Data Access references. And add the same again, but this time use the dlls located in the OpenAccessAssemblies folder.
- Build the solution to ensure that everything is building successfully.
- Close your solution and transfer it to the machine where Telerik Data Access is not installed.
- Open your solution again and build it.
When you run your application on a computer where Telerik Data Access is not installed, you have to ensure that the following assemblies are copied to the deployment folder:
- Telerik.OpenAccess.dll
- Telerik.OpenAccess.35.Extensions.dll
- Telerik.OpenAccess.Config.dll
- Telerik.OpenAccess.Runtime.dll
Using Non-MSSQL Database
In case you want to use a database different than MSSQL, you have to ensure that the corresponding drivers are also deployed on the client computer. For more information, check out the Database Support section.