Autofac and ServiceStack

I finally decided to put this integration to a NuGet package.

There are two versions now:

  • The first version (1.0.1) supports ServiceStack V3, which remains a free version
Install-Package Autofac.Extras.ServiceStack -Version 1.0.1
  • Version 2.0 supports ServiceStack version 4
Install-Package Autofac.Extras.ServiceStack

The repository is on GitHub

Autofac and ServiceStack - Managing Life Cycle [3]

In the [previous part](../autofac-and-servicestack-managing-life.html) I suggested storing current scope in a static property. This seems to break under higher load because the scope is shared across too many instances of the same service and after the first request it gets disposed, leaving all other requests with dependencies from the disposed scope in unknown state, i.e. closed database session. After some more digging I found a way that really works. [Read More]

Autofac and ServiceStack - Managing Life Cycle [2]

Warning: this is not working properly, check the latest version for better solution. Whilst the approach I used in the previous post is working fine for ASP.NET based ServiceStack solutions, it does not fit for the self-hosted approach since the request handling is done differently there. To solve this issue, I tried to find ServiceStack native request/response hooks and the first thing I tried was a custom service runner with overrides for OnBeforeExecute and OnAfterExecute as described here. [Read More]

Autofac and ReactiveUI 6

Today, I updated my previous helper class that replaced the standard RxUI service locator with Autofac container. ReactiveUI 6 introduced some breaking changes and I had to update the code to make it work. Basically, RxApp has no method to register a custom resolver. Instead, it always uses the ModernDependencyResolver locator from Splat. However, this locator can work with any other type of resolver that implements IMutableDependencyResolver interface. There is one new member in this interface, ServiceRegistrationCallback, which is used nowhere in RxUI6 so I didn't bother implementing it. [Read More]

Autofac and ReactiveUI

Update I published a new post about using Autofac with ReactiveUI 6. ReactiveUI uses an internal dependency resolver. Most of the cases are covered by it and it also can be used to resolve references other that ReactiveUI internal interfaces. However, if you want to use another container to inject constructor parameters or properties, you have to have your view models and views to be registered and resolved by a container. [Read More]