コード例 #1
0
        public static void ConfigureServices(ClientConfiguration clientConfiguration,
                                             IServiceCollection services)
        {
            ILegacyGatewayListProviderConfigurator configurator = null;

            switch (clientConfiguration.GatewayProviderToUse)
            {
            case ClientConfiguration.GatewayProviderType.AzureTable:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(
                    Constants.ORLEANS_CLUSTERING_AZURESTORAGE);
                break;

            case ClientConfiguration.GatewayProviderType.SqlServer:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(Constants.ORLEANS_CLUSTERING_ADONET);
                break;

            case ClientConfiguration.GatewayProviderType.Custom:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(
                    clientConfiguration.CustomGatewayProviderAssemblyName);
                break;

            case ClientConfiguration.GatewayProviderType.ZooKeeper:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(
                    Constants.ORLEANS_CLUSTERING_ZOOKEEPER);
                break;

            case ClientConfiguration.GatewayProviderType.Config:
                configurator = new LegacyStaticGatewayProviderConfigurator();
                break;

            default:
                break;
            }
            configurator?.ConfigureServices(clientConfiguration, services);
        }
コード例 #2
0
        public static void ConfigureServices(
            ClientConfiguration clientConfiguration,
            IServiceCollection services)
        {
            // If a gateway list provider has already been configured in the service collection, use that instead.
            if (services.Any(reg => reg.ServiceType == typeof(IGatewayListProvider)))
            {
                return;
            }

            ILegacyGatewayListProviderConfigurator configurator = null;

            switch (clientConfiguration.GatewayProviderToUse)
            {
            case ClientConfiguration.GatewayProviderType.AzureTable:
            {
                string assemblyName = Constants.ORLEANS_CLUSTERING_AZURESTORAGE;
                configurator = LegacyAssemblyLoader.LoadAndCreateInstance <ILegacyGatewayListProviderConfigurator>(assemblyName);
            }
            break;

            case ClientConfiguration.GatewayProviderType.AdoNet:
            {
                string assemblyName = Constants.ORLEANS_CLUSTERING_ADONET;
                configurator = LegacyAssemblyLoader.LoadAndCreateInstance <ILegacyGatewayListProviderConfigurator>(assemblyName);
            }
            break;

            case ClientConfiguration.GatewayProviderType.Custom:
            {
                string assemblyName = clientConfiguration.CustomGatewayProviderAssemblyName;
                configurator = LegacyAssemblyLoader.LoadAndCreateInstance <ILegacyGatewayListProviderConfigurator>(assemblyName);
            }
            break;

            case ClientConfiguration.GatewayProviderType.ZooKeeper:
            {
                string assemblyName = Constants.ORLEANS_CLUSTERING_ZOOKEEPER;
                configurator = LegacyAssemblyLoader.LoadAndCreateInstance <ILegacyGatewayListProviderConfigurator>(assemblyName);
            }
            break;

            case ClientConfiguration.GatewayProviderType.Config:
                configurator = new LegacyStaticGatewayProviderConfigurator();
                break;

            default:
                break;
            }
            configurator?.ConfigureServices(clientConfiguration, services);
        }
コード例 #3
0
        public static void ConfigureServices(
            ClientConfiguration clientConfiguration,
            IServiceCollection services)
        {
            // If a gateway list provider has already been configured in the service collection, use that instead.
            if (services.Any(reg => reg.ServiceType == typeof(IGatewayListProvider)))
            {
                return;
            }

            ILegacyGatewayListProviderConfigurator configurator = null;

            switch (clientConfiguration.GatewayProviderToUse)
            {
            case ClientConfiguration.GatewayProviderType.AzureTable:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(
                    Constants.ORLEANS_CLUSTERING_AZURESTORAGE);
                break;

            case ClientConfiguration.GatewayProviderType.SqlServer:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(Constants.ORLEANS_CLUSTERING_ADONET);
                break;

            case ClientConfiguration.GatewayProviderType.Custom:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(
                    clientConfiguration.CustomGatewayProviderAssemblyName);
                break;

            case ClientConfiguration.GatewayProviderType.ZooKeeper:
                configurator = CreateInstanceWithParameterlessConstructor <ILegacyGatewayListProviderConfigurator>(
                    Constants.ORLEANS_CLUSTERING_ZOOKEEPER);
                break;

            case ClientConfiguration.GatewayProviderType.Config:
                configurator = new LegacyStaticGatewayProviderConfigurator();
                break;

            default:
                break;
            }
            configurator?.ConfigureServices(clientConfiguration, services);
        }