Hello Liu Yuanbiao,
The exception "No metadata registered for class [AssemblyName.ClassName]
" usually occurs when the process of assembly enhancement included in the project build by OpenAccess ORM could not be completed successfully or was not executed at all.
In this process, Telerik OpenAccess ORM uses Enhancer
, which is a special enhancer program, to read and process compiled .NET assemblies for adding persistence capability. The Enhancer can be called from the command line, but normally the enhancer is called directly by Visual Studio during build time to process the .NET assemblies in your project. The Enhancer injects the lazy loading and change tracking code into your persistent classes and replaces the read and write calls to persistent fields. Enhancement must be executed on all assemblies containing persistent classes or code that touches public fields of persistent objects
When using one of the Telerik OpenAccess wizards to configure a project, the enhancement is added to the MsBuild project file and no changes are necessary. But there are scenarios in which the OpenAccess Enhancer needs to be integrated manually. This can be done by editing the .csproj (.vbproj) file of the project containing the OpenAccess Context.
Please review your project file and search for this line:
or for VB:
After it, this line must be contained:
If it is not, please add it. For more detailed information please refer to our articles about “Handling Error: No metadata registered for class [AssemblyName.ClassName]”
and “How to: Use OpenAccess ORM Without Installing It”
If the provided solution does not help you, please send us more detailed information about what kind of scenario you are using for mapping to the database and if it is possible send us a code snippet or a little sample, isolating the issue. That way you can help us to reproduce the issue and further investigate it.
I am looking forward to hearing from you.
All the best,
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.