我正在尝试为企业库5.0的异常处理块创建自定义异常处理程序。据我所知,我需要使用属性 “[ConfigurationElementType(typeof(CustomHandlerData))]”启动课程。但是我得到一个错误,指出ConfigurationElementType不是一个属性类。错误:使用ConfigurationElementType属性时“不是属性类”
有谁知道可能会发生什么?
我正在尝试为企业库5.0的异常处理块创建自定义异常处理程序。据我所知,我需要使用属性 “[ConfigurationElementType(typeof(CustomHandlerData))]”启动课程。但是我得到一个错误,指出ConfigurationElementType不是一个属性类。错误:使用ConfigurationElementType属性时“不是属性类”
有谁知道可能会发生什么?
尝试在ConfigurationElementType之后添加关键字属性。这不是必需的,但这可能会让你得到一个更有用的错误信息......我的猜测是你缺少引用......这总是EntLib的问题。
一定要在项目添加引用.Net选项卡下将对System.ComponentModel.Compostion或Sytem.ComponentModel.DataAnnotations的引用添加到您的项目。
然后你应该可以包含'using System.ComponentModel;'在你的项目中让你的属性正常工作。
将System.ComponentModel.Compostion添加到为我工作的引用。 –
添加system.Web.mvc为我工作 –
将Enterprise Library Shared Library程序集添加到为我工作的项目的引用中。然后,你可以添加使用Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
哇,非常感谢。这确实解决了这个问题。奇怪的是,所有的资源(包括msdn)如何使用ConfigurationElementType而不是ConfigurationElementTypeAttribute。 –