コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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]);
                }
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public bool TryGetValue(string formatterName, out IFormatProvider formatProvider)
 {
     return(_formatProviders.TryGetValue(formatterName, out formatProvider));
 }
コード例 #5
0
 public bool TryGetValue(string formatterName, out IFormatProvider propertyManager)
 {
     return(_propertyManagers.TryGetValue(formatterName, out propertyManager));
 }