using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using NewLife;
using NewLife.Data;
using XCode;
using XCode.Cache;
using XCode.Configuration;
using XCode.DataAccessLayer;
namespace AntJob.Data.DataSync;
/// <summary>数据表</summary>
[Serializable]
[DataObject]
[Description("数据表")]
[BindIndex("IU_MetaTable_MetaSyncID_SourceTableName_TargetTableName", true, "MetaSyncID,SourceTableName,TargetTableName")]
[BindIndex("IX_MetaTable_Enable", false, "Enable")]
[BindTable("MetaTable", Description = "数据表", ConnName = "DataSync", DbType = DatabaseType.None)]
public partial class MetaTable
{
#region 属性
private Int32 _Id;
/// <summary>编号</summary>
[DisplayName("编号")]
[Description("编号")]
[DataObjectField(true, true, false, 0)]
[BindColumn("Id", "编号", "")]
public Int32 Id { get => _Id; set { if (OnPropertyChanging("Id", value)) { _Id = value; OnPropertyChanged("Id"); } } }
private String _SourceTableName;
/// <summary>源表名</summary>
[DisplayName("源表名")]
[Description("源表名")]
[DataObjectField(false, false, true, 50)]
[BindColumn("SourceTableName", "源表名", "")]
public String SourceTableName { get => _SourceTableName; set { if (OnPropertyChanging("SourceTableName", value)) { _SourceTableName = value; OnPropertyChanged("SourceTableName"); } } }
private String _SourceTablePrefix;
/// <summary>源表前缀</summary>
[DisplayName("源表前缀")]
[Description("源表前缀")]
[DataObjectField(false, false, true, 50)]
[BindColumn("SourceTablePrefix", "源表前缀", "")]
public String SourceTablePrefix { get => _SourceTablePrefix; set { if (OnPropertyChanging("SourceTablePrefix", value)) { _SourceTablePrefix = value; OnPropertyChanged("SourceTablePrefix"); } } }
private String _TargetTableName;
/// <summary>目标表名</summary>
[DisplayName("目标表名")]
[Description("目标表名")]
[DataObjectField(false, false, true, 50)]
[BindColumn("TargetTableName", "目标表名", "")]
public String TargetTableName { get => _TargetTableName; set { if (OnPropertyChanging("TargetTableName", value)) { _TargetTableName = value; OnPropertyChanged("TargetTableName"); } } }
private String _TargetTablePrefix;
/// <summary>目标表前缀</summary>
[DisplayName("目标表前缀")]
[Description("目标表前缀")]
[DataObjectField(false, false, true, 50)]
[BindColumn("TargetTablePrefix", "目标表前缀", "")]
public String TargetTablePrefix { get => _TargetTablePrefix; set { if (OnPropertyChanging("TargetTablePrefix", value)) { _TargetTablePrefix = value; OnPropertyChanged("TargetTablePrefix"); } } }
private Int32 _MaxRows;
/// <summary>最大行数。数据表最大行数,小于10万行时,只用全量同步(清空并批量插入)</summary>
[DisplayName("最大行数")]
[Description("最大行数。数据表最大行数,小于10万行时,只用全量同步(清空并批量插入)")]
[DataObjectField(false, false, false, 0)]
[BindColumn("MaxRows", "最大行数。数据表最大行数,小于10万行时,只用全量同步(清空并批量插入)", "")]
public Int32 MaxRows { get => _MaxRows; set { if (OnPropertyChanging("MaxRows", value)) { _MaxRows = value; OnPropertyChanged("MaxRows"); } } }
private AntJob.Data.Util.SyncModelTypes _SyncMode;
/// <summary>同步模式。全量同步、增量同步</summary>
[DisplayName("同步模式")]
[Description("同步模式。全量同步、增量同步")]
[DataObjectField(false, false, false, 0)]
[BindColumn("SyncMode", "同步模式。全量同步、增量同步", "")]
public AntJob.Data.Util.SyncModelTypes SyncMode { get => _SyncMode; set { if (OnPropertyChanging("SyncMode", value)) { _SyncMode = value; OnPropertyChanged("SyncMode"); } } }
private Int32 _SyncField;
/// <summary>同步字段。大于10万行且增量同步时,需要根据自增Id、雪花Id或更新时间字段去抽取s</summary>
[DisplayName("同步字段")]
[Description("同步字段。大于10万行且增量同步时,需要根据自增Id、雪花Id或更新时间字段去抽取s")]
[DataObjectField(false, false, false, 0)]
[BindColumn("SyncField", "同步字段。大于10万行且增量同步时,需要根据自增Id、雪花Id或更新时间字段去抽取s", "")]
public Int32 SyncField { get => _SyncField; set { if (OnPropertyChanging("SyncField", value)) { _SyncField = value; OnPropertyChanged("SyncField"); } } }
private String _IgnoreField;
/// <summary>忽略字段。忽略不需要同步的字段,与字段映共同生效</summary>
[DisplayName("忽略字段")]
[Description("忽略字段。忽略不需要同步的字段,与字段映共同生效")]
[DataObjectField(false, false, true, 1000)]
[BindColumn("IgnoreField", "忽略字段。忽略不需要同步的字段,与字段映共同生效", "")]
public String IgnoreField { get => _IgnoreField; set { if (OnPropertyChanging("IgnoreField", value)) { _IgnoreField = value; OnPropertyChanged("IgnoreField"); } } }
private String _FieldMap;
/// <summary>字段映射。仅同步指定字段,并映射到目标库的另一个字段</summary>
[DisplayName("字段映射")]
[Description("字段映射。仅同步指定字段,并映射到目标库的另一个字段")]
[DataObjectField(false, false, true, 1000)]
[BindColumn("FieldMap", "字段映射。仅同步指定字段,并映射到目标库的另一个字段", "")]
public String FieldMap { get => _FieldMap; set { if (OnPropertyChanging("FieldMap", value)) { _FieldMap = value; OnPropertyChanged("FieldMap"); } } }
private String _WhereSql;
/// <summary>条件字句。仅同步满足条件的数据</summary>
[DisplayName("条件字句")]
[Description("条件字句。仅同步满足条件的数据")]
[DataObjectField(false, false, true, 200)]
[BindColumn("WhereSql", "条件字句。仅同步满足条件的数据", "")]
public String WhereSql { get => _WhereSql; set { if (OnPropertyChanging("WhereSql", value)) { _WhereSql = value; OnPropertyChanged("WhereSql"); } } }
private String _CreateSql;
/// <summary>建表语句</summary>
[DisplayName("建表语句")]
[Description("建表语句")]
[DataObjectField(false, false, true, 1000)]
[BindColumn("CreateSql", "建表语句", "")]
public String CreateSql { get => _CreateSql; set { if (OnPropertyChanging("CreateSql", value)) { _CreateSql = value; OnPropertyChanged("CreateSql"); } } }
private Int32 _MetaSyncID;
/// <summary>数据同步</summary>
[DisplayName("数据同步")]
[Description("数据同步")]
[DataObjectField(false, false, false, 0)]
[BindColumn("MetaSyncID", "数据同步", "")]
public Int32 MetaSyncID { get => _MetaSyncID; set { if (OnPropertyChanging("MetaSyncID", value)) { _MetaSyncID = value; OnPropertyChanged("MetaSyncID"); } } }
private Int32 _TaskID;
/// <summary>任务编号</summary>
[DisplayName("任务编号")]
[Description("任务编号")]
[DataObjectField(false, false, false, 0)]
[BindColumn("TaskID", "任务编号", "")]
public Int32 TaskID { get => _TaskID; set { if (OnPropertyChanging("TaskID", value)) { _TaskID = value; OnPropertyChanged("TaskID"); } } }
private DateTime _LastTime;
/// <summary>最后时间</summary>
[DisplayName("最后时间")]
[Description("最后时间")]
[DataObjectField(false, false, true, 0)]
[BindColumn("LastTime", "最后时间", "")]
public DateTime LastTime { get => _LastTime; set { if (OnPropertyChanging("LastTime", value)) { _LastTime = value; OnPropertyChanged("LastTime"); } } }
private Boolean _Enable;
/// <summary>启用</summary>
[DisplayName("启用")]
[Description("启用")]
[DataObjectField(false, false, false, 0)]
[BindColumn("Enable", "启用", "")]
public Boolean Enable { get => _Enable; set { if (OnPropertyChanging("Enable", value)) { _Enable = value; OnPropertyChanged("Enable"); } } }
private Int32 _CreateUserID;
/// <summary>创建人</summary>
[Category("扩展")]
[DisplayName("创建人")]
[Description("创建人")]
[DataObjectField(false, false, false, 0)]
[BindColumn("CreateUserID", "创建人", "")]
public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }
private String _CreateUser;
/// <summary>创建者</summary>
[Category("扩展")]
[DisplayName("创建者")]
[Description("创建者")]
[DataObjectField(false, false, true, 50)]
[BindColumn("CreateUser", "创建者", "")]
public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }
private DateTime _CreateTime;
/// <summary>创建时间</summary>
[Category("扩展")]
[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>
[Category("扩展")]
[DisplayName("创建地址")]
[Description("创建地址")]
[DataObjectField(false, false, true, 50)]
[BindColumn("CreateIP", "创建地址", "")]
public String CreateIP { get => _CreateIP; set { if (OnPropertyChanging("CreateIP", value)) { _CreateIP = value; OnPropertyChanged("CreateIP"); } } }
private Int32 _UpdateUserID;
/// <summary>更新人</summary>
[Category("扩展")]
[DisplayName("更新人")]
[Description("更新人")]
[DataObjectField(false, false, false, 0)]
[BindColumn("UpdateUserID", "更新人", "")]
public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }
private String _UpdateUser;
/// <summary>更新者</summary>
[Category("扩展")]
[DisplayName("更新者")]
[Description("更新者")]
[DataObjectField(false, false, true, 50)]
[BindColumn("UpdateUser", "更新者", "")]
public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }
private DateTime _UpdateTime;
/// <summary>更新时间</summary>
[Category("扩展")]
[DisplayName("更新时间")]
[Description("更新时间")]
[DataObjectField(false, false, true, 0)]
[BindColumn("UpdateTime", "更新时间", "")]
public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
private String _UpdateIP;
/// <summary>更新地址</summary>
[Category("扩展")]
[DisplayName("更新地址")]
[Description("更新地址")]
[DataObjectField(false, false, true, 50)]
[BindColumn("UpdateIP", "更新地址", "")]
public String UpdateIP { get => _UpdateIP; set { if (OnPropertyChanging("UpdateIP", value)) { _UpdateIP = value; OnPropertyChanged("UpdateIP"); } } }
private String _Remark;
/// <summary>备注</summary>
[Category("扩展")]
[DisplayName("备注")]
[Description("备注")]
[DataObjectField(false, false, true, 500)]
[BindColumn("Remark", "备注", "")]
public String Remark { get => _Remark; set { if (OnPropertyChanging("Remark", value)) { _Remark = value; OnPropertyChanged("Remark"); } } }
#endregion
#region 获取/设置 字段值
/// <summary>获取/设置 字段值</summary>
/// <param name="name">字段名</param>
/// <returns></returns>
public override Object this[String name]
{
get => name switch
{
"Id" => _Id,
"SourceTableName" => _SourceTableName,
"SourceTablePrefix" => _SourceTablePrefix,
"TargetTableName" => _TargetTableName,
"TargetTablePrefix" => _TargetTablePrefix,
"MaxRows" => _MaxRows,
"SyncMode" => _SyncMode,
"SyncField" => _SyncField,
"IgnoreField" => _IgnoreField,
"FieldMap" => _FieldMap,
"WhereSql" => _WhereSql,
"CreateSql" => _CreateSql,
"MetaSyncID" => _MetaSyncID,
"TaskID" => _TaskID,
"LastTime" => _LastTime,
"Enable" => _Enable,
"CreateUserID" => _CreateUserID,
"CreateUser" => _CreateUser,
"CreateTime" => _CreateTime,
"CreateIP" => _CreateIP,
"UpdateUserID" => _UpdateUserID,
"UpdateUser" => _UpdateUser,
"UpdateTime" => _UpdateTime,
"UpdateIP" => _UpdateIP,
"Remark" => _Remark,
_ => base[name]
};
set
{
switch (name)
{
case "Id": _Id = value.ToInt(); break;
case "SourceTableName": _SourceTableName = Convert.ToString(value); break;
case "SourceTablePrefix": _SourceTablePrefix = Convert.ToString(value); break;
case "TargetTableName": _TargetTableName = Convert.ToString(value); break;
case "TargetTablePrefix": _TargetTablePrefix = Convert.ToString(value); break;
case "MaxRows": _MaxRows = value.ToInt(); break;
case "SyncMode": _SyncMode = (AntJob.Data.Util.SyncModelTypes)value.ToInt(); break;
case "SyncField": _SyncField = value.ToInt(); break;
case "IgnoreField": _IgnoreField = Convert.ToString(value); break;
case "FieldMap": _FieldMap = Convert.ToString(value); break;
case "WhereSql": _WhereSql = Convert.ToString(value); break;
case "CreateSql": _CreateSql = Convert.ToString(value); break;
case "MetaSyncID": _MetaSyncID = value.ToInt(); break;
case "TaskID": _TaskID = value.ToInt(); break;
case "LastTime": _LastTime = value.ToDateTime(); break;
case "Enable": _Enable = value.ToBoolean(); break;
case "CreateUserID": _CreateUserID = value.ToInt(); break;
case "CreateUser": _CreateUser = Convert.ToString(value); break;
case "CreateTime": _CreateTime = value.ToDateTime(); break;
case "CreateIP": _CreateIP = Convert.ToString(value); break;
case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
case "UpdateIP": _UpdateIP = Convert.ToString(value); break;
case "Remark": _Remark = Convert.ToString(value); break;
default: base[name] = value; break;
}
}
}
#endregion
#region 关联映射
#endregion
#region 字段名
/// <summary>取得数据表字段信息的快捷方式</summary>
public partial class _
{
/// <summary>编号</summary>
public static readonly Field Id = FindByName("Id");
/// <summary>源表名</summary>
public static readonly Field SourceTableName = FindByName("SourceTableName");
/// <summary>源表前缀</summary>
public static readonly Field SourceTablePrefix = FindByName("SourceTablePrefix");
/// <summary>目标表名</summary>
public static readonly Field TargetTableName = FindByName("TargetTableName");
/// <summary>目标表前缀</summary>
public static readonly Field TargetTablePrefix = FindByName("TargetTablePrefix");
/// <summary>最大行数。数据表最大行数,小于10万行时,只用全量同步(清空并批量插入)</summary>
public static readonly Field MaxRows = FindByName("MaxRows");
/// <summary>同步模式。全量同步、增量同步</summary>
public static readonly Field SyncMode = FindByName("SyncMode");
/// <summary>同步字段。大于10万行且增量同步时,需要根据自增Id、雪花Id或更新时间字段去抽取s</summary>
public static readonly Field SyncField = FindByName("SyncField");
/// <summary>忽略字段。忽略不需要同步的字段,与字段映共同生效</summary>
public static readonly Field IgnoreField = FindByName("IgnoreField");
/// <summary>字段映射。仅同步指定字段,并映射到目标库的另一个字段</summary>
public static readonly Field FieldMap = FindByName("FieldMap");
/// <summary>条件字句。仅同步满足条件的数据</summary>
public static readonly Field WhereSql = FindByName("WhereSql");
/// <summary>建表语句</summary>
public static readonly Field CreateSql = FindByName("CreateSql");
/// <summary>数据同步</summary>
public static readonly Field MetaSyncID = FindByName("MetaSyncID");
/// <summary>任务编号</summary>
public static readonly Field TaskID = FindByName("TaskID");
/// <summary>最后时间</summary>
public static readonly Field LastTime = FindByName("LastTime");
/// <summary>启用</summary>
public static readonly Field Enable = FindByName("Enable");
/// <summary>创建人</summary>
public static readonly Field CreateUserID = FindByName("CreateUserID");
/// <summary>创建者</summary>
public static readonly Field CreateUser = FindByName("CreateUser");
/// <summary>创建时间</summary>
public static readonly Field CreateTime = FindByName("CreateTime");
/// <summary>创建地址</summary>
public static readonly Field CreateIP = FindByName("CreateIP");
/// <summary>更新人</summary>
public static readonly Field UpdateUserID = FindByName("UpdateUserID");
/// <summary>更新者</summary>
public static readonly Field UpdateUser = FindByName("UpdateUser");
/// <summary>更新时间</summary>
public static readonly Field UpdateTime = FindByName("UpdateTime");
/// <summary>更新地址</summary>
public static readonly Field UpdateIP = FindByName("UpdateIP");
/// <summary>备注</summary>
public static readonly Field Remark = FindByName("Remark");
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 SourceTableName = "SourceTableName";
/// <summary>源表前缀</summary>
public const String SourceTablePrefix = "SourceTablePrefix";
/// <summary>目标表名</summary>
public const String TargetTableName = "TargetTableName";
/// <summary>目标表前缀</summary>
public const String TargetTablePrefix = "TargetTablePrefix";
/// <summary>最大行数。数据表最大行数,小于10万行时,只用全量同步(清空并批量插入)</summary>
public const String MaxRows = "MaxRows";
/// <summary>同步模式。全量同步、增量同步</summary>
public const String SyncMode = "SyncMode";
/// <summary>同步字段。大于10万行且增量同步时,需要根据自增Id、雪花Id或更新时间字段去抽取s</summary>
public const String SyncField = "SyncField";
/// <summary>忽略字段。忽略不需要同步的字段,与字段映共同生效</summary>
public const String IgnoreField = "IgnoreField";
/// <summary>字段映射。仅同步指定字段,并映射到目标库的另一个字段</summary>
public const String FieldMap = "FieldMap";
/// <summary>条件字句。仅同步满足条件的数据</summary>
public const String WhereSql = "WhereSql";
/// <summary>建表语句</summary>
public const String CreateSql = "CreateSql";
/// <summary>数据同步</summary>
public const String MetaSyncID = "MetaSyncID";
/// <summary>任务编号</summary>
public const String TaskID = "TaskID";
/// <summary>最后时间</summary>
public const String LastTime = "LastTime";
/// <summary>启用</summary>
public const String Enable = "Enable";
/// <summary>创建人</summary>
public const String CreateUserID = "CreateUserID";
/// <summary>创建者</summary>
public const String CreateUser = "CreateUser";
/// <summary>创建时间</summary>
public const String CreateTime = "CreateTime";
/// <summary>创建地址</summary>
public const String CreateIP = "CreateIP";
/// <summary>更新人</summary>
public const String UpdateUserID = "UpdateUserID";
/// <summary>更新者</summary>
public const String UpdateUser = "UpdateUser";
/// <summary>更新时间</summary>
public const String UpdateTime = "UpdateTime";
/// <summary>更新地址</summary>
public const String UpdateIP = "UpdateIP";
/// <summary>备注</summary>
public const String Remark = "Remark";
}
#endregion
}
|