Data Access has been discontinued. Please refer to this page for more information.

How to: Manually Integrate Enhancer

When you use the Fluent Mapping API, you need to create a custom fluent context class that derives from the OpenAccessContext class. It will represent the shape of your model and will act as a gateway to your database. Next you could start writing queries against your context, load data, insert, update and delete objects from the database. OpenAccessContext resides in the Teleri.OpenAccess.35.Extensions assembly, which along with the rest of the required Data Access assemblies, Enhancer, and the OpenAccessNuGet.targets file, is delivered to you by the Telerik.DataAccess.Fluent and Telerik.DataAccess.Core NuGet packages. Usually, you will integrate the project that holds your model with these packages and the code for the post-build enhancement action will be added to your project file by NuGet Package Manager. But if the assemblies and Enhancer are already available on your machine, you may decide to perform the integration manually. In this case, besides adding references to the assemblies in your project, you will have to to integrate the call to Enhancer as well.

This tutorial will guide you through the process.

  1. Copy the OpenAccessNuget.targets file inside your project folder and include it in the project.
  2. Right-click on your project in the Solution Explorer and select Unload Project.
  3. Again in the Solution Explorer, right-click on the unloaded project and select Edit ProjectName.csproj.
  4. In your csproj file, find a line like this one:

    <!-- It is not necessary the value to be Debug -->
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    

    And add the path to Enhancer. In this example, it is assumed that Enhancer is located in a custom folder under the packages folder inside the solution directory:

    <EnhancerAssembly>$(SolutionDir)\packages\MyCustomFolder\tools\enhancer\enhancer.exe</EnhancerAssembly>
    
  5. Go further down the .csproj file and find a line like this one:

    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    

    After it paste the following import clause:

    <Import Project="OpenAccessNuget.targets" />
    
  6. Save your changes. Right-click on your project in the Solution Explorer and select Reload Project.

By implementing the above-mentioned steps you guarantee that the Telerik Data Access Enhancer will be integrated with your Fluent Mapping project. Check out the next topic to see how to troubleshoot your fluent mapping applications.