Here are the examples of the csharp api System.Collections.Concurrent.ConcurrentDictionary.ContainsKey(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1071 Examples
19
Source : SQLManager.cs
with MIT License
from 1100100
with MIT License
from 1100100
private void ReadXml(string url, ConcurrentDictionary<string, string[]> dic)
{
var elements = DeserializeXml<SQLElement>(url);
foreach (var ele in elements.SQL)
{
if (dic.ContainsKey(ele.Name))
throw new ArgumentException($"Duplicate name \"{ele.Name}\".");
var element = new[] { ele.SQL };
dic.AddOrUpdate(ele.Name, element, (doreplacedent, oldValue) => oldValue);
}
foreach (var ele in elements.Paging)
{
if (dic.ContainsKey(ele.Name))
throw new ArgumentException($"Duplicate name \"{ele.Name}\".");
var element = new[] { ele.CountSQL, ele.QuerySQL };
dic.AddOrUpdate(ele.Name, element, (doreplacedent, oldValue) => oldValue);
}
}
19
Source : ServiceFactory.cs
with MIT License
from 1100100
with MIT License
from 1100100
public void Create(string route, MethodInfo serverMethodInfo, MethodInfo clientMethodInfo, List<Type> serverInterceptors, List<Type> clientInterceptors)
{
if (ServiceInvokers.ContainsKey(route))
throw new DuplicateRouteException(route);
var enableClient = ServiceProvider.GetService<ILoadBalancing>() != null;
ServiceCircuitBreakerOptions breaker = null;
CachingConfig cachingConfig = null;
if (enableClient)
{
#region Circuit breaker
var nonCircuitBreakerAttr = clientMethodInfo.GetCustomAttribute<NonCircuitBreakerAttribute>();
if (nonCircuitBreakerAttr == null)
{
var circuitBreakerAttr = clientMethodInfo.GetCustomAttribute<CircuitBreakerAttribute>();
var globalCircuitBreaker = UraganoSettings.CircuitBreakerOptions;
if (globalCircuitBreaker != null || circuitBreakerAttr != null)
{
breaker = new ServiceCircuitBreakerOptions();
if (globalCircuitBreaker != null)
{
breaker.Timeout = globalCircuitBreaker.Timeout;
breaker.Retry = globalCircuitBreaker.Retry;
breaker.ExceptionsAllowedBeforeBreaking =
globalCircuitBreaker.ExceptionsAllowedBeforeBreaking;
breaker.DurationOfBreak = globalCircuitBreaker.DurationOfBreak;
breaker.MaxParallelization = globalCircuitBreaker.MaxParallelization;
breaker.MaxQueuingActions = globalCircuitBreaker.MaxQueuingActions;
}
if (circuitBreakerAttr != null)
{
if (circuitBreakerAttr.TimeoutMilliseconds > -1)
breaker.Timeout = TimeSpan.FromMilliseconds(circuitBreakerAttr.TimeoutMilliseconds);
if (circuitBreakerAttr.Retry > -1)
breaker.Retry = circuitBreakerAttr.Retry;
if (circuitBreakerAttr.ExceptionsAllowedBeforeBreaking > -1)
breaker.ExceptionsAllowedBeforeBreaking =
circuitBreakerAttr.ExceptionsAllowedBeforeBreaking;
if (circuitBreakerAttr.DurationOfBreakSeconds > -1)
breaker.DurationOfBreak = TimeSpan.FromSeconds(circuitBreakerAttr.DurationOfBreakSeconds);
if (!string.IsNullOrWhiteSpace(circuitBreakerAttr.FallbackExecuteScript))
{
breaker.HasInjection = true;
ScriptInjection.AddScript(route, circuitBreakerAttr.FallbackExecuteScript,
circuitBreakerAttr.ScriptUsingNameSpaces);
}
if (circuitBreakerAttr.MaxParallelization > -1)
breaker.MaxParallelization = circuitBreakerAttr.MaxParallelization;
if (circuitBreakerAttr.MaxQueuingActions > -1)
breaker.MaxQueuingActions = circuitBreakerAttr.MaxQueuingActions;
}
}
}
#endregion
#region Caching
//Must have a method of returning a value.
if (UraganoSettings.CachingOptions != null && clientMethodInfo.ReturnType != typeof(Task) && clientMethodInfo.GetCustomAttribute<NonCachingAttribute>() == null && clientMethodInfo.DeclaringType?.GetCustomAttribute<NonCachingAttribute>() == null)
{
var attr = clientMethodInfo.GetCustomAttribute<CachingAttribute>();
var keyGenerator = ServiceProvider.GetRequiredService<ICachingKeyGenerator>();
var key = keyGenerator.GenerateKeyPlaceholder(UraganoSettings.CachingOptions.KeyPrefix, UraganoSettings.CachingOptions.ExpireSeconds, route, clientMethodInfo, attr);
cachingConfig = new CachingConfig(key, attr != null && !string.IsNullOrWhiteSpace(attr.Key), attr != null && attr.ExpireSeconds != -1 ? attr.ExpireSeconds : UraganoSettings.CachingOptions.ExpireSeconds);
}
#endregion
}
var serviceDescriptor = new ServiceDescriptor(route, serverMethodInfo, clientMethodInfo, serverMethodInfo == null ? null : new MethodInvoker(serverMethodInfo), serverInterceptors, clientInterceptors, breaker, cachingConfig);
ServiceInvokers.TryAdd(route, serviceDescriptor);
}
19
Source : DataFilterUtil.cs
with MIT License
from 2881099
with MIT License
from 2881099
internal static void SetRepositoryDataFilter(object repos, Action<FluentDataFilter> scopedDataFilter) {
if (scopedDataFilter != null) {
SetRepositoryDataFilter(repos, null);
}
if (scopedDataFilter == null) {
scopedDataFilter = _globalDataFilter;
}
if (scopedDataFilter == null) return;
using (var globalFilter = new FluentDataFilter()) {
scopedDataFilter(globalFilter);
var type = repos.GetType();
Type enreplacedyType = (repos as IBaseRepository).EnreplacedyType;
if (enreplacedyType == null) throw new Exception("FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository");
var notExists = _dicSetRepositoryDataFilterConvertFilterNotExists.GetOrAdd(type, t => new ConcurrentDictionary<string, bool>());
var newFilter = new Dictionary<string, LambdaExpression>();
foreach (var gf in globalFilter._filters) {
if (notExists.ContainsKey(gf.name)) continue;
LambdaExpression newExp = null;
var filterParameter1 = Expression.Parameter(enreplacedyType, gf.exp.Parameters[0].Name);
try {
newExp = Expression.Lambda(
typeof(Func<,>).MakeGenericType(enreplacedyType, typeof(bool)),
new ReplaceVisitor().Modify(gf.exp.Body, filterParameter1),
filterParameter1
);
} catch {
notExists.TryAdd(gf.name, true); //防止第二次错误
continue;
}
newFilter.Add(gf.name, newExp);
}
if (newFilter.Any() == false) return;
var del = _dicSetRepositoryDataFilterApplyDataFilterFunc.GetOrAdd(type, t => {
var reposParameter = Expression.Parameter(type);
var nameParameter = Expression.Parameter(typeof(string));
var expressionParameter = Expression.Parameter(
typeof(Expression<>).MakeGenericType(typeof(Func<,>).MakeGenericType(enreplacedyType, typeof(bool)))
);
return Expression.Lambda(
Expression.Block(
Expression.Call(reposParameter, type.GetMethod("ApplyDataFilter", BindingFlags.Instance | BindingFlags.NonPublic), nameParameter, expressionParameter)
),
new[] {
reposParameter, nameParameter, expressionParameter
}
).Compile();
});
foreach (var nf in newFilter) {
del.DynamicInvoke(repos, nf.Key, nf.Value);
}
newFilter.Clear();
}
}
19
Source : Admin.cs
with MIT License
from 2881099
with MIT License
from 2881099
static void MakeTemplateFile(string tplName, string tplCode) {
var tplPath = _tplViewDir + $@"{tplName}";
if (newTpl.ContainsKey(tplPath) == false) {
var lck = newTplLock.GetOrAdd(tplPath, ent => new object());
lock (lck) {
if (newTpl.ContainsKey(tplPath) == false) {
if (File.Exists(tplPath)) File.Delete(tplPath);
File.WriteAllText(tplPath, tplCode, Encoding.UTF8);
newTpl.TryAdd(tplPath, true);
}
}
}
}
19
Source : DbSet.cs
with MIT License
from 2881099
with MIT License
from 2881099
bool? ExistsInStates(TEnreplacedy data) {
if (data == null) throw new ArgumentNullException(nameof(data));
var key = _fsql.GetEnreplacedyKeyString(_enreplacedyType, data, false);
if (string.IsNullOrEmpty(key)) return null;
return _states.ContainsKey(key);
}
19
Source : DbSet.cs
with MIT License
from 2881099
with MIT License
from 2881099
bool CanAdd(TEnreplacedy data, bool isThrow) {
if (data == null) {
if (isThrow) throw new ArgumentNullException(nameof(data));
return false;
}
if (_table.Primarys.Any() == false) {
if (isThrow) throw new Exception($"不可添加,实体没有主键:{_fsql.GetEnreplacedyString(_enreplacedyType, data)}");
return false;
}
var key = _fsql.GetEnreplacedyKeyString(_enreplacedyType, data, true);
if (string.IsNullOrEmpty(key)) {
switch (_fsql.Ado.DataType) {
case DataType.SqlServer:
case DataType.PostgreSQL:
return true;
case DataType.MySql:
case DataType.Oracle:
case DataType.Sqlite:
if (_tableIdenreplacedys.Length == 1 && _table.Primarys.Length == 1) {
return true;
}
if (isThrow) throw new Exception($"不可添加,未设置主键的值:{_fsql.GetEnreplacedyString(_enreplacedyType, data)}");
return false;
}
} else {
if (_states.ContainsKey(key)) {
if (isThrow) throw new Exception($"不可添加,已存在于状态管理:{_fsql.GetEnreplacedyString(_enreplacedyType, data)}");
return false;
}
var idval = _fsql.GetEnreplacedyIdenreplacedyValueWithPrimary(_enreplacedyType, data);
if (idval > 0) {
if (isThrow) throw new Exception($"不可添加,自增属性有值:{_fsql.GetEnreplacedyString(_enreplacedyType, data)}");
return false;
}
}
return true;
}
19
Source : ConstantRemotePathProvider.cs
with MIT License
from Accelerider
with MIT License
from Accelerider
public void Rate(string remotePath, double score)
{
if (RemotePaths.ContainsKey(remotePath))
RemotePaths[remotePath] = RemotePaths[remotePath] + score;
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static bool ModifyBool(string key, bool newVal)
{
if (!DefaultPropertyManager.DefaultBooleanProperties.ContainsKey(key))
return false;
if (CachedBooleanSettings.ContainsKey(key))
CachedBooleanSettings[key].Modify(newVal);
else
CachedBooleanSettings[key] = new ConfigurationEntry<bool>(true, newVal, DefaultPropertyManager.DefaultBooleanProperties[key].Description);
return true;
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static Property<long> GetLong(string key, long fallback = 0, bool cacheFallback = true)
{
if (CachedLongSettings.ContainsKey(key))
return new Property<long>(CachedLongSettings[key].Item, CachedLongSettings[key].Description);
var dbValue = DatabaseManager.ShardConfig.GetLong(key);
bool useFallback = dbValue?.Value == null;
var value = dbValue?.Value ?? fallback;
if (!useFallback || cacheFallback)
CachedLongSettings[key] = new ConfigurationEntry<long>(useFallback, value, dbValue?.Description);
return new Property<long>(value, dbValue?.Description);
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static Property<bool> GetBool(string key, bool fallback = false, bool cacheFallback = true)
{
// first, check the cache. If the key exists in the cache, grab it regardless of its modified value
// then, check the database. if the key exists in the database, grab it and cache it
// finally, set it to a default of false.
if (CachedBooleanSettings.ContainsKey(key))
return new Property<bool>(CachedBooleanSettings[key].Item, CachedBooleanSettings[key].Description);
var dbValue = DatabaseManager.ShardConfig.GetBool(key);
bool useFallback = dbValue?.Value == null;
var value = dbValue?.Value ?? fallback;
if (!useFallback || cacheFallback)
CachedBooleanSettings[key] = new ConfigurationEntry<bool>(useFallback, value, dbValue?.Description);
return new Property<bool>(value, dbValue?.Description);
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static bool ModifyDouble(string key, double newVal, bool init = false)
{
if (!DefaultPropertyManager.DefaultDoubleProperties.ContainsKey(key))
return false;
if (CachedDoubleSettings.ContainsKey(key))
CachedDoubleSettings[key].Modify(newVal);
else
CachedDoubleSettings[key] = new ConfigurationEntry<double>(true, newVal, DefaultPropertyManager.DefaultDoubleProperties[key].Description);
if (!init)
{
switch (key)
{
case "cantrip_drop_rate":
Factories.Tables.CantripChance.ApplyNumCantripsMod();
break;
case "minor_cantrip_drop_rate":
case "major_cantrip_drop_rate":
case "epic_cantrip_drop_rate":
case "legendary_cantrip_drop_rate":
Factories.Tables.CantripChance.ApplyCantripLevelsMod();
break;
}
}
return true;
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static Property<string> GetString(string key, string fallback = "", bool cacheFallback = true)
{
if (CachedStringSettings.ContainsKey(key))
return new Property<string>(CachedStringSettings[key].Item, CachedStringSettings[key].Description);
var dbValue = DatabaseManager.ShardConfig.GetString(key);
bool useFallback = dbValue?.Value == null;
var value = dbValue?.Value ?? fallback;
if (!useFallback || cacheFallback)
CachedStringSettings[key] = new ConfigurationEntry<string>(useFallback, value, dbValue?.Description);
return new Property<string>(value, dbValue?.Description);
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static void ModifyStringDescription(string key, string description)
{
if (CachedStringSettings.ContainsKey(key))
CachedStringSettings[key].ModifyDescription(description);
else
log.Warn($"Attempted to modify {key} which did not exist in the STRING cache.");
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static void ModifyBoolDescription(string key, string description)
{
if (CachedBooleanSettings.ContainsKey(key))
CachedBooleanSettings[key].ModifyDescription(description);
else
log.Warn($"Attempted to modify {key} which did not exist in the BOOL cache.");
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static bool ModifyLong(string key, long newVal)
{
if (!DefaultPropertyManager.DefaultLongProperties.ContainsKey(key))
return false;
if (CachedLongSettings.ContainsKey(key))
CachedLongSettings[key].Modify(newVal);
else
CachedLongSettings[key] = new ConfigurationEntry<long>(true, newVal, DefaultPropertyManager.DefaultLongProperties[key].Description);
return true;
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static void ModifyLongDescription(string key, string description)
{
if (CachedLongSettings.ContainsKey(key))
CachedLongSettings[key].ModifyDescription(description);
else
log.Warn($"Attempted to modify {key} which did not exist in the LONG cache.");
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static Property<double> GetDouble(string key, double fallback = 0.0f, bool cacheFallback = true)
{
if (CachedDoubleSettings.ContainsKey(key))
return new Property<double>(CachedDoubleSettings[key].Item, CachedDoubleSettings[key].Description);
var dbValue = DatabaseManager.ShardConfig.GetDouble(key);
bool useFallback = dbValue?.Value == null;
var value = dbValue?.Value ?? fallback;
if (!useFallback || cacheFallback)
CachedDoubleSettings[key] = new ConfigurationEntry<double>(useFallback, value, dbValue?.Description);
return new Property<double>(value, dbValue?.Description);
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static void ModifyDoubleDescription(string key, string description)
{
if (CachedDoubleSettings.ContainsKey(key))
CachedDoubleSettings[key].ModifyDescription(description);
else
log.Warn($"Attempted to modify the description of {key} which did not exist in the DOUBLE cache.");
}
19
Source : PropertyManager.cs
with GNU Affero General Public License v3.0
from ACEmulator
with GNU Affero General Public License v3.0
from ACEmulator
public static bool ModifyString(string key, string newVal)
{
if (!DefaultPropertyManager.DefaultStringProperties.ContainsKey(key))
return false;
if (CachedStringSettings.ContainsKey(key))
CachedStringSettings[key].Modify(newVal);
else
CachedStringSettings[key] = new ConfigurationEntry<string>(true, newVal, DefaultPropertyManager.DefaultStringProperties[key].Description);
return true;
}
19
Source : AdxstudioCrmConfigurationProvider.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public virtual IEnumerable<IOrganizationServiceEventProvider> CreateEventProviders(string eventName = null, bool allowDefaultFallback = false)
{
var section = GetCrmSection();
var eventElement = section.Events.GetElementOrDefault(eventName, allowDefaultFallback);
var mode = eventElement.InstanceMode;
var name = !string.IsNullOrWhiteSpace(eventName) ? eventName : eventElement.Name;
if (mode == ServiceEventInstanceMode.Static)
{
// return a single instance
return _eventProviders ?? (_eventProviders = eventElement.CreateEventProviders());
}
if (mode == ServiceEventInstanceMode.PerName)
{
var key = name ?? GetDefaultContextName();
if (!_eventProvidersLookup.ContainsKey(key))
{
_eventProvidersLookup[key] = eventElement.CreateEventProviders();
}
return _eventProvidersLookup[key];
}
if (mode == ServiceEventInstanceMode.PerRequest && HttpSingleton<IEnumerable<IOrganizationServiceEventProvider>>.Enabled)
{
var key = name ?? GetDefaultContextName();
return HttpSingleton<IEnumerable<IOrganizationServiceEventProvider>>.GetInstance(key, eventElement.CreateEventProviders);
}
var providers = eventElement.CreateEventProviders();
return providers;
}
19
Source : NotificationUpdateManager.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
internal void UpdateNotificationMessageTable(ICrmSubscriptionMessage crmSubscriptionMessage, bool isSearchIndexInvalidationMessage = false)
{
if (crmSubscriptionMessage is MetadataMessage)
{
//When New Views are added which is a metadata change we Refresh Search Index Enabled enreplacedy List
WebAppConfigurationProvider.GetPortalEnreplacedyList();
ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Found a MetaData Change {0} in messageId: {1}.", crmSubscriptionMessage.MessageName, crmSubscriptionMessage.MessageId));
lock (metadataFlagLock)
{
this.MetadataDirtyEntry = true;
}
return;
}
EnreplacedyRecordMessage message = crmSubscriptionMessage as EnreplacedyRecordMessage;
portalUsedEnreplacedies = WebAppConfigurationProvider.PortalUsedEnreplacedies;
//Filter's out Enreplacedies Not Used in Portal
if (message != null && portalUsedEnreplacedies.ContainsKey(message.EnreplacedyName))
{
ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Pushing MessageId: {0} CRMSubscriptionMessage with enreplacedy: {1} and message name: {2} into the Cache.", message.MessageId, message.EnreplacedyName, message.MessageName));
var enreplacedyKey = string.Format(EnreplacedyKey, message.EnreplacedyName,
isSearchIndexInvalidationMessage ? FromSearchSubscription : FromCacheSubscription);
if (!this.DirtyTable.TryAdd(enreplacedyKey, new EnreplacedyInvalidationMessageAndType(message, isSearchIndexInvalidationMessage)))
{
EnreplacedyInvalidationMessageAndType val = null;
var success = this.DirtyTable.TryGetValue(message.EnreplacedyName, out val);
ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Dirty Table already contains enreplacedy: {0} and message name: {1} in the Cache with MessageId: {2}. Dropping MessageId: {3} ", message.EnreplacedyName, message.MessageName, success ? val.Message.MessageId : Guid.Empty, message.MessageId));
}
}
}
19
Source : SharePointConfigurationManager.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public static IDictionary<string, string> CreateConnectionDictionary(ConnectionStringSettings connectionString)
{
connectionString.ThrowOnNull("connectionString");
var name = connectionString.Name;
if (!_connectionLookup.ContainsKey(name))
{
var connection = connectionString.ConnectionString.ToDictionary();
if (name == "Xrm")
{
// if using the CRM connection, replace the Url with the SharePoint one
var context = PortalCrmConfigurationManager.CreateServiceContext();
var sharePointUrl = context.GetSettingValueByName("SharePoint/URL");
if (string.IsNullOrWhiteSpace(sharePointUrl))
{
var sharePointSites = context.CreateQuery("sharepointsite").Where(site => site.GetAttributeValue<int?>("statecode") == 0).ToArray(); // all active SP sites
var defaultSharePointSite = sharePointSites.FirstOrDefault(site => site.GetAttributeValue<bool>("isdefault"));
if (defaultSharePointSite == null) throw new Exception("A SharePoint/URL site setting couldn't be found, and no default SharePoint site exists. Specify a SharePoint/URL site setting or make a default SharePoint site.");
sharePointUrl = defaultSharePointSite.GetAttributeValue<string>("absoluteurl") ?? string.Empty;
var parentSiteReference = defaultSharePointSite.GetAttributeValue<EnreplacedyReference>("parentsite");
if (parentSiteReference != null)
{
var parentSite = sharePointSites.FirstOrDefault(site => site.Id == parentSiteReference.Id);
if (parentSite != null)
{
sharePointUrl = "{0}/{1}".FormatWith(parentSite.GetAttributeValue<string>("absoluteurl").TrimEnd('/'), defaultSharePointSite.GetAttributeValue<string>("relativeurl"));
}
}
}
connection["Url"] = sharePointUrl;
}
// cache ths mapping for performance
_connectionLookup[name] = connection;
}
return _connectionLookup[name];
}
19
Source : CrmConfigurationProvider.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public virtual IOrganizationService CreateService(CrmConnection connection, string serviceName = null, bool allowDefaultFallback = false)
{
var section = GetCrmSection();
var serviceElement = section.Services.GetElementOrDefault(serviceName, allowDefaultFallback);
var mode = serviceElement.InstanceMode;
var name = serviceElement.Name;
if (mode == OrganizationServiceInstanceMode.Static)
{
// return a single instance
return _service ?? (_service = CreateService(serviceElement, connection));
}
if (mode == OrganizationServiceInstanceMode.PerName)
{
var key = name ?? GetDefaultContextName();
if (!_serviceLookup.ContainsKey(key))
{
_serviceLookup[key] = CreateService(serviceElement, connection);
}
return _serviceLookup[key];
}
if (mode == OrganizationServiceInstanceMode.PerRequest && HttpSingleton<IOrganizationService>.Enabled)
{
var key = name ?? GetDefaultContextName();
return HttpSingleton<IOrganizationService>.GetInstance(key, () => CreateService(serviceElement, connection));
}
var service = CreateService(serviceElement, connection);
return service;
}
19
Source : CrmConfigurationProvider.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public virtual ObjectCache CreateObjectCache(string objectCacheName = null, bool allowDefaultFallback = false)
{
var section = GetCrmSection();
var objectCacheElement = section.ObjectCache.GetElementOrDefault(objectCacheName, allowDefaultFallback);
var mode = objectCacheElement.InstanceMode;
var name = !string.IsNullOrWhiteSpace(objectCacheElement.Name) ? objectCacheElement.Name : GetDefaultContextName();
if (mode == ObjectCacheInstanceMode.Static)
{
// return a single instance
return _objectCache ?? (_objectCache = objectCacheElement.CreateObjectCache(name));
}
if (mode == ObjectCacheInstanceMode.PerName)
{
var key = name ?? GetDefaultContextName() ?? ObjectCacheElement.DefaultObjectCacheName;
if (!_objectCacheLookup.ContainsKey(key))
{
_objectCacheLookup[key] = objectCacheElement.CreateObjectCache(name);
}
return _objectCacheLookup[key];
}
// return a new instance for each call
var objectCache = objectCacheElement.CreateObjectCache(name);
return objectCache;
}
19
Source : CrmConfigurationProvider.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
public virtual IDictionary<string, string> CreateConnectionDictionary(ConnectionStringSettings connectionString)
{
connectionString.ThrowOnNull("connectionString");
var name = connectionString.Name;
if (!_connectionLookup.ContainsKey(name))
{
// cache ths mapping for performance
_connectionLookup[name] = connectionString.ConnectionString.ToDictionary();
}
return _connectionLookup[name];
}
19
Source : OrganizationService.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
protected virtual IServiceConfiguration<IOrganizationService> GetServiceConfiguration(CrmConnection connection)
{
var mode = connection.ServiceConfigurationInstanceMode;
if (mode == ServiceConfigurationInstanceMode.Static)
{
return _config ?? (_config = CreateServiceConfiguration(connection));
}
if (mode == ServiceConfigurationInstanceMode.PerName)
{
var key = connection.GetConnectionId();
if (!_configLookup.ContainsKey(key))
{
_configLookup[key] = CreateServiceConfiguration(connection);
}
return _configLookup[key];
}
if (mode == ServiceConfigurationInstanceMode.PerRequest && HttpSingleton<IServiceConfiguration<IOrganizationService>>.Enabled)
{
var key = connection.GetConnectionId();
return HttpSingleton<IServiceConfiguration<IOrganizationService>>.GetInstance(key, () => CreateServiceConfiguration(connection));
}
var config = CreateServiceConfiguration(connection);
return config;
}
19
Source : DiscoveryService.cs
with MIT License
from Adoxio
with MIT License
from Adoxio
protected virtual IServiceConfiguration<IDiscoveryService> GetServiceConfiguration(CrmConnection connection)
{
var mode = connection.ServiceConfigurationInstanceMode;
if (mode == ServiceConfigurationInstanceMode.Static)
{
return _config ?? (_config = CreateServiceConfiguration(connection));
}
if (mode == ServiceConfigurationInstanceMode.PerName)
{
var key = connection.GetConnectionId();
if (!_configLookup.ContainsKey(key))
{
_configLookup[key] = CreateServiceConfiguration(connection);
}
return _configLookup[key];
}
if (mode == ServiceConfigurationInstanceMode.PerRequest && HttpSingleton<IServiceConfiguration<IDiscoveryService>>.Enabled)
{
var key = connection.GetConnectionId();
return HttpSingleton<IServiceConfiguration<IDiscoveryService>>.GetInstance(key, () => CreateServiceConfiguration(connection));
}
var config = CreateServiceConfiguration(connection);
return config;
}
19
Source : InMemoryDatabase.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public Task<bool> IsExistsAsync(string key)
{
Check.NotNullOrWhiteSpace(key, nameof(key));
return Task.FromResult(_dictionary.ContainsKey(key));
}
19
Source : StateStore.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public async Task<bool> IsExistsAsync(string key)
{
if (_cache.ContainsKey(key))
return true;
return await _stateStoreImplementation.IsExistsAsync(key);
}
19
Source : AkkaClusterState.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public static void AddOrUpdate(Member member)
{
var address = member.Address.ToString();
if (MemberInfos.ContainsKey(address))
{
MemberInfos[address].Roles = string.Join(",", member.Roles);
MemberInfos[address].Status = member.Status.ToString();
}
else
{
MemberInfos.TryAdd(
address,
new MemberInfo
{
Address = address,
Roles = string.Join(",", member.Roles),
Status = member.Status.ToString(),
Reachable = true
}
);
}
}
19
Source : AkkaClusterState.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public static void SetReachable(Member member,bool reachable)
{
var address = member.Address.ToString();
if (MemberInfos.ContainsKey(address))
{
var memberInfo = MemberInfos[address];
memberInfo.Roles = string.Join(",", member.Roles);
memberInfo.Status = member.Status.ToString();
memberInfo.Reachable = reachable;
}
else
{
MemberInfos.TryAdd(
address,
new MemberInfo
{
Address = address,
Roles = string.Join(",", member.Roles),
Status = member.Status.ToString(),
Reachable = reachable
}
);
}
}
19
Source : AkkaClusterState.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public static void Remove(Member member)
{
var address = member.Address.ToString();
if (MemberInfos.ContainsKey(address))
{
MemberInfo info;
MemberInfos.TryRemove(address, out info);
}
}
19
Source : AkkaClusterState.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public static void ChangeLeader(Akka.Actor.Address address)
{
foreach (var member in MemberInfos.Values)
{
member.ClusterLeader = false;
}
var addressStr = address.ToString();
if (MemberInfos.ContainsKey(addressStr))
{
MemberInfos[addressStr].ClusterLeader = true;
}
}
19
Source : AkkaClusterState.cs
with MIT License
from AElfProject
with MIT License
from AElfProject
public static void ChangeRoleLeader(ClusterEvent.RoleLeaderChanged roleLeader)
{
foreach (var member in MemberInfos.Values)
{
if (member.Roles == roleLeader.Role)
{
member.RoleLeader = false;
}
}
var addressStr = roleLeader.Leader.ToString();
if (MemberInfos.ContainsKey(addressStr))
{
MemberInfos[addressStr].RoleLeader = true;
}
}
19
Source : RestClient.cs
with MIT License
from Aiko-IT-Systems
with MIT License
from Aiko-IT-Systems
private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket bucket, TaskCompletionSource<bool> ratelimitTcs)
{
if (this._disposed)
return;
HttpResponseMessage res = default;
try
{
await this.GlobalRateLimitEvent.WaitAsync().ConfigureAwait(false);
if (bucket == null)
bucket = request.RateLimitBucket;
if (ratelimitTcs == null)
ratelimitTcs = await this.WaitForInitialRateLimit(bucket).ConfigureAwait(false);
if (ratelimitTcs == null) // ckeck rate limit only if we are not the probe request
{
var now = DateTimeOffset.UtcNow;
await bucket.TryResetLimitAsync(now).ConfigureAwait(false);
// Decrement the remaining number of requests as there can be other concurrent requests before this one finishes and has a chance to update the bucket
if (Interlocked.Decrement(ref bucket._remaining) < 0)
{
this.Logger.LogDebug(LoggerEvents.RatelimitDiag, "Request for {0} is blocked", bucket.ToString());
var delay = bucket.Reset - now;
var resetDate = bucket.Reset;
if (this.UseResetAfter)
{
delay = bucket.ResetAfter.Value;
resetDate = bucket.ResetAfterOffset;
}
if (delay < new TimeSpan(-TimeSpan.TicksPerMinute))
{
this.Logger.LogError(LoggerEvents.RatelimitDiag, "Failed to retrieve ratelimits - giving up and allowing next request for bucket");
bucket._remaining = 1;
}
if (delay < TimeSpan.Zero)
delay = TimeSpan.FromMilliseconds(100);
this.Logger.LogWarning(LoggerEvents.RatelimitPreemptive, "Pre-emptive ratelimit triggered - waiting until {0:yyyy-MM-dd HH:mm:ss zzz} ({1:c}).", resetDate, delay);
Task.Delay(delay)
.ContinueWith(_ => this.ExecuteRequestAsync(request, null, null))
.LogTaskFault(this.Logger, LogLevel.Error, LoggerEvents.RestError, "Error while executing request");
return;
}
this.Logger.LogDebug(LoggerEvents.RatelimitDiag, "Request for {0} is allowed", bucket.ToString());
}
else
this.Logger.LogDebug(LoggerEvents.RatelimitDiag, "Initial request for {0} is allowed", bucket.ToString());
var req = this.BuildRequest(request);
if(this.Debug)
this.Logger.LogTrace(LoggerEvents.Misc, await req.Content.ReadreplacedtringAsync());
var response = new RestResponse();
try
{
if (this._disposed)
return;
res = await this.HttpClient.SendAsync(req, HttpCompletionOption.ResponseContentRead, CancellationToken.None).ConfigureAwait(false);
var bts = await res.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
var txt = Utilities.UTF8.GetString(bts, 0, bts.Length);
this.Logger.LogTrace(LoggerEvents.RestRx, txt);
response.Headers = res.Headers.ToDictionary(xh => xh.Key, xh => string.Join("\n", xh.Value), StringComparer.OrdinalIgnoreCase);
response.Response = txt;
response.ResponseCode = (int)res.StatusCode;
}
catch (HttpRequestException httpex)
{
this.Logger.LogError(LoggerEvents.RestError, httpex, "Request to {0} triggered an HttpException", request.Url);
request.SetFaulted(httpex);
this.FailInitialRateLimitTest(request, ratelimitTcs);
return;
}
this.UpdateBucket(request, response, ratelimitTcs);
Exception ex = null;
switch (response.ResponseCode)
{
case 400:
case 405:
ex = new BadRequestException(request, response);
break;
case 401:
case 403:
ex = new UnauthorizedException(request, response);
break;
case 404:
ex = new NotFoundException(request, response);
break;
case 413:
ex = new RequestSizeException(request, response);
break;
case 429:
ex = new RateLimitException(request, response);
// check the limit info and requeue
this.Handle429(response, out var wait, out var global);
if (wait != null)
{
if (global)
{
this.Logger.LogError(LoggerEvents.RatelimitHit, "Global ratelimit hit, cooling down");
try
{
this.GlobalRateLimitEvent.Reset();
await wait.ConfigureAwait(false);
}
finally
{
// we don't want to wait here until all the blocked requests have been run, additionally Set can never throw an exception that could be suppressed here
_ = this.GlobalRateLimitEvent.SetAsync();
}
this.ExecuteRequestAsync(request, bucket, ratelimitTcs)
.LogTaskFault(this.Logger, LogLevel.Error, LoggerEvents.RestError, "Error while retrying request");
}
else
{
this.Logger.LogError(LoggerEvents.RatelimitHit, "Ratelimit hit, requeueing request to {0}", request.Url);
await wait.ConfigureAwait(false);
this.ExecuteRequestAsync(request, bucket, ratelimitTcs)
.LogTaskFault(this.Logger, LogLevel.Error, LoggerEvents.RestError, "Error while retrying request");
}
return;
}
break;
case 500:
case 502:
case 503:
case 504:
ex = new ServerErrorException(request, response);
break;
}
if (ex != null)
request.SetFaulted(ex);
else
request.SetCompleted(response);
}
catch (Exception ex)
{
this.Logger.LogError(LoggerEvents.RestError, ex, "Request to {0} triggered an exception", request.Url);
// if something went wrong and we couldn't get rate limits for the first request here, allow the next request to run
if (bucket != null && ratelimitTcs != null && bucket._limitTesting != 0)
this.FailInitialRateLimitTest(request, ratelimitTcs);
if (!request.TrySetFaulted(ex))
throw;
}
finally
{
res?.Dispose();
// Get and decrement active requests in this bucket by 1.
_ = this.RequestQueue.TryGetValue(bucket.BucketId, out var count);
this.RequestQueue[bucket.BucketId] = Interlocked.Decrement(ref count);
// If it's 0 or less, we can remove the bucket from the active request queue,
// along with any of its past routes.
if (count <= 0)
{
foreach (var r in bucket.RouteHashes)
{
if (this.RequestQueue.ContainsKey(r))
{
_ = this.RequestQueue.TryRemove(r, out _);
}
}
}
}
}
19
Source : RestClient.cs
with MIT License
from Aiko-IT-Systems
with MIT License
from Aiko-IT-Systems
private async Task CleanupBucketsAsync()
{
while (!this._bucketCleanerTokenSource.IsCancellationRequested)
{
try
{
await Task.Delay(this._bucketCleanupDelay, this._bucketCleanerTokenSource.Token).ConfigureAwait(false);
}
catch { }
if (this._disposed)
return;
//Check and clean request queue first in case it wasn't removed properly during requests.
foreach (var key in this.RequestQueue.Keys)
{
var bucket = this.HashesToBuckets.Values.FirstOrDefault(x => x.RouteHashes.Contains(key));
if (bucket == null || (bucket != null && bucket.LastAttemptAt.AddSeconds(5) < DateTimeOffset.UtcNow))
_ = this.RequestQueue.TryRemove(key, out _);
}
var removedBuckets = 0;
StringBuilder bucketIdStrBuilder = default;
foreach (var kvp in this.HashesToBuckets)
{
if (bucketIdStrBuilder == null)
bucketIdStrBuilder = new StringBuilder();
var key = kvp.Key;
var value = kvp.Value;
// Don't remove the bucket if it's currently being handled by the rest client, unless it's an unlimited bucket.
if (this.RequestQueue.ContainsKey(value.BucketId) && !value._isUnlimited)
continue;
var resetOffset = this.UseResetAfter ? value.ResetAfterOffset : value.Reset;
// Don't remove the bucket if it's reset date is less than now + the additional wait time, unless it's an unlimited bucket.
if (resetOffset != null && !value._isUnlimited && (resetOffset > DateTimeOffset.UtcNow || DateTimeOffset.UtcNow - resetOffset < this._bucketCleanupDelay))
continue;
_ = this.HashesToBuckets.TryRemove(key, out _);
removedBuckets++;
bucketIdStrBuilder.Append(value.BucketId + ", ");
}
if (removedBuckets > 0)
this.Logger.LogDebug(LoggerEvents.RestCleaner, "Removed {0} unused bucket{1}: [{2}]", removedBuckets, removedBuckets > 1 ? "s" : string.Empty, bucketIdStrBuilder.ToString().TrimEnd(',', ' '));
if (this.HashesToBuckets.Count == 0)
break;
}
if (!this._bucketCleanerTokenSource.IsCancellationRequested)
this._bucketCleanerTokenSource.Cancel();
this._cleanerRunning = false;
this.Logger.LogDebug(LoggerEvents.RestCleaner, "Bucket cleaner task stopped.");
}
19
Source : MongoClientContext.cs
with MIT License
from aishang2015
with MIT License
from aishang2015
public MongoClient GetMongoClient(string connectionString = null)
{
if (string.IsNullOrEmpty(connectionString))
{
connectionString = string.Empty;
}
if (!ConnectionCache.ContainsKey(connectionString))
{
ConnectionCache[connectionString] = InitMongoClient(connectionString);
}
return ConnectionCache[connectionString];
}
19
Source : TypeMapping.cs
with Apache License 2.0
from alexeyzimarev
with Apache License 2.0
from alexeyzimarev
public static void Add(string key, Type type)
{
if (Cached.Instance.ContainsKey(key)) Cached.Instance.TryRemove(key, out _);
if (Cached.ReverseInstance.ContainsKey(type)) Cached.ReverseInstance.TryRemove(type, out _);
Cached.Instance.TryAdd(key, type);
Cached.ReverseInstance.TryAdd(type, key);
}
19
Source : TypeMapping.cs
with Apache License 2.0
from alexeyzimarev
with Apache License 2.0
from alexeyzimarev
public static Type Get(string key, string replacedemblyName)
{
if (Cached.Instance.ContainsKey(key))
return Cached.Instance[key];
var t = Type.GetType($"{key}, {replacedemblyName}") ??
Type.GetType($"{key}, " + replacedembly.GetExecutingreplacedembly().GetName().Name);
Add(key, t);
return t;
}
19
Source : LocalizationModeBase.cs
with MIT License
from AlexTeixeira
with MIT License
from AlexTeixeira
protected void AddOrUpdateLocalizedValue<T>(LocalizatedFormat localizedValue, KeyValuePair<string, T> temp)
{
if (!(localizedValue.Value is null))
{
if (!localization.ContainsKey(temp.Key))
{
localization.TryAdd(temp.Key, localizedValue);
}
else if (localization[temp.Key].IsParent)
{
localization[temp.Key] = localizedValue;
}
}
}
19
Source : JsonStringLocalizerBase.cs
with MIT License
from AlexTeixeira
with MIT License
from AlexTeixeira
protected IPluralizationRuleSet GetPluralizationToUse()
{
IPluralizationRuleSet ruleSet;
if (pluralizationRuleSets.ContainsKey(currentCulture))
{
ruleSet = pluralizationRuleSets[currentCulture];
}
else
{
ruleSet = new DefaultPluralizationRuleSet();
}
return ruleSet;
}
19
Source : VariableController.cs
with MIT License
from alfa-laboratory
with MIT License
from alfa-laboratory
public Variable GetVariable(string key)
{
var correcKey = GetVariableName(key);
if (correcKey == null) return null;
if (!Variables.ContainsKey(correcKey))
return Variables.SingleOrDefault(_ => _.Key == GetVariableName(key)).Value;
if (Variables[correcKey].TypeOfAccess is TypeOfAccess.Global or TypeOfAccess.Default)
{
Log.Logger().LogInformation($"Element with key: \"{key}\" contains value {Variables[correcKey].Value} with type '{Variables[correcKey].TypeOfAccess}'");
}
return Variables.SingleOrDefault(_ => _.Key == GetVariableName(key)).Value;
}
19
Source : VariableController.cs
with MIT License
from alfa-laboratory
with MIT License
from alfa-laboratory
public void SetVariable(string key, Type type, object value, TypeOfAccess accessType = TypeOfAccess.Local)
{
if(key is null)
{
throw new ArgumentNullException(nameof(key), "Key is null");
}
var regex = new Regex(StringPattern.DECRYPT_KEY, RegexOptions.None);
var match = regex.Match(key);
if(match.Success && type == typeof(string))
{
key = match.Groups[1].Value;
value = Encryptor.Decrypt(value as string);
}
var varName = GetVariableName(key);
if(string.IsNullOrWhiteSpace(varName))
{
Log.Logger().LogInformation($"Key: \"{key}\" is empty");
return;
}
if (Variables.ContainsKey(varName))
{
switch(Variables[varName].TypeOfAccess)
{
case TypeOfAccess.Global:
{
switch(accessType)
{
case TypeOfAccess.Local:
{
Log.Logger().LogInformation($"Element with key: \"{key}\" and '{Variables[varName].TypeOfAccess}' type has been replaced with type '{accessType}'");
break;
}
case TypeOfAccess.Default:
{
Log.Logger().LogInformation($"Element with key: \"{key}\" has already created with type '{Variables[varName].TypeOfAccess}'");
return;
}
case TypeOfAccess.Global:
{
Log.Logger().LogWarning($"Element with key: \"{key}\" has already created with type 'Global'");
throw new ArgumentException($"Element with key: \"{key}\" has already created with type 'Global'");
}
}
break;
}
case TypeOfAccess.Default:
{
switch (accessType)
{
case TypeOfAccess.Local:
{
Log.Logger().LogInformation($"Element with key: \"{key}\" and '{Variables[varName].TypeOfAccess}' type has been replaced with type '{accessType}'");
break;
}
}
break;
}
}
}
var variable = new Variable() { Type = type, Value = value, TypeOfAccess = accessType };
Variables.AddOrUpdate(varName, variable, (_, _) => variable);
}
19
Source : AutoDelayTimers.cs
with MIT License
from AlphaYu
with MIT License
from AlphaYu
public void CloseTimer(string key)
{
if (_timers.ContainsKey(key))
{
if (_timers.TryRemove(key, out Timer timer))
{
timer?.Dispose();
}
}
}
19
Source : AutoDelayTimers.cs
with MIT License
from AlphaYu
with MIT License
from AlphaYu
public bool ContainsKey(string key)
{
return _timers.ContainsKey(key);
}
19
Source : ModuleRegistrationExtensions.cs
with MIT License
from AlphaYu
with MIT License
from AlphaYu
public static IModuleRegistrar RegisterModuleIfNotRegistered(this ContainerBuilder builder, IModule module)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
if (module == null)
{
throw new ArgumentNullException(nameof(module));
}
string modelName = module.GetType().FullName;
if (s_KeyValues.ContainsKey(modelName))
return builder.RegisterModule<NullModel>();
if (s_KeyValues.TryAdd(modelName, 1))
return builder.RegisterModule(module);
throw new ArgumentException($"autofac register module fail:{modelName}");
}
19
Source : Entity.cs
with MIT License
from AlternateLife
with MIT License
from AlternateLife
public bool HasData(string key)
{
Contract.NotEmpty(key, nameof(key));
return _data.ContainsKey(key);
}
19
Source : Commands.cs
with MIT License
from AlternateLife
with MIT License
from AlternateLife
public bool DoesCommandExist(string name)
{
Contract.NotEmpty(name, nameof(name));
return _commands.ContainsKey(name);
}
19
Source : SetProvider.cs
with MIT License
from angshuman
with MIT License
from angshuman
public bool Contains(string id)
{
return _setList.ContainsKey(id);
}
19
Source : songdatabase.cs
with GNU Lesser General Public License v3.0
from angturil
with GNU Lesser General Public License v3.0
from angturil
public static async void LoadZIPDirectory(string folder = @"d:\beatsaver")
{
if (MapDatabase.DatabaseLoading) return;
await Task.Run(() =>
{
var startingmem = GC.GetTotalMemory(true);
Instance.QueueChatMessage($"Starting to read archive.");
int addcount = 0;
var StarTime = DateTime.Now;
var di = new DirectoryInfo(folder);
foreach (FileInfo f in di.GetFiles("*.zip"))
{
try
{
var x = System.IO.Compression.ZipFile.OpenRead(f.FullName);
var info = x.Entries.First<ZipArchiveEntry>(e => (e.Name.EndsWith("info.json")));
string id = "";
string version = "";
GetIdFromPath(f.Name, ref id, ref version);
if (MapDatabase.MapLibrary.ContainsKey(id))
{
if (MapLibrary[id].path!="") MapLibrary[id].path = f.FullName;
continue;
}
JSONObject song = JSONObject.Parse(readzipjson(x)).AsObject;
string hash;
JSONNode difficultylevels = song["difficultyLevels"].AsArray;
var FileAcreplacedulator = new StringBuilder();
foreach (var level in difficultylevels)
{
try
{
FileAcreplacedulator.Append(readzipjson(x,level.Value));
}
catch
{
//Instance.QueueChatMessage($"key={level.Key} value={level.Value}");
//throw;
}
}
hash = CreateMD5FromString(FileAcreplacedulator.ToString());
string levelId = string.Join("∎", hash, song["songName"].Value, song["songSubName"].Value, song["authorName"], song["beatsPerMinute"].AsFloat.ToString()) + "∎";
if (LevelId.ContainsKey(levelId))
{
LevelId[levelId].path = f.FullName;
continue;
}
addcount++;
song.Add("id", id);
song.Add("version", version);
song.Add("hashMd5", hash);
new SongMap(song, levelId, f.FullName);
x = null;
}
catch (Exception)
{
Instance.QueueChatMessage($"Failed to process {f.FullName}");
//Instance.QueueChatMessage(ex.ToString());
}
}
Instance.QueueChatMessage($"Archive indexing done, {addcount} files added. ({(DateTime.Now-StarTime).TotalSeconds} secs.");
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
Instance.QueueChatMessage($"hashentries: {SongMap.hashcount} memory: {(GC.GetTotalMemory(false) - startingmem) / 1048576} MB");
});
MapDatabase.DatabaseLoading = false;
}
See More Examples