This is a migrated thread and some comments may be shown as answers.

OpenAccess nuget package and Cannot find resource EntitiesModel.rlinq embedded in assembly exception

1 Answer 311 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bojan
Top achievements
Rank 1
Bojan asked on 15 Jan 2014, 11:20 AM
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 'XXX' 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? How do I ensure that my assemblies are enhanced?

1 Answer, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 17 Jan 2014, 12:36 PM
Hello Bojan,

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 <UseXmlMapping>true</UseXmlMapping> in the first PropertyGroup of the project file. For example:

<?xml version="1.0" encoding="utf-8"?>
<Project ...>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    ...
    <EnhancerAssembly>$(SolutionDir)\packages\OpenAccess.CodeFirst.2013.3.1211.3\tools\enhancer\enhancer.exe</EnhancerAssembly>
    <UseXmlMapping>true</UseXmlMapping>
  </PropertyGroup>
   
  ...
   
</Project>


Additionally you can find an alternative approach for using Telerik OpenAccess ORM without installation described by this documentation article

Regards,
Boyan
Telerik
OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Tags
General Discussions
Asked by
Bojan
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Share this question
or