示例#1
0
        private ServiceFactory(
            IInfrastructureAgentWrapper infrastructureServiceAgent,
            IConfigStore configStore,
            string configSectionName,
            FactoryConfigUpdateHandler configUpdateHandler)
        {
            this.infrastructureServiceAgent = infrastructureServiceAgent;
            this.configStore         = configStore.Validate("configStore");
            this.configSectionName   = configSectionName;
            this.configUpdateHandler = configUpdateHandler;

            this.coordinatorFactoryMap.Add("Disabled", this.CreateCoordinatorNull);
            this.coordinatorFactoryMap.Add("Test", this.CreateCoordinatorTest);
            this.coordinatorFactoryMap.Add("ServerRestart", this.CreateCoordinatorServerRestart);
            this.coordinatorFactoryMap.Add("AzureSerial", this.CreateCoordinatorAzureSerial);
            this.coordinatorFactoryMap.Add("AzureParallel", this.CreateCoordinatorAzureParallel);
            this.coordinatorFactoryMap.Add("AzureParallelDisabled", this.CreateCoordinatorAzureParallelDisabled);
            this.coordinatorFactoryMap.Add("AzureAutodetect", this.CreateCoordinatorAzureAutodetect);
            this.coordinatorFactoryMap.Add("Dynamic", this.CreateCoordinatorDynamic);
        }
示例#2
0
        public static ServiceFactory CreateAndRegister()
        {
            try
            {
                IInfrastructureAgentWrapper agent = new InfrastructureAgentWrapper();

                var configUpdateHandler       = new FactoryConfigUpdateHandler();
                NativeConfigStore configStore = NativeConfigStore.FabricGetConfigStore(configUpdateHandler);

                ServiceFactory factory = new ServiceFactory(agent, configStore, null, configUpdateHandler);

                agent.RegisterInfrastructureServiceFactory(factory);

                return(factory);
            }
            catch (Exception ex)
            {
                TraceType.WriteError("Error registering infrastructure service factory. Cannot continue further. Exception: {0}", ex);
                throw;
            }
        }