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

Testing email functionality in development environment

Many of the systems I have been working on required sending email messages as part of certain use cases: email address confirmation, notifications, system monitoring reports, etc. When working for a company, I usually use their SMTP server to send testing emails when running in the development environment. But for my own projects, that’s not … More Testing email functionality in development environment

Creating .In and .NotIn extension methods for NHibernate 3 Linq provider

In Bringing the IN clause from SQL to C# I have shown how to create extension methods for C# that mimic the “in” clause from SQL. I like these methods a lot, but they cannot be used in Linq to NHibernate queries, because it cannot interpret them by default. Luckily, it’s not that hard to … More Creating .In and .NotIn extension methods for NHibernate 3 Linq provider