Register classes derived off IViewFor for D-I, when located in 2 assemblies?

8 views
Skip to first unread message

Mark Pawelek

unread,
Feb 13, 2019, 10:03:00 AM2/13/19
to ReactiveUI mailing list
In the sample WPF ReactiveUI Application <https://reactiveui.net/docs/getting-started/>, one has to "register all classes that derive off IViewFor into our dependency injection container". 

namespace ReactiveDemo
{
    using System;
    using System.Linq;
    using System.Reflection;
    using System.Windows;
    using ReactiveUI;
    using Splat;

    public partial class App : Application
    {
        public App()
        {
            // register all classes that derive off IViewFor into our dependency injection container
            Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
        }
    }
}

I'm wrting a mixed WinForms / WPF application. The main program is a Windows.Application, and the WPF windows exist in a class library. (a "WPF Custom Control Library").

I have not been using a D-I container up till now. I'm trying to add ReactiveUI for both WinForms and WPF views; as and when required for new features. So I have classes in 2 assemblies deriving from IViewFor.

Can I still use Splat to do this?  Is there an easy way?

Reply all
Reply to author
Forward
0 new messages