Exemple #1
0
        /// <summary>
        /// Registers a given type of <typeparamref name="T"/> where <typeparamref name="T"/> is stream provider
        /// </summary>
        /// <typeparam name="T">Non-abstract type which implements <see cref="Orleans.Streams.IStreamProvider"/> stream</typeparam>
        /// <param name="providerName">Name of the stream provider</param>
        /// <param name="properties">Properties that will be passed to stream provider upon initialization</param>
        public void RegisterStreamProvider <T>(string providerName, IDictionary <string, string> properties = null) where T : Orleans.Streams.IStreamProvider
        {
            Type providerTypeInfo = typeof(T).GetTypeInfo();

            if (providerTypeInfo.IsAbstract ||
                providerTypeInfo.IsGenericType ||
                !typeof(Orleans.Streams.IStreamProvider).IsAssignableFrom(providerTypeInfo))
            {
                throw new ArgumentException("Expected non-generic, non-abstract type which implements IStreamProvider interface", "typeof(T)");
            }

            ProviderConfigurationUtility.RegisterProvider(ProviderConfigurations, ProviderCategoryConfiguration.STREAM_PROVIDER_CATEGORY_NAME, providerTypeInfo.FullName, providerName, properties);
        }
Exemple #2
0
        /// <summary>
        /// Registers a given type of <typeparamref name="T"/> where <typeparamref name="T"/> is bootstrap provider
        /// </summary>
        /// <typeparam name="T">Non-abstract type which implements <see cref="IBootstrapProvider"/> interface</typeparam>
        /// <param name="providerName">Name of the bootstrap provider</param>
        /// <param name="properties">Properties that will be passed to bootstrap provider upon initialization</param>
        public void RegisterBootstrapProvider <T>(string providerName, IDictionary <string, string> properties = null) where T : IBootstrapProvider
        {
            Type providerType = typeof(T);

            if (providerType.IsAbstract ||
                providerType.IsGenericType ||
                !typeof(IBootstrapProvider).IsAssignableFrom(providerType))
            {
                throw new ArgumentException("Expected non-generic, non-abstract type which implements IBootstrapProvider interface", "typeof(T)");
            }

            ProviderConfigurationUtility.RegisterProvider(ProviderConfigurations, ProviderCategoryConfiguration.BOOTSTRAP_PROVIDER_CATEGORY_NAME, providerType.FullName, providerName, properties);
        }
Exemple #3
0
        public void RegisterStatisticsProvider <T>(string providerName, IDictionary <string, string> properties = null) where T : IStatisticsPublisher, IClientMetricsDataPublisher
        {
            TypeInfo providerTypeInfo = typeof(T).GetTypeInfo();

            if (providerTypeInfo.IsAbstract ||
                providerTypeInfo.IsGenericType ||
                providerTypeInfo.IsGenericType ||
                !(
                    typeof(IStatisticsPublisher).IsAssignableFrom(typeof(T)) &&
                    typeof(IClientMetricsDataPublisher).IsAssignableFrom(typeof(T))
                    ))
            {
                throw new ArgumentException("Expected non-generic, non-abstract type which implements IStatisticsPublisher, IClientMetricsDataPublisher interface", "typeof(T)");
            }

            ProviderConfigurationUtility.RegisterProvider(ProviderConfigurations, ProviderCategoryConfiguration.STATISTICS_PROVIDER_CATEGORY_NAME, providerTypeInfo.FullName, providerName, properties);
        }
Exemple #4
0
 /// <summary>
 /// Registers a given stream provider.
 /// </summary>
 /// <param name="providerTypeFullName">Full name of the stream provider type</param>
 /// <param name="providerName">Name of the stream provider</param>
 /// <param name="properties">Properties that will be passed to the stream provider upon initialization </param>
 public void RegisterStreamProvider(string providerTypeFullName, string providerName, IDictionary <string, string> properties = null)
 {
     ProviderConfigurationUtility.RegisterProvider(ProviderConfigurations, ProviderCategoryConfiguration.STREAM_PROVIDER_CATEGORY_NAME, providerTypeFullName, providerName, properties);
 }
 /// <summary>
 /// Registers a given bootstrap provider.
 /// </summary>
 /// <param name="providerTypeFullName">Full name of the bootstrap provider type</param>
 /// <param name="providerName">Name of the bootstrap provider</param>
 /// <param name="properties">Properties that will be passed to the bootstrap provider upon initialization </param>
 public static void RegisterBootstrapProvider(this GlobalConfiguration config, string providerTypeFullName, string providerName, IDictionary <string, string> properties = null)
 {
     ProviderConfigurationUtility.RegisterProvider(config.ProviderConfigurations, BOOTSTRAP_PROVIDER_CATEGORY_NAME, providerTypeFullName, providerName, properties);
 }