Patch for Partial Trust support in Enterprise Library for .NET 2.0

While we know that Enterprise Library appeals to a wide range of developers, our core target has always been enterprise development teams and systems integrators. So as we designed and tested the blocks, we had the notion that the code was probably going to be deployed in a corporate data center where the project team has a lot of control over the environment.

Well it turned out that this assumption didn't hold for a significant number of Enterprise Library users who have tried to deploy applications in environments configured to run applications with partial trust. Often this was because these projects were deployed into hosted ASP.NET environments that the developer couldn't influence - while this situation doesn't fit our standard "enterprise development" model, it's great that people find Enterprise Library valid in these types of scenarios. In addition, we've heard that even within the corporate data center, some organizations are starting to run applications under partial trust to provide improved security.

But whatever the motivation for wanting to use Enterprise Library in this kind of environment, the reality was the same - it didn't work. Enterprise Libary uses certain .NET features that require full trust to run, and the January 2006 release demands these permissions at the assembly level, which means if the permissions can't be obtained, the assemblies are not allowed to run. So it was full trust or nothing.

The good news is that we just released a patch (creatively titled Patch 2554) to the Enterprise Library Community site which allows Enterprise Library to run under partial trust. We did this by taking away the assembly-level demands, so the need for various code access security permissions is isolated to the codepaths that actually use those permissions. In addition, where possible we updated the code to "degrade gracefully" if the permissions couldn't be obtained, rather than fail outright. Depending on which features of Enterprise Library you need to use, you will require a different set of permissions which may or may not be available in your environment - we couldn't get around this as these permissions are required by the .NET features that the code uses. However with this patch it should be possible to deploy Enterprise Library-based applications in many new environments.

Note that while deploying the patch shouldn't cause any problems for applications running under full trust, it won't provide any benefits either - so there is no need to apply the patch unless you wish to run under partial trust. We do plan on supporting partial trust scenarios out-of-the-box in the next release of Enterprise Library.

Enjoy!

This posting is provided "AS IS" with no warranties, and confers no rights.