|
Unity Interception is implemented as a UnityContainerExtension and it is not added by default (all of the logic is in a separate assembly).
I'm not sure if you can 100% remove method and property injection (I wasn't able to do it but perhaps someone else has?). I was able to swap out the default implementation with another so that the overhead would be minimal:
class Program
{
static void Main(string[] args)
{
UnityContainer container = new UnityContainer();
container.AddNewExtension<RemoveContainerExtension>();
var x = container.Resolve<MyClass>();
}
}
public class RemoveContainerExtension : UnityContainerExtension
{
protected override void Initialize()
{
Context.Policies.SetDefault<IPropertySelectorPolicy>(new MyPropertySelector());
Context.Policies.SetDefault<IMethodSelectorPolicy>(new MyMethodSelector());
}
public class MyMethodSelector : IMethodSelectorPolicy
{
public IEnumerable<SelectedMethod> SelectMethods(IBuilderContext context, IPolicyList resolverPolicyDestination)
{
return Enumerable.Empty<SelectedMethod>();
}
}
public class MyPropertySelector : IPropertySelectorPolicy
{
public IEnumerable<SelectedProperty> SelectProperties(IBuilderContext context, IPolicyList resolverPolicyDestination)
{
return Enumerable.Empty<SelectedProperty>();
}
}
}
Another approach would be to download and modify the source code to do exactly what you want.
--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com
|