Share via


Little Know Component Model Gotcha with IDictionaryService

I don’t know how many people in the world this gotcha will affect but I found it very interesting after a conversation with one of the devs internally so I thought I would share the information with those of you out there in the wild.

When you host your own components in a designer or IServiceContainer, the docs for the IDictionaryService state the following :

.NET Framework Class Library

 

IDictionaryService Interface

Provides a basic, component site-specific, key-value pair dictionary through a service that a designer can use to store user-defined data.

For a list of all members of this type, see IDictionaryService Members.

Now the documentation states that the service is for a designer, but in reality, the service has to be per ISite. This problem will not bite you in Everett (.NET 1.1), but in .NET 2.0, the caching is much more aggressive and it will have a type mismatch, especially when you are using the Property Grid.

All that being said, I am telling you this because when Enterprise Library is released and you compile it under .NET 2.0, when you use the designer… it will give you headaches and this is the reason why.

Now playing: Porno for Pyros - Pets