Here’s a common question that normally arises when you start to use the new Unity 1.2 interception with PIAB.
Common Facts:
Problem:
Cause and Resolution:
Because you didn’t applied the policies to the container, and that has to be explicit.
And how to it? here’s a simple example:
// Get the PIAB config out of entlib config var configSource = ConfigurationSourceFactory.Create(); var section = (PolicyInjectionSettings)configSource.GetSection(PolicyInjectionSettings.SectionName); // Apply PIAB settings, if any, to the container if (section != null) { section.ConfigureContainer(container, configSource); }
So, we have to get the configuration section, and apply it to the current container. To do so, the PolicyInjectionSettings now exposes a method “ConfigureContainer” which accepts the container to configure.
Other things to be aware
Also be aware that Unity 1.2 has refactored some classes that you might be using in the past if you were integrating Unity and PIAB:
Next post I’ll show how to write a Unity Extension to do this container configuration.