Eric's Blog

Day to day experience in .NET
Welcome to Blogs @ IRM Sign in | Join | Help
 Search

Disclaimer

The content of this site is my own personal opinion and does not in any way represent my employer, it's subsideries or affiliates. These postings are provided "AS IS" with no warranties, and confer no rights.

This Blog

Moving up to .NET 2.0

I'm working on upgrading a big project to .NET 2.0. It has gone smoothly so far, with one exception: configuration. This is probably mostly because I had build all the configuration on EntLib 1.1. One of the goals for EntLib is to show best practices on the platform. With version 2.0 of .NET, the configuration have been extended a lot, for example with support for writing. This means that p&p have changed their configuration block and that affects my configuration code a lot. This have taken my a while to get fixed, but that part is finished now. Oh … I also promised to get back if there were any more required code changes to the ExceptionHandlers I've written, and there are one according to configuration (surprise).
The class shall be marked with a ConfigurationElementTypeAttribute and point out which configuration handler (class) should be used. I have chosen to use the CustomHandlerData (included in EntLib 2), even though I don't need any special configuration for my handlers.
 
[ConfigurationElementTypeAttribute(typeof(CustomHandlerData))]
 
When the CustomHandlerData is used you will also have to add a constructor that takes a NameValueCollection parameter (which will contain the custom configuration if you have).
 
I have also upgraded two services so far (one entity service and one activity service) without changing any lines of code. Something that I have changed though is project structures, since that get changed by the upgrade wizard (for web projects). One example of change I've been doing is to move the strong name signing from the AssemblyInfo into the project properties.
Published den 10 oktober 2005 22:08 by ericqu

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Deo said:

I have been struggling with the error and this info is very usefully. I am quite new to Entlib. Can you elaborate more what "When the CustomHandlerData is used you will also have to add a constructor that takes a NameValueCollection parameter (which will contain the custom configuration if you have)." means? Example of the constructor signature?

Thanks!
december 8, 2005 02:39
 

ericqu said:

The constructor should look like this:

public class SoapClientExceptionHandler
{
public SoapClientExceptionHandler(NameValueCollection attributes)
{
}
}

This also means that it is possible to add your own attributes to the configuration node. You will get this attributes and their values in the attributes parameter.

I hope this helps, or else post here again :)
december 9, 2005 14:58

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems