using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;
namespace XCode.Membership
{
/// 菜单
[Serializable]
[DataObject]
[Description("菜单")]
[BindIndex("IX_Menu2_Name", false, "Name")]
[BindIndex("IU_Menu2_ParentID_Name", true, "ParentID,Name")]
[BindTable("Menu2", Description = "菜单", ConnName = "test", DbType = DatabaseType.None)]
public partial class Menu2 : IMenu2
{
#region 属性
private Int32 _ID;
/// 编号
[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 _Name;
/// 名称
[DisplayName("名称")]
[Description("名称")]
[DataObjectField(false, false, false, 50)]
[BindColumn("Name", "名称", "", Master = true)]
public String Name { get => _Name; set { if (OnPropertyChanging(__.Name, value)) { _Name = value; OnPropertyChanged(__.Name); } } }
private String _DisplayName;
/// 显示名
[DisplayName("显示名")]
[Description("显示名")]
[DataObjectField(false, false, true, 50)]
[BindColumn("DisplayName", "显示名", "")]
public String DisplayName { get => _DisplayName; set { if (OnPropertyChanging(__.DisplayName, value)) { _DisplayName = value; OnPropertyChanged(__.DisplayName); } } }
private String _FullName;
/// 全名
[DisplayName("全名")]
[Description("全名")]
[DataObjectField(false, false, true, 200)]
[BindColumn("FullName", "全名", "")]
public String FullName { get => _FullName; set { if (OnPropertyChanging(__.FullName, value)) { _FullName = value; OnPropertyChanged(__.FullName); } } }
private Int32 _ParentID;
/// 父编号
[DisplayName("父编号")]
[Description("父编号")]
[DataObjectField(false, false, false, 0)]
[BindColumn("ParentID", "父编号", "")]
public Int32 ParentID { get => _ParentID; set { if (OnPropertyChanging(__.ParentID, value)) { _ParentID = value; OnPropertyChanged(__.ParentID); } } }
private String _Url;
/// 链接
[DisplayName("链接")]
[Description("链接")]
[DataObjectField(false, false, true, 200)]
[BindColumn("Url", "链接", "")]
public String Url { get => _Url; set { if (OnPropertyChanging(__.Url, value)) { _Url = value; OnPropertyChanged(__.Url); } } }
private Int32 _Sort;
/// 排序
[DisplayName("排序")]
[Description("排序")]
[DataObjectField(false, false, false, 0)]
[BindColumn("Sort", "排序", "")]
public Int32 Sort { get => _Sort; set { if (OnPropertyChanging(__.Sort, value)) { _Sort = value; OnPropertyChanged(__.Sort); } } }
private String _Icon;
/// 图标
[DisplayName("图标")]
[Description("图标")]
[DataObjectField(false, false, true, 50)]
[BindColumn("Icon", "图标", "")]
public String Icon { get => _Icon; set { if (OnPropertyChanging(__.Icon, value)) { _Icon = value; OnPropertyChanged(__.Icon); } } }
private Boolean _Visible;
/// 可见
[DisplayName("可见")]
[Description("可见")]
[DataObjectField(false, false, false, 0)]
[BindColumn("Visible", "可见", "")]
public Boolean Visible { get => _Visible; set { if (OnPropertyChanging(__.Visible, value)) { _Visible = value; OnPropertyChanged(__.Visible); } } }
private Boolean _Necessary;
/// 必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色
[DisplayName("必要")]
[Description("必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色")]
[DataObjectField(false, false, false, 0)]
[BindColumn("Necessary", "必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色", "")]
public Boolean Necessary { get => _Necessary; set { if (OnPropertyChanging(__.Necessary, value)) { _Necessary = value; OnPropertyChanged(__.Necessary); } } }
private String _Permission;
/// 权限子项。逗号分隔,每个权限子项名值竖线分隔
[DisplayName("权限子项")]
[Description("权限子项。逗号分隔,每个权限子项名值竖线分隔")]
[DataObjectField(false, false, true, 200)]
[BindColumn("Permission", "权限子项。逗号分隔,每个权限子项名值竖线分隔", "")]
public String Permission { get => _Permission; set { if (OnPropertyChanging(__.Permission, value)) { _Permission = value; OnPropertyChanged(__.Permission); } } }
private String _Remark;
/// 备注
[DisplayName("备注")]
[Description("备注")]
[DataObjectField(false, false, true, 200)]
[BindColumn("Remark", "备注", "")]
public String Remark { get => _Remark; set { if (OnPropertyChanging(__.Remark, value)) { _Remark = value; OnPropertyChanged(__.Remark); } } }
#endregion
#region 获取/设置 字段值
/// 获取/设置 字段值
/// 字段名
///
public override Object this[String name]
{
get
{
switch (name)
{
case __.ID: return _ID;
case __.Name: return _Name;
case __.DisplayName: return _DisplayName;
case __.FullName: return _FullName;
case __.ParentID: return _ParentID;
case __.Url: return _Url;
case __.Sort: return _Sort;
case __.Icon: return _Icon;
case __.Visible: return _Visible;
case __.Necessary: return _Necessary;
case __.Permission: return _Permission;
case __.Remark: return _Remark;
default: return base[name];
}
}
set
{
switch (name)
{
case __.ID: _ID = value.ToInt(); break;
case __.Name: _Name = Convert.ToString(value); break;
case __.DisplayName: _DisplayName = Convert.ToString(value); break;
case __.FullName: _FullName = Convert.ToString(value); break;
case __.ParentID: _ParentID = value.ToInt(); break;
case __.Url: _Url = Convert.ToString(value); break;
case __.Sort: _Sort = value.ToInt(); break;
case __.Icon: _Icon = Convert.ToString(value); break;
case __.Visible: _Visible = value.ToBoolean(); break;
case __.Necessary: _Necessary = value.ToBoolean(); break;
case __.Permission: _Permission = Convert.ToString(value); break;
case __.Remark: _Remark = Convert.ToString(value); break;
default: base[name] = value; break;
}
}
}
#endregion
#region 字段名
/// 取得菜单字段信息的快捷方式
public partial class _
{
/// 编号
public static readonly Field ID = FindByName(__.ID);
/// 名称
public static readonly Field Name = FindByName(__.Name);
/// 显示名
public static readonly Field DisplayName = FindByName(__.DisplayName);
/// 全名
public static readonly Field FullName = FindByName(__.FullName);
/// 父编号
public static readonly Field ParentID = FindByName(__.ParentID);
/// 链接
public static readonly Field Url = FindByName(__.Url);
/// 排序
public static readonly Field Sort = FindByName(__.Sort);
/// 图标
public static readonly Field Icon = FindByName(__.Icon);
/// 可见
public static readonly Field Visible = FindByName(__.Visible);
/// 必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色
public static readonly Field Necessary = FindByName(__.Necessary);
/// 权限子项。逗号分隔,每个权限子项名值竖线分隔
public static readonly Field Permission = FindByName(__.Permission);
/// 备注
public static readonly Field Remark = FindByName(__.Remark);
static Field FindByName(String name) => Meta.Table.FindByName(name);
}
/// 取得菜单字段名称的快捷方式
public partial class __
{
/// 编号
public const String ID = "ID";
/// 名称
public const String Name = "Name";
/// 显示名
public const String DisplayName = "DisplayName";
/// 全名
public const String FullName = "FullName";
/// 父编号
public const String ParentID = "ParentID";
/// 链接
public const String Url = "Url";
/// 排序
public const String Sort = "Sort";
/// 图标
public const String Icon = "Icon";
/// 可见
public const String Visible = "Visible";
/// 必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色
public const String Necessary = "Necessary";
/// 权限子项。逗号分隔,每个权限子项名值竖线分隔
public const String Permission = "Permission";
/// 备注
public const String Remark = "Remark";
}
#endregion
}
/// 菜单接口
public partial interface IMenu2
{
#region 属性
/// 编号
Int32 ID { get; set; }
/// 名称
String Name { get; set; }
/// 显示名
String DisplayName { get; set; }
/// 全名
String FullName { get; set; }
/// 父编号
Int32 ParentID { get; set; }
/// 链接
String Url { get; set; }
/// 排序
Int32 Sort { get; set; }
/// 图标
String Icon { get; set; }
/// 可见
Boolean Visible { get; set; }
/// 必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色
Boolean Necessary { get; set; }
/// 权限子项。逗号分隔,每个权限子项名值竖线分隔
String Permission { get; set; }
/// 备注
String Remark { get; set; }
#endregion
#region 获取/设置 字段值
/// 获取/设置 字段值
/// 字段名
///
Object this[String name] { get; set; }
#endregion
}
}