コード例 #1
0
        RegisterView <TView, TModel>(this ContainerBuilder builder)
            where TView : IView where TModel : UiActor
        {
            AutoViewLocation.AddPair(typeof(TView), typeof(TModel));

            builder.RegisterType <TView>().As <TView>().InstancePerDependency();
            return(RegisterModel <TModel>(builder));
        }
コード例 #2
0
        public static IRegistrationBuilder <ViewModelActorRef <TModel>, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterView <TView, TModel>(this ContainerBuilder builder)
            where TView : IView where TModel : UiActor
        {
            AutoViewLocation.AddPair(typeof(TView), typeof(TModel));

            builder.RegisterType <TView>().As <TView>().InstancePerDependency();
            return(builder.RegisterType <ViewModelActorRef <TModel> >().As <IViewModel <TModel> >().Keyed <IViewModel>(typeof(TModel)).InstancePerLifetimeScope()
                   .OnRelease(vm =>
            {
                if (vm.IsInitialized)
                {
                    Tell(vm.Actor, PoisonPill.Instance);
                }
            }));
        }