Defining metadatasource objects not in the enhanced assembly

Thread is closed for posting
2 posts, 0 answers
  1. Diego
    Diego avatar
    8 posts
    Member since:
    May 2012

    Posted 22 Jul 2014 Link to this post

    I understand the enhancer.exe utility must run on post-build of the assembly that contains entities, correct? I'd like to know what it looks for in order to determine if it should or should not apply the enhancing on the assembly. 

    The assembly I am targeting has MappingConfiguration classes and the entity classes, but does not define any metadatasource objects. It seems like since you support the ability to dynamically add metadata sources using the AggregateMetadataSource object, then I should be able to instantiate the MetadataSource objects from wherever else in the application as long as I am passing in a complete metadata container to the OA context constructor. My problem is that the enhancer.exe is not executing against my entities assembly unless I define the FluentMetadataSource within that same assembly as my entities and mapping objects.

    The code I am referring to is in GitHub and I have a unit test OAContextManagerTests.InitializeManager() that shows the error I'm talking about. The code is accessing a LocalDB instance of Northwind. The purpose of this particular code design is to encapsulate the ORM in abstraction and then compare both EF and OA against it:

    I'd really appreciate any support to figure this out. Could it be as simple as a parameter to the enhancer.exe that allows one to force enhancing based on class names or something regardless of preconditions explicitly checked?  

    Thanks in advance...
  2. Boyan
    Boyan avatar
    100 posts

    Posted 24 Jul 2014 Link to this post

    Hello Diego,

    Yes, you are right that the enhancer.exe would be called as a post build step. You could have a look at this blog post that explains how the Enhancer works in more details.

    Currently enhancing entities that are not located in the same assembly as the respective MetadataSource is an unsupported scenario. This is also true for aggregating MetadataSources - if a MetadataSource is located in separate assembly, the entities must be located in this assembly as well. So in order to get this to work, you would need to change the architecture of your application in such a way that both entities and their MetadataSource are located in the same assembly. 

    Please have a look at this feature request that targets similar scenario. Please vote for it if you are interested, it will help us prioritize it.

    Let us know if you have any more questions or need any further assistance. 

    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top