diff --git a/OSS.Common/ComModels/Enums/ResultTypes.cs b/OSS.Common/ComModels/Enums/ResultTypes.cs index 98a8099..b6b824a 100644 --- a/OSS.Common/ComModels/Enums/ResultTypes.cs +++ b/OSS.Common/ComModels/Enums/ResultTypes.cs @@ -23,7 +23,7 @@ namespace OSS.Common.ComModels.Enums /// 成功 /// [OSDescript("正常")] None = 0, - + /// /// 无法连接 /// @@ -33,16 +33,26 @@ namespace OSS.Common.ComModels.Enums /// 超时 /// [OSDescript("超时")] TimeOut = 200, - + /// /// 任务失败 /// [OSDescript("任务失败")] TaskFailed = 300, + /// + /// 等待重试 + /// + [OSDescript("等待重试")] WaitRetry = 400, + /// /// 内部错误(服务器错误) /// - [OSDescript("内部错误")] InnerError = 500, + [OSDescript("系统错误")] InnerError = 500, + + /// + /// 等待重试 + /// + [OSDescript("等待响应")] WaitingResponse = 600, } /// diff --git a/OSS.Common/ComUtils/InsContainer.cs b/OSS.Common/ComUtils/InsContainer.cs index b132451..e812040 100644 --- a/OSS.Common/ComUtils/InsContainer.cs +++ b/OSS.Common/ComUtils/InsContainer.cs @@ -17,11 +17,28 @@ namespace OSS.Common.ComUtils get { if (instanceCreater == null) - throw new Exception(string.Concat( " 并没有设置", typeof(T).Name, "对应的映射类型! ")); + throw new Exception(string.Concat(" 并没有设置", typeof(T).Name, "对应的映射类型! ")); return instanceCreater(); } } + /// + /// 获取类型实例 + /// + /// + /// + public static bool TryGet(out T t) + { + if (instanceCreater == null) + { + t = default(T); + return false; + } + + t = instanceCreater(); + return true; + } + private static Func instanceCreater; private static T instance; @@ -37,7 +54,7 @@ namespace OSS.Common.ComUtils if (instanceCreater == null) instanceCreater = () => { - if(isSingle) return new TInstance(); + if (isSingle) return new TInstance(); if (instance != null) return instance; return instance = new TInstance();