nHibernate Migration

2 posts, 1 answers
  1. Paresh
    Paresh avatar
    13 posts
    Member since:
    Jul 2014

    Posted 21 Aug 2014 Link to this post

    Hi 

    We are migrating our application from nHibernate to Telerrik Data access. We are following instructions mentioned in the migration document 
    http://docs.telerik.com/data-access/developers-guide/converting-legacy-applications-to-data-access/converting-from-nhibernate/developer-guide-convert-legacy-app-nhibernate-fluent

    but after step 2 we are getting following error..how do we fix it

    Error 20 Unable to load assembly 'App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'NHibernate, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
    ExceptionString:
    System.SystemException: Unable to load assembly 'App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'NHibernate, Version=3.0.0.2001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500) ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
       at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
       at System.Reflection.RuntimeModule.GetTypes()
       at System.Reflection.Assembly.GetTypes()
       at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
       --- End of inner exception stack trace ---
       at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
       at Telerik.OpenAccess.Metadata.MetadataAttributesReader.ReadMetaModel(Assembly assembly)
       at Telerik.OpenAccess.Metadata.AttributesMetadataSource.<>c__DisplayClass1.<FromAssembly>b__0()
       at Telerik.OpenAccess.Metadata.AttributesMetadataSource.CreateModel()
       at Telerik.OpenAccess.Metadata.MetadataSource.GetModelCore(MetadataContainer old)
       at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
       at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun() C:\Development\app\obj\Dev\app.dll app







  2. Answer
    Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 26 Aug 2014 Link to this post

    Hi Paresh,

    This could happen because of any NHibernate specifics like attributes or other artifacts used somewhere in your domain classes. 

    I would suggest you to remove the NHibernate reference from your data layer project and then build and fix all errors because of the missing reference. In genera the fix should be removing the remaining artifacts. After that you should be able to compile without any issues. 

    The reason for this error is that the Enhancer tool is trying to instantiate the FluentMetadataSource class to retrieve the configuration to make the classes persistent accordingly. The exception is in the System.Reflection.RuntimeModule.GetTypes() which means that some of your classes still need the NHibernate reference. 

    I hope this helps. Should you have any other questions do not hesitate to get back to use. 

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