/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { var baseConfig = EventStoreConfig.GetConfig(); var promotionsConfig = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user1Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user2Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); //SingleMicroserviceInitializer.Run( // container, () => MicroserviceFactory<UserManagement, UserManagementHandler> // .CreateEventProcessorWithApp<UserAppService>(container, userConfig), // !_isConsoleApp); MultiMicroserviceInitializer.Run(container, () => { var services = new List <IMicroservice>(); UserContainer1 = ContainerFactory.ResolveDependenciesForNewChildContainer(container); services.Add(MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessorWithApp <UserAppService>("user1", "user1_app", UserContainer1, user1Config, plugin, SetupInMemoryPersistence <UserManagement>)); UserContainer2 = ContainerFactory.ResolveDependenciesForNewChildContainer(container); services.Add(MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessorWithApp <UserAppService>("user2", "user2_app", UserContainer2, user2Config, plugin, SetupInMemoryPersistence <UserManagement>)); PromotionsContainer = ContainerFactory.ResolveDependenciesForNewChildContainer(container); services.Add(MicroserviceFactory <Promotions, PromotionsHandler> . CreateEventProcessor("promo", PromotionsContainer, promotionsConfig, plugin, SetupInMemoryPersistence <Promotions>)); return(services); }, false, Program.VerboseIsEnabled); }
/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { var baseConfig = EventStoreConfig.GetConfig(); var promotionsConfig = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user1Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user2Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); StatsMonitor = new StatsMonitor(); EventSystem.Create( MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessor("user1", user1Config, null, plugin, persistIncomingEvents, false, SetupInMemoryPersistence <UserManagement>), MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessor("user2", user2Config, null, plugin, persistIncomingEvents, false, SetupInMemoryPersistence <UserManagement>), MicroserviceFactory <Promotions, PromotionsHandler> . CreateEventProcessor("promo", promotionsConfig, null, plugin, persistIncomingEvents, false, SetupInMemoryPersistence <Promotions>, (consumer, serializer, payload) => { var e = serializer.Deserialize <IEvent>(payload); if (e is FreePointsRewardedToUser) { return(false); } return(true); })); }