Question

We want to remove the necessity of installing OpenAccess on the client and build machine and plan to do that using OpenAccess nuget packages. I've been following the guide and installed OpenAccess.CodeFirst nuget packages for all projects in solution which deal with ORM.

Unfortunately, I receive the infamous exception:

System.TypeInitializationException: The type initializer for 'XXXl' threw an exception. ---> System.ArgumentException: Cannot find resource EntitiesModel.rlinq embedded in assembly

I've checked all the steps from this article but I'm still getting the same error. What am I missing?

Was it helpful?

Solution

As the Telerik OpenAccess ORM Nuget Packages provide support for the code first approach, by default settings are optimized for fluent mapping and only fluent mapping models will be enhanced. In order to use different type of mapping (Xml mapping or Attributes mapping) you need to enable it following those steps:

  1. Unload the project containing your model and open the project file for editing.
  2. Enable xml mapping by adding true in the first PropertyGroup of the project file.

For example:

<?xml version="1.0" encoding="utf-8"?>
<Project ...>
  ...
  <PropertyGroup>
    ...
    <UseXmlMapping>true</UseXmlMapping>
  </PropertyGroup>
  ...
</Project>

Additionally you can find an alternative approach for using Telerik OpenAccess ORM without installation described by this documentation article - http://documentation.telerik.com/openaccess-orm/developers-guide/integrating-openaccess-orm-in-your-solution/external-tools-howto-integrate-enhancer-msbuild .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top