As part of MicroLite 3.0, two new interfaces were added to the MicroLite.Infrastructure namespace:
IHaveSession
and IHaveReadOnlySession
These interfaces are implemented by the controllers in the ASP.NET MVC and ASP.NET WebApi extensions and the MicroLiteSessionAttribute
for each extension checks against the interfaces rather than the base controllers.
This means that if you want to, you can use the extensions without having to inherit from the base controllers.
// Instead of having to do this: public HomeController : MicroLiteController { ... } // You can do this: public HomeController : SomeOtherController, IHaveSession { ... }
This allows you to use the extensions in a scenario where you cannot control the base controller you are using or if you just don’t want to have to inherit from the base MicroLite controller for any reason.