1

나는 엔티티가 [Property]와 [Class]와 같은 NHibernate 매핑 속성에 의해 장식되고있는 프로젝트에서 작업하고 있습니다. 불행히도 RIAServices는 이러한 특성 중 대부분을 지원하지 않는 것으로 보여서 RIAServices가 Silverlight 클라이언트 코드를 생성하려고 할 때 오류가 발생합니다.RIA Services는 NHibernate 매핑 속성으로 장식 된 엔티티를 지원하지 않습니까?

 
Error 2 The "CreateRiaClientFilesTask" task failed unexpectedly. 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null. 
Parameter name: TypeName 
at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) 
at System.Type.GetType(String typeName) 
at NHibernate.Mapping.Attributes.ClassAttribute.get_NameType() 
--- End of inner exception stack trace --- 
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) 
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) 
at System.Web.DomainServices.Tools.StandardCustomAttributeBuilder.GetPropertyValues(IEnumerable`1 propertyMaps, Attribute attribute) 
at System.Web.DomainServices.Tools.StandardCustomAttributeBuilder.GetAttributeDeclaration(Attribute attribute) 
at System.Web.DomainServices.Tools.CustomAttributeGenerator.GenerateCustomAttributes(ClientProxyGenerator proxyGenerator, CodeTypeDeclaration referencingType, IEnumerable`1 attributes, CodeCommentStatementCollection comments) 
at System.Web.DomainServices.Tools.CustomAttributeGenerator.GenerateCustomAttributes(ClientProxyGenerator proxyGenerator, CodeTypeDeclaration referencingType, IEnumerable`1 attributes, CodeAttributeDeclarationCollection outputCollection, CodeCommentStatementCollection comments) 
at System.Web.DomainServices.Tools.EntityProxyGenerator.Generate() 
at System.Web.DomainServices.Tools.ClientProxyGenerator.GenerateProxyClass(String& generatedCode) 
at System.Web.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies() 
at System.Web.DomainServices.Tools.CreateRiaClientFilesTask.Execute() 
at Microsoft.Build.Framework.ITask.Execute() 
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) SL 

내가 유창함 자 NHibernate를 사용하는 것을 알고 : 내가에서 [클래스] 장식 법인 또는 [속성] 속성을 사용하는 DomainService을 구축 할 때

, 나는 다음과 같은 오류 메시지가있는 경우 ArgumentNullException를 얻을 수 NHibernate 의존성에 대한 필요성을 없애기 때문에 문제를 해결해야하지만, 먼저 Fluent NHibernate로 이동하기 전에 다른 솔루션이 없는지 확인하고 싶습니다. 이 문제를 푸는 데 어떤 생각이 드나요?

+0

RIA 서비스가 아닌 NameType 속성의 NHibernate.Mapping.Attributes.ClassAttribute 클래스에서 예외가 발생하는 것처럼 보입니다. – Bryant

+0

NHibernate Mapping Attributes가 실제로 예외를 일으킨다. [Class] 애트리뷰트를 제거하면 [Property] 애트리뷰트가 같은 예외를 발생시킨다. 이번엔 "NHibernate.Mapping.Attributes.PropertyAttribute.get_AccessType()"에서 시작한다. 클라이언트 코드 생성 (?)을 디버깅 할 수 없기 때문에 문제가있는 곳을 확인하기가 어렵습니다. RIAServices는 직렬화 가능하지만 모든 NH 매핑 속성을 지원하지 않는 것처럼 보입니다. 속성은 나머지 응용 프로그램에서 문제를 일으키지 않습니다. –

답변

2

의견에서 언급 한 것처럼 문제가 NHibernate에서 코드 생성 중에 발생하는 것처럼 들립니다. 정말로 NHibernate 소스 코드를 얻고 VS 생성기에 VS 생성기를 연결하려고하는 속성을 사용하고 싶다면 왜 실패하고 있는지 파악할 수 있습니다.

아마도 더 좋은 방법은 this post by Brada on using NHibernate with RIA Services 또는 watching this screencast on NHibernate with RIA Services입니다. 두 곳 모두 함께 일하는 실례를 가지고있는 것처럼 보이므로가는 길을 따라 가지 말고 시작하십시오.

+0

코드 생성을 수행중인 VS 인스턴스에 VS 디버거를 연결할 수없는 것 같습니다. 당신이 언급 한 게시물을 알고 있고 두 게시물에서 서로 다른 (더 나은) 매핑 방법을 적용합니다.하지만 Fluent NHibernate (내 상황에서는 많은 시간이 필요합니다)로 전환하기 전에 모든 것이 불가능하다는 것을 확인하고 싶습니다. –

0

실버 라이트 용으로 컴파일 할 때 속성이 누락되지 않도록 프리 프로세서 지시문을 엔티티에 추가 할 수 있습니다.

+0

좋은 해결책 인 것처럼 들리지만 유감스럽게도 여전히 특성을 사용하려고하기 때문에이 방법도 작동하지 않습니다. –

0

우리는 같은 문제가있었습니다. 솔루션 : 속성을 없애고 매핑에 XML을 사용하십시오.

+0

그건 실제로 솔루션입니다, 나는 FuentNHibernate를 automapping과 함께 사용하는 것을 선호합니다 –