我正在开发一个项目,其中实体由 NHibernate 映射属性(例如 [Property] 和 [Class])进行修饰。不幸的是,RIAServices 似乎不支持大多数这些属性,这会在 RIAServices 尝试生成 Silverlight 客户端代码时导致失败。
当我尝试构建使用用 [Class] 或 [Property] 属性装饰的实体的 DomainService 时,我收到带有以下错误消息的 ArgumentNullException:
错误 2 “CreateRiaClientFilesTask”任务意外失败。 System.Reflection.TargetInvocationException:调用的目标已引发异常。---> System.ArgumentNullException:值不能为空。 参数名称:TypeName 在 System.RuntimeType.PrivateGetType (字符串类型名称,布尔 throwOnError,布尔 ignoreCase,布尔反射,StackCrawlMark 和 stackMark) 在 System.Type.GetType(字符串类型名称) 在 NHibernate.Mapping.Attributes.ClassAttribute.get_NameType() --- 内部异常堆栈跟踪结束 --- 在 System.RuntimeMethodHandle._InvokeMethodFast(对象目标,Object[] 参数,SignatureStruct& sig,MethodAttributes methodAttributes,RuntimeTypeHandle typeOwner) 在 System.RuntimeMethodHandle.InvokeMethodFast(对象目标,对象 [] 参数,签名 sig,MethodAttributes 方法属性,RuntimeTypeHandle typeOwner) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] 参数,CultureInfo 文化,布尔型 skipVisibilityChecks) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] 参数,CultureInfo 文化) 在 System.Reflection.RuntimePropertyInfo.GetValue(Object obj,BindingFlags invokeAttr,Binder binder,Object[] index,CultureInfo 文化) 在 System.Reflection.RuntimePropertyInfo.GetValue(对象 obj,对象 [] 索引) 在 System.Web.DomainServices.Tools.StandardCustomAttributeBuilder.GetPropertyValues(IEnumerable`1 propertyMaps,属性属性) 在 System.Web.DomainServices.Tools.StandardCustomAttributeBuilder.GetAttributeDeclaration(属性属性) 在 System.Web.DomainServices.Tools.CustomAttributeGenerator.GenerateCustomAttributes(ClientProxyGenerator proxyGenerator,CodeTypeDeclaration referencingType,IEnumerable`1 属性,CodeCommentStatementCollection 注释) 在 System.Web.DomainServices.Tools.CustomAttributeGenerator.GenerateCustomAttributes(ClientProxyGenerator proxyGenerator,CodeTypeDeclaration referencingType,IEnumerable`1 属性,CodeAttributeDeclarationCollection outputCollection,CodeCommentStatementCollection 注释) 在 System.Web.DomainServices.Tools.EntityProxyGenerator.Generate() 在 System.Web.DomainServices.Tools.ClientProxyGenerator.GenerateProxyClass(字符串和生成代码) 在 System.Web.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies() 在 System.Web.DomainServices.Tools.CreateRiaClientFilesTask.Execute() 在 Microsoft.Build.Framework.ITask.Execute() 在 Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) SL
我知道使用 Fluent NHibernate 应该可以解决问题,因为它消除了对 NHibernate 依赖项的需求,但我想首先确保在迁移到 Fluent NHibernate 之前没有任何其他解决方案。关于解决这个问题的任何想法?