alexeyzimarev / ReactiveUI.Autofac

Autofac adapter for ReactiveUI
4 stars 4 forks source link

Target the newest version of ReactiveUI #5

Open RwSgxx opened 5 years ago

RwSgxx commented 5 years ago

In the latest version of reactiveui there are 2 new functions for IMutableDependencyResolver. public void UnregisterCurrent(Type serviceType, string contract = null) { throw new NotImplementedException(); }

    public void UnregisterAll(Type serviceType, string contract = null)
    {
        throw new NotImplementedException();
    }
alexeyzimarev commented 5 years ago

I don't think it is possible. Not only Autofac doesn't support deregistration, but the Update method will also no longer be supported by Autofac in the future.

Autofac, like any other DI container, only supports static registrations. When the container is built, it should and can not be modified.

ReactiveUI, however, uses Splat, which is a dynamic service resolver. Splat aims for no start-up time because it is more important for apps to start faster and tolerate small delays when resolving services.

My suggestion would be stick to Splat.

NPadrutt commented 5 years ago

Does that mean that this way of using autofac won't be available with the latest reactiveUI version? Currently I always the the following excpetion on startup when I call UseAutofacDependencyResolver

Method 'UnregisterCurrent' in type 'ReactiveUI.Autofac.AutofacDependencyResolver' from assembly 'ReactiveUI.Autofac, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.