public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { base.Initialize(name, config); _client = ProviderHelper.GetClient(name, config, () => (ICouchbaseClientFactory) new CouchbaseClientFactory()); ProviderHelper.CheckForUnknownAttributes(config); }
/// <summary> /// Function to initialize the provider /// </summary> /// <param name="name">Name of the element in the configuration file</param> /// <param name="config">Configuration values for the provider from the Web.config file</param> public override void Initialize( string name, NameValueCollection config) { base.Initialize(name, config); client = ProviderHelper.GetClient(name, config, () => (ICouchbaseClientFactory) new CouchbaseClientFactory(), out disposeClient); ProviderHelper.CheckForUnknownAttributes(config); }
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { // Initialize the base class base.Initialize(name, config); // Create our Couchbase client instance _client = ProviderHelper.GetClient(name, config, () => (ICouchbaseClientFactory) new CouchbaseClientFactory(), out _disposeClient); if (_isFirstTimeInitialization) { lock (FirstTimeInitializationSync) { if (_isFirstTimeInitialization) { var loggingEnabled = ProviderHelper.GetAndRemove(config, "logging", false) ?? "false"; _isLoggingEnabled = (String.Compare(loggingEnabled, "true", StringComparison.OrdinalIgnoreCase) == 0); if (_isLoggingEnabled) { // Path where to store NLog logs (effective if useExistedLoggingConfig != "true") var loggingFileName = ProviderHelper.GetAndRemove(config, "loggingFilename", false) ?? "Logs/CouchbaseSessionStateProvider.log"; // useExistedLoggingConfig = "true" to use existed application NLog config file // or useExistedLoggingConfig = "false" (or just skip this config) to configure NLog in Couchbase provider and override application settings (if exists) var useExistedLoggingConfigString = ProviderHelper.GetAndRemove(config, "useExistedLoggingConfig", false) ?? "false"; var useExistedLoggingConfig = (String.Compare(useExistedLoggingConfigString, "true", StringComparison.OrdinalIgnoreCase) == 0); _logger = SetupLogger(useExistedLoggingConfig, loggingFileName); } // By default use exclusive session access. But allow it to be overridden in the config file var exclusive = ProviderHelper.GetAndRemove(config, "exclusiveAccess", false) ?? "true"; _exclusiveAccess = (String.Compare(exclusive, "true", StringComparison.OrdinalIgnoreCase) == 0); // By default do not use compression on session data var compress = ProviderHelper.GetAndRemove(config, "compress", false) ?? "false"; _compressData = (String.Compare(compress, "true", StringComparison.OrdinalIgnoreCase) == 0); if (_compressData) { // By default we use lz4 instead of gzip, because it is considered much faster! var compressionTypeString = ProviderHelper.GetAndRemove(config, "compressionType", false) ?? "quicklz"; _compressor = CompressorFactory.Create(compressionTypeString); } LogProviderConfiguration(); // Make sure no extra attributes are included ProviderHelper.CheckForUnknownAttributes(config); _isFirstTimeInitialization = false; } } } }
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { // Initialize the base class base.Initialize(name, config); // Create our Couchbase client instance client = ProviderHelper.GetClient(name, config, () => (ICouchbaseClientFactory) new CouchbaseClientFactory(), out disposeClient); // By default use exclusive session access. But allow it to be overridden in the config file var exclusive = ProviderHelper.GetAndRemove(config, "exclusiveAccess", false) ?? "true"; exclusiveAccess = (String.Compare(exclusive, "true", true) == 0); // Make sure no extra attributes are included ProviderHelper.CheckForUnknownAttributes(config); }