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

nHibernate Migration

1 Answer 100 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.
Paresh
Top achievements
Rank 1
Paresh asked on 21 Aug 2014, 07:16 PM
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







1 Answer, 1 is accepted

Sort by
0
Accepted
Kaloyan Nikolov
Telerik team
answered on 26 Aug 2014, 05:57 AM
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.
 
Tags
General Discussions
Asked by
Paresh
Top achievements
Rank 1
Answers by
Kaloyan Nikolov
Telerik team
Share this question
or