protected override void Load(ContainerBuilder builder) { var assembly = IntrospectionExtensions.GetTypeInfo(typeof(ServiceModule)) .Assembly; builder.RegisterAssemblyTypes(assembly) .Where(x => x.IsAssignableTo <IService>()) .AsImplementedInterfaces() .InstancePerLifetimeScope(); }
protected override void Load(ContainerBuilder builder) { base.Load(builder); builder.RegisterAssemblyTypes(IntrospectionExtensions.GetTypeInfo(typeof(PortableDepenedenciesModule)).Assembly) .AssignableTo <IBaseViewModel>() .As <IBaseViewModel, BaseViewModel>() .AsSelf() .OnActivating(e => { var navi = e.Context.Resolve <INavigationService>(); (e.Instance as INavigationServiceInjector)?.Inject(navi); }); }
protected override void Load(ContainerBuilder builder) { var assembly = IntrospectionExtensions.GetTypeInfo(typeof(CommandModule)) .Assembly; builder.RegisterAssemblyTypes(assembly) .AsClosedTypesOf(typeof(ICommandHandler <>)) .InstancePerLifetimeScope(); builder.RegisterType <CommandDispatcher>() .As <ICommandDispatcher>() .InstancePerLifetimeScope(); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <AutofacCommandsFactory>().As <ICommandsFactory>().SingleInstance(); builder.RegisterType <CommandsDispatcher>().As <ICommandsDispatcher>().SingleInstance(); var commandType = typeof(ICommand <>); var asyncCommandType = typeof(IAsyncCommand <>); var dataAccess = IntrospectionExtensions.GetTypeInfo(typeof(BaseDbCommand)).Assembly; builder.RegisterAssemblyTypes(dataAccess) .Where(x => TypeExtensions.GetInterfaces(x) .SingleOrDefault(i => TypeExtensions.GetGenericArguments(i).Length > 0 && (i.GetGenericTypeDefinition() == commandType || i.GetGenericTypeDefinition() == asyncCommandType)) != null) .AsImplementedInterfaces() .SingleInstance(); }