public class EntityConfigurationException : Exception { public EntityConfigurationException(string message) : base(message) { } }
/// <summary> /// *****异常 /// </summary> public class *****Exception : Exception { /// <summary> /// 操作结果 /// </summary> public OPResult Result { get; set; } /// <summary> /// 构造函数 /// </summary> /// <param name="opr">操作结果</param> /// <param name="message">消息内容</param> public *****Exception(OPResult opr, String message) : base(message) { Result = opr; } /// <summary> /// 构造函数 /// </summary> /// <param name="opr">返回代码</param> /// <param name="message">错误消息</param> /// <param name="e">原始异常</param> public *****Exception(OPResult opr, String message, Exception e) : base(message, e) { Result = opr; } /// <summary> /// 构造函数 /// </summary> /// <param name="message">消息内容</param> /// <param name="e">异常栈</param> public *****Exception(String message, Exception e) : base(message, e) { Result = OPResult.ServerError; } /// <summary> /// 构造函数 /// </summary> /// <param name="e">异常堆栈</param> public *****Exception(Exception e) : base("Server Operation Failed", e) { Result = OPResult.ServerError; } } /// <summary> /// 操作结果 /// </summary> public class *****OPResult { /// <summary> /// 操作是否成功 /// </summary> public Boolean OPSucess { get; set; } /// <summary> /// 结果代码 /// </summary> public OPResult OPCode { get; set; } /// <summary> /// 操作结果,类型可变,由Type进行判断 /// </summary> public Object ResultContent { get; set; } /// <summary> /// 返回类型名称 /// </summary> public String Type { get; set; } /// <summary> /// 返回是否为数组 /// </summary> public Boolean IsArray { get; set; } }
/// <summary> /// 操作结果 /// </summary> public enum OPResult : int { /// <summary> /// 成功 /// </summary> Success = 0, /// <summary> /// 无效参数 /// </summary> InvalidParameters = 1, /// <summary> /// 无效用户 /// </summary> InvalidUser = 2, /// <summary> /// 无效Token /// </summary> InvalidToken = 3, /// <summary> /// 参数缺失 /// </summary> MissingParameters=4, /// <summary> /// 服务器端错误 /// </summary> ServerError = 0xFF }