public static ChoQueuedExecutionService GetService(string name) { ChoQueuedExecutionService queuedExecutionService = null; if (_globalQueuedExecutionServices.TryGetValue(name, out queuedExecutionService)) { return(queuedExecutionService); } lock (_globalQueuedExecutionServices.SyncRoot) { if (_globalQueuedExecutionServices.TryGetValue(name, out queuedExecutionService)) { return(queuedExecutionService); } queuedExecutionService = new ChoQueuedExecutionService(name, true); _globalQueuedExecutionServices.Add(name, queuedExecutionService); return(queuedExecutionService); } }
private static IChoProfile Register(string name, string profileName, MemberInfo memberInfo, string typeProfileName, ChoProfileAttribute memberProfileAttribute, ChoProfileAttribute typeProfileAttribute) { lock (MemberProfileCache.SyncRoot) { IChoProfile profile = null; if (MemberProfileCache.TryGetValue(profileName, out profile)) { return(profile); } if (!String.IsNullOrEmpty(typeProfileName) && !MemberProfileCache.ContainsKey(typeProfileName)) { if (typeProfileAttribute != null) { IChoProfile profile1 = typeProfileAttribute.ConstructProfile(ChoThreadLocalStorage.Target, null); //SetAsNotDisposed(profile1, false); MemberProfileCache.Add(typeProfileName, profile1); } else { MemberProfileCache.Add(typeProfileName, GlobalProfile); } } if (memberProfileAttribute == null) { return(MemberProfileCache[typeProfileName]); } else { IChoProfile profile1 = memberProfileAttribute.ConstructProfile(ChoThreadLocalStorage.Target, MemberProfileCache[typeProfileName]); //SetAsNotDisposed(profile1, false); MemberProfileCache.Add(profileName, profile1); return(MemberProfileCache[profileName]); } } }
internal static object GetObject(Type type, bool beforeFieldInit) { if (type == null) { throw new ArgumentNullException("type"); } object instance; if (IsConstructing(type)) { instance = New(type, null); if (instance != null) { ChoObjectInitializer.Initialize(instance, beforeFieldInit); } } else { _globalObjectCache.TryGetValue(type, out instance); } return(instance); }
public bool TryGetValue(string formatterName, out IFormatProvider formatProvider) { return(_formatProviders.TryGetValue(formatterName, out formatProvider)); }
public bool TryGetValue(string formatterName, out IFormatProvider propertyManager) { return(_propertyManagers.TryGetValue(formatterName, out propertyManager)); }