Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: "is not an attribute class" when using ConfigurationElementType attribute

I'm trying to create a custom exception handler for the exception handling block of enterprise library 5.0. As far as I understand I need to start the class off with the attribute "[ConfigurationElementType(typeof(CustomHandlerData))]". But I get an error stating the ConfigurationElementType is not an attribute class.

Does anyone know what might be going on?

like image 822
Gavin Grant Avatar asked Jun 23 '11 17:06

Gavin Grant


2 Answers

Try adding the keyword Attribute after ConfigurationElementType. It is not required, but this may get you to a more helpful error message... my guess would be that you are missing references... that's always the problem with EntLib.

like image 63
therealmitchconnors Avatar answered Oct 15 '22 21:10

therealmitchconnors


Be sure to add the reference to the System.ComponentModel.Compostion or Sytem.ComponentModel.DataAnnotations to your project under Project-Add References .Net tab.

Then you should be able to include 'using System.ComponentModel;' in your project to get your attributes working properly.

like image 29
Haldrich98 Avatar answered Oct 15 '22 22:10

Haldrich98