« Dll heaven: Executing multiple versions of the same assembly | Main | New* .NET 3.5 Feature: AddIn Framework Resources (Part 2 of 2) »

January 20, 2008

New* .NET 3.5 Feature: AddIn Framework ( Part 1 of 2 )

2ne of the new items that were included in the .NET 3.5 framework is a built in way to add extensibility to your application using add-ins, also known as plug-in. Many of us have already added extensibility in our own application using interfaces. However this framework comes with a few built in features for addin lifetime management, security isolations etc.

Sandbox Isolation

If we want to add termination features to an addin we would need to load it to to different appdomain since we may want to unload it or reload it when any error happens. Also when the addin runs in a separate domain space it is less likely to corrupt any part of the application.

sandbox

Please also note that when an addin is unloaded, the unloading causes the other assemblies to be unloaded as well on which the addin is dependent upon. This happens because the AppDomain is unloaded.

Discovery

The new framework also supports discovery of addins within a folder. Also you can also search for a certain addin. According to the documentation each addin has its own folder and its own set of assemblies.

Security

The security of the sandboxed addin can be created when we create the application domain for the addin to run on or we can even use the policy level security to control the addin behavior.

Versioning

Versioning is provided via contract isolation, both the addin host and the addin itself can version independently of each other. A concept of adapter assembly is present for both the add in and the host so that the implementation can change independently.

Termination

Due to running the addin in different AppDomain boundary termination of the AppDomain automatically clears memory and all other resources. However if we needed to do this manually then we would have to find the application domain that hosts the assembly and unload it. The framework provides a nifty class to unload the addin and its AppDomain

AddInController.GetAddInController(addin).Shutdown();

Next

Related Post:

Dll heaven: Executing multiple versions of the same assembly

kick it on DotNetKicks.com

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54ee5d547883300e5501a46b48833

Listed below are links to weblogs that reference New* .NET 3.5 Feature: AddIn Framework ( Part 1 of 2 ):

Comments

Nice post, thanks for introducing this argument.
Maybe in the future you could add some practical examples about best practices related to this feature :)

Ok, sorry, obviously today I'm blind :)
I totally missed the "Next" paragraph ;)

Yes, I am working on that ... will be in the next post

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Feeds

Pages