NHibernate.Mapping.Attributes icon indicating copy to clipboard operation
NHibernate.Mapping.Attributes copied to clipboard

NHMA-28 - Annotated NHibernate entity classes can not be processed by Silverlight RIA services.

Open nhibernate-bot opened this issue 7 years ago • 0 comments

Sergey Udovenko created issue - 12/Nov/09 8:20 PM

Silverligh RIA Services internal code generator fails on attempt to process annotated NHibernate entities.

It appears that RIA Services code generator tries to read annotation attributes before the annotation class is properly initialized.

Here is a typical error spot from ClassAttribute.cs (there are many more of them):

public virtual System.Type NameType
{
	get
	{
		return System.Type.GetType( this.Name );
	}
        ...
}

The GetType() method throws a NPE because the Name is null.

A simple fix that worked for me was just to check the name for null value before calling the GetType:

return this.Name != null? System.Type.GetType( this.Name ) : null;

nhibernate-bot avatar May 18 '17 23:05 nhibernate-bot