TylerBrinks/Snap — pull request #20 by samoshkin (2011-10-20 22:05:12+00:00)
Title: Fix: Snap generating fresh dynamic assemblies each invocation

This is a fix to https://github.com/TylerBrinks/Snap/issues/19.

Buggy behavior:

Snap loads two new assemblies: DynamicProxyGenAssembly2 (unsigned) and DynamicProxyGenAssembly2 (signed) in current app domain every time dynamic proxy is created via ProxyGenerator class.

Fixed behavior.

Snap will generate DynamicProxyGenAssembly2 per each container configuration instead.
That is, pair of DynamicProxyGenAssembly2(singed and unsigned) for LinFu container configuration.

SnapConfiguration.For(new LinFuAspectContainer(container)).Configure(c =>
{
...
}

Pair of DynamicProxyGenAssembly2 for Autofac container configuration.

SnapConfiguration.For(new AutofacAspectContainer(builder)).Configure(c =>
{
...
}

Usually, as you are using your single favorite container, you will end up with only single pair of DynamicProxyGenAssembly2 loaded to the app domain.

Also, I've refactored AspectUtility static class and extract ProxyFactory class from it.