/// <summary>
        ///     注册对象
        /// </summary>
        public static bool RegistZeroObject(IService obj)
        {
            if (!ZeroObjects.TryAdd(obj.ServiceName, obj))
            {
                return(false);
            }
            ZeroTrace.SystemLog(obj.ServiceName, "RegistZeroObject");

            if (ApplicationState >= StationState.Initialized)
            {
                try
                {
                    obj.OnInitialize();
                    ZeroTrace.SystemLog(obj.ServiceName, "Initialize");
                }
                catch (Exception e)
                {
                    ZeroTrace.WriteException(obj.ServiceName, e, "Initialize");
                }
            }

            //if (obj.GetType().IsSubclassOf(typeof(ZeroStation)))
            //{
            //    ZeroDiscover discover = new ZeroDiscover
            //    {
            //        StationName = obj.StationName
            //    };
            //    discover.FindApies(obj.GetType());
            //    ZeroDiscover.DiscoverApiDocument(obj.GetType());
            //}

            if (ApplicationState != StationState.Run)
            {
                return(true);
            }
            try
            {
                ZeroTrace.SystemLog(obj.ServiceName, "Start");
                obj.OnStart();
            }
            catch (Exception e)
            {
                ZeroTrace.WriteException(obj.ServiceName, e, "Start");
            }
            return(true);
        }
 /// <summary>
 ///     系统启动时调用
 /// </summary>
 internal static void OnZeroInitialize()
 {
     ZeroTrace.SystemLog("Application", "[OnZeroInitialize>>");
     //using (OnceScope.CreateScope(ZeroObjects))
     {
         foreach (var obj in ZeroObjects.Values.ToArray())
         {
             try
             {
                 obj.OnInitialize();
                 ZeroTrace.SystemLog(obj.ServiceName, "Initialize");
             }
             catch (Exception e)
             {
                 ZeroTrace.WriteException(obj.ServiceName, e, "*Initialize");
             }
         }
         ZeroTrace.SystemLog("Application", "<<OnZeroInitialize]");
     }
 }
        /// <summary>
        ///     注销时调用
        /// </summary>
        internal static void OnZeroDestory()
        {
            ZeroTrace.SystemLog("Application", "[OnZeroDestory>>");
            var array = ZeroObjects.Values.ToArray();

            ZeroObjects.Clear();
            foreach (var obj in array)
            {
                try
                {
                    ZeroTrace.SystemLog("OnZeroDestory", obj.ServiceName);
                    obj.OnDestory();
                }
                catch (Exception e)
                {
                    ZeroTrace.WriteException("OnZeroDestory", e, obj.ServiceName);
                }
            }
            ZeroTrace.SystemLog("Application", "<<OnZeroDestory]");

            GC.Collect();

            ZeroTrace.SystemLog("Application", "[OnZeroDispose>>");
            foreach (var obj in array)
            {
                try
                {
                    ZeroTrace.SystemLog("OnZeroDispose", obj.ServiceName);
                    obj.Dispose();
                }
                catch (Exception e)
                {
                    ZeroTrace.WriteException("OnZeroDispose", e, obj.ServiceName);
                }
            }
            ZeroTrace.SystemLog("Application", "<<OnZeroDispose]");
        }