Пример #1
0
        /// <summary>
        /// Initializes this CustomActionsManager. This method is thread-safe and won't do
        /// anything if the ActionsManager is already initialized.
        /// </summary>
        public virtual void Init(IReadOnlyZetboxContext ctx)
        {
            lock (_initLock)
            {
                var implType = this.GetType();
                if (_initImpls.ContainsKey(implType))
                {
                    return;
                }
                try
                {
                    Log.InfoFormat("Initializing Actions for [{0}] by [{1}]", ExtraSuffix, implType.Name);
                    Log.TraceTotalMemory("Before BaseCustomActionsManager.Init()");

                    ReflectMethods(ctx);
                    CreateInvokeInfosForDataTypes(ctx);

                    foreach (var key in _reflectedMethods.Where(i => !_attachedMethods.ContainsKey(i.Key)).Select(i => i.Key))
                    {
                        Log.Warn(string.Format("Couldn't find any method for Invocation {0}", key));
                    }

                    Log.TraceTotalMemory("After BaseCustomActionsManager.Init()");
                }
                finally
                {
                    _initImpls[implType] = implType;
                }
            }
        }