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

2 posts, 0 answers
  1. Bojan
    Bojan avatar
    1 posts
    Member since:
    Jan 2014

    Posted 15 Jan 2014 Link to this post

    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?
  2. Boyan
    Admin
    Boyan avatar
    100 posts

    Posted 17 Jan 2014 Link to this post

    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!
  3. DevCraft banner
Back to Top