支持查询应用、客户端、线程
智能石头 authored at 2020-10-28 15:43:39
8.74 KiB
Stardust
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace Stardust.Data
{
    /// <summary>应用日志</summary>
    [Serializable]
    [DataObject]
    [Description("应用日志")]
    [BindIndex("IX_AppLog_AppId_ClientId_ThreadId_Id", false, "AppId,ClientId,ThreadId,Id")]
    [BindIndex("IX_AppLog_AppId_Id", false, "AppId,Id")]
    [BindTable("AppLog", Description = "应用日志", ConnName = "AppLog", DbType = DatabaseType.None)]
    public partial class AppLog
    {
        #region 属性
        private Int64 _Id;
        /// <summary>编号</summary>
        [DisplayName("编号")]
        [Description("编号")]
        [DataObjectField(true, false, false, 0)]
        [BindColumn("Id", "编号", "")]
        public Int64 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }

        private Int32 _AppId;
        /// <summary>应用</summary>
        [DisplayName("应用")]
        [Description("应用")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("AppId", "应用", "", Master = true)]
        public Int32 AppId { get => _AppId; set { if (OnPropertyChanging("AppId", value)) { _AppId = value; OnPropertyChanged("AppId"); } } }

        private String _ClientId;
        /// <summary>客户端</summary>
        [DisplayName("客户端")]
        [Description("客户端")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("ClientId", "客户端", "", Master = true)]
        public String ClientId { get => _ClientId; set { if (OnPropertyChanging("ClientId", value)) { _ClientId = value; OnPropertyChanged("ClientId"); } } }

        private String _Time;
        /// <summary>时间</summary>
        [DisplayName("时间")]
        [Description("时间")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("Time", "时间", "")]
        public String Time { get => _Time; set { if (OnPropertyChanging("Time", value)) { _Time = value; OnPropertyChanged("Time"); } } }

        private String _ThreadId;
        /// <summary>线程</summary>
        [DisplayName("线程")]
        [Description("线程")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("ThreadId", "线程", "")]
        public String ThreadId { get => _ThreadId; set { if (OnPropertyChanging("ThreadId", value)) { _ThreadId = value; OnPropertyChanged("ThreadId"); } } }

        private String _Kind;
        /// <summary>类型</summary>
        [DisplayName("类型")]
        [Description("类型")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("Kind", "类型", "")]
        public String Kind { get => _Kind; set { if (OnPropertyChanging("Kind", value)) { _Kind = value; OnPropertyChanged("Kind"); } } }

        private String _Name;
        /// <summary>名称</summary>
        [DisplayName("名称")]
        [Description("名称")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("Name", "名称", "")]
        public String Name { get => _Name; set { if (OnPropertyChanging("Name", value)) { _Name = value; OnPropertyChanged("Name"); } } }

        private String _Message;
        /// <summary>内容</summary>
        [DisplayName("内容")]
        [Description("内容")]
        [DataObjectField(false, false, true, -1)]
        [BindColumn("Message", "内容", "")]
        public String Message { get => _Message; set { if (OnPropertyChanging("Message", value)) { _Message = value; OnPropertyChanged("Message"); } } }

        private DateTime _CreateTime;
        /// <summary>创建时间</summary>
        [DisplayName("创建时间")]
        [Description("创建时间")]
        [DataObjectField(false, false, true, 0)]
        [BindColumn("CreateTime", "创建时间", "")]
        public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }

        private String _CreateIP;
        /// <summary>创建地址</summary>
        [DisplayName("创建地址")]
        [Description("创建地址")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("CreateIP", "创建地址", "")]
        public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "Id": return _Id;
                    case "AppId": return _AppId;
                    case "ClientId": return _ClientId;
                    case "Time": return _Time;
                    case "ThreadId": return _ThreadId;
                    case "Kind": return _Kind;
                    case "Name": return _Name;
                    case "Message": return _Message;
                    case "CreateTime": return _CreateTime;
                    case "CreateIP": return _CreateIP;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "Id": _Id = value.ToLong(); break;
                    case "AppId": _AppId = value.ToInt(); break;
                    case "ClientId": _ClientId = Convert.ToString(value); break;
                    case "Time": _Time = Convert.ToString(value); break;
                    case "ThreadId": _ThreadId = Convert.ToString(value); break;
                    case "Kind": _Kind = Convert.ToString(value); break;
                    case "Name": _Name = Convert.ToString(value); break;
                    case "Message": _Message = Convert.ToString(value); break;
                    case "CreateTime": _CreateTime = value.ToDateTime(); break;
                    case "CreateIP": _CreateIP = Convert.ToString(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得应用日志字段信息的快捷方式</summary>
        public partial class _
        {
            /// <summary>编号</summary>
            public static readonly Field Id = FindByName("Id");

            /// <summary>应用</summary>
            public static readonly Field AppId = FindByName("AppId");

            /// <summary>客户端</summary>
            public static readonly Field ClientId = FindByName("ClientId");

            /// <summary>时间</summary>
            public static readonly Field Time = FindByName("Time");

            /// <summary>线程</summary>
            public static readonly Field ThreadId = FindByName("ThreadId");

            /// <summary>类型</summary>
            public static readonly Field Kind = FindByName("Kind");

            /// <summary>名称</summary>
            public static readonly Field Name = FindByName("Name");

            /// <summary>内容</summary>
            public static readonly Field Message = FindByName("Message");

            /// <summary>创建时间</summary>
            public static readonly Field CreateTime = FindByName("CreateTime");

            /// <summary>创建地址</summary>
            public static readonly Field CreateIP = FindByName("CreateIP");

            static Field FindByName(String name) => Meta.Table.FindByName(name);
        }

        /// <summary>取得应用日志字段名称的快捷方式</summary>
        public partial class __
        {
            /// <summary>编号</summary>
            public const String Id = "Id";

            /// <summary>应用</summary>
            public const String AppId = "AppId";

            /// <summary>客户端</summary>
            public const String ClientId = "ClientId";

            /// <summary>时间</summary>
            public const String Time = "Time";

            /// <summary>线程</summary>
            public const String ThreadId = "ThreadId";

            /// <summary>类型</summary>
            public const String Kind = "Kind";

            /// <summary>名称</summary>
            public const String Name = "Name";

            /// <summary>内容</summary>
            public const String Message = "Message";

            /// <summary>创建时间</summary>
            public const String CreateTime = "CreateTime";

            /// <summary>创建地址</summary>
            public const String CreateIP = "CreateIP";
        }
        #endregion
    }
}