Reflection.Emit-based library that provides stubs, proxies, AOP and magic.
Given a var factory = new VanceStubbs.Factory();:
factory.OfStubs.WhiteHole<T>()- creates an instance ofTthat implements every abstract method and property by throwing aNotImplementedExceptionfactory.OfStubs.BlackHole<T>()- creates an instance ofTthat implements every abstract method and property by returning adefaultand otherwise doing nothing.factory.OfProxies.NotifyChangedProxy<T>(args)- creates an instance ofT(with the passed constructor arguments) that implements every abstract property as a notifying property with a backing field.factory.OfProxies.For<T>()- creates an AOP proxy type builder.new TypeDictionary<Value>(enumerableOfTypeToValueMappings)- creates aIReadOnlyDictionary<Type, Value>that uses overload resolution rules to match a most specific type. (warning: passing atypeof(AbstractNonDefaultConstructibleClass)as a key doesn't currently work. This will change in the future)
All instances can be created either through a static factory or non-static factories. Each dynamically created type is never freed if you use a static factory, therefore it's highly recommended to use a non-static factory if you want to control over memory usage.
Implementation detail: A VanceStubbs.Factory composes over an AssemblyBuilder created with RunAndCollect. These assemblies will be collected if there's no reference to a factory or dynamically created object instances.