9

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?

Gavin Grant
  • 123
  • 1
  • 1
  • 8

3 Answers3

12

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.

therealmitchconnors
  • 2,732
  • 1
  • 18
  • 36
  • 1
    Wow, thanks so much. This indeed fixed the problem. Strange how all the resources out there (including msdn) use ConfigurationElementType rather than ConfigurationElementTypeAttribute. – Gavin Grant Jun 23 '11 at 18:02
5

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.

Haldrich98
  • 379
  • 3
  • 13
0

Adding Enterprise Library Shared Library assembly to the references of the project worked for me. Then, you can add the using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

mggSoft
  • 992
  • 2
  • 20
  • 35