Autofac OnActivated for all registrations

Nowadays, I’m working with WPF using MVVM pattern. To manage NHibernate session in viewmodels, I’m using the approach shown by Ayende, where session is a property of viewmodel. The problem is simple – sessions need to be disposed of and replaced after they throw an exception. That means we cannot use constructors to inject sessions … More Autofac OnActivated for all registrations

Implementing factories for Dependency Injection

With Dependency Injection you typically inject an instance through constructor or property. That means that the whole dependency tree is resolved at once. In some cases, however, it is not acceptable and you need to control the creation of object instances from inside of a class. That’s when the need for object factories arises. Instead … More Implementing factories for Dependency Injection

A more extensible way to build plugin system

A plugin, for those, who don’t know, is a component, that allows to extend an application without modifying it’s source code. The application loads plugins at runtime. In .NET it’s pretty easy to accomplish using Reflection capabilities. The easy way is to expose interfaces in your application assemblies, that the plugin can implement and use, … More A more extensible way to build plugin system