/// <summary> /// Set default values to avoid errors /// </summary> private void SetDefaultValues() { this.HostName = _defaultHostName; this.CachePort = _defaultPort; this.CacheName = _defaultCacheName; this.LocalCache = false; this.SecurityMode = DataCacheSecurityMode.Transport; this.ProtectionLevel = DataCacheProtectionLevel.EncryptAndSign; }
/// <summary> /// Constructor /// </summary> /// <param name="hostName">Host name</param> /// <param name="cachePort">Cache port</param> /// <param name="cacheName">Cache name</param> /// <param name="localCache">Whether to use local cache or not</param> /// <param name="securityMode">Security mode</param> /// <param name="protectionLevel">Protection level</param> public AppFabricCacheManager(string hostName, int cachePort, string cacheName, bool localCache, DataCacheSecurityMode securityMode, DataCacheProtectionLevel protectionLevel) { this.HostName = hostName; this.CachePort = cachePort; this.CacheName = cacheName; this.LocalCache = localCache; this.SecurityMode = securityMode; this.ProtectionLevel = protectionLevel; this.Initialize(); }
/// <summary> /// Constructor to be used when the DLL is not copied in the EntLib configuration folder /// </summary> /// <param name="collection">Collection of parameters</param> public AppFabricCacheManager(NameValueCollection collection) { this.SetDefaultValues(); foreach (string key in collection.AllKeys) { if (!String.IsNullOrEmpty(collection[key])) { switch (key.ToLower()) { case "hostname": this.HostName = collection[key]; break; case "cacheport": this.CachePort = int.Parse(collection[key]); break; case "cachename": this.CacheName = collection[key]; break; case "localcache": this.LocalCache = bool.Parse(collection[key]); break; case "securitymode": this.SecurityMode = (DataCacheSecurityMode)Enum.Parse(typeof(DataCacheSecurityMode), collection[key]); break; case "protectionlevel": this.ProtectionLevel = (DataCacheProtectionLevel)Enum.Parse(typeof(DataCacheProtectionLevel), collection[key]); break; } } } this.Initialize(); }
public static DataCacheSecurity SetCacheSecurity(string mode, string level) { DataCacheSecurityMode _mode = DataCacheSecurityMode.Transport; DataCacheProtectionLevel _level = DataCacheProtectionLevel.EncryptAndSign; switch (mode) { case "none": _mode = DataCacheSecurityMode.None; break; } switch (level) { case "none": _level = DataCacheProtectionLevel.None; break; case "sign": _level = DataCacheProtectionLevel.Sign; break; } return(new DataCacheSecurity(_mode, _level)); }
public DataCacheSecurity(DataCacheSecurityMode securityMode, DataCacheProtectionLevel protectionLevel) { ProtectionLevel = protectionLevel; SecurityMode = securityMode; }