数据接口返回类餐参考

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TheBiz.Common
{
    public interface IResult
    {
        /// <summary>
        /// 返回值
        /// </summary>
        EResult Code { set; get; }
        /// <summary>
        /// 错误原因
        /// </summary>
        string Msg { set; get; }
    }

    public class SingleResult<T> : IResult
    {
        public T Data { set; get; }
        public EResult Code { set; get; }
        public string Msg { set; get; }
    }
    public class BatchResult<T> : IResult
    {
        public List<T> Data { set; get; }
        public EResult Code { set; get; }
        public string Msg { set; get; }
    }

    public enum EResult
    {
        /// <summary>
        /// 10000	SUCCESS	操作成功
        /// </summary>
        SUCCESS = 10000,
        /// <summary>
        /// 10001	URL_REQUEST_ERROR	异常接口调用
        /// </summary>
        URL_REQUEST_ERROR = 10001,
        /// <summary>
        /// 10002	PROCESS_FAIL	服务器处理失败
        /// </summary>
        PROCESS_FAIL = 10002,
        /// <summary>
        /// 10003	TOO_MANY_REQUEST	访问过于频繁
        /// </summary>
        TOO_MANY_REQUEST = 10003,
        /// <summary>
        /// 10004	PERMISSION_DENY	用户服务无权限
        /// </summary>
        PERMISSION_DENY = 10004,
        /// <summary>
        /// 10005	AUTHENTICATION_EXPIRED	身份认证过期,请重新登录
        /// </summary>
        AUTHENTICATION_EXPIRED = 10005,
    }

    public class ResultValue<T>
    {
        public T Value { set; get; }
    }
}

  

posted @ 2015-04-05 21:58  dapeng888  阅读(158)  评论(0编辑  收藏  举报