解决方案 »
- Directory.GetFiles 过滤多种文件类型
- 望高手指点 十块砖的问题
- C#怎么实现用 webBrowser 控件 操作网页的的按钮
- 请问有没有高手来讲一下extern关键字
- !如何判断DataGrid没有记录?!即行数为零?!没分啦!送完最后十分问个简单的问题!】
- 請教大家兩個問題,我每次最多吸能給100分, 沒辦法, 開三貼!
- 使用过Visual studio 2003的朋友请进
- 浏览按钮的代码怎么写
- 能否在运行中改变web service的来源URL?
- C# 如何使用SFTP 上传文件并支持断点续传
- C#treeview点击问题
- devexpress barmanager toolbar静态文本分割线问题
DBField 的作用 你可以搜索一下CodeFirst 应该和它相关
比如:[DbField(true, "event_id")]
public int Id { get; set; }
数据库中查询出来的是event_id,会自动对应到我们定义的实体,属性ID上。
:[DbField(true, "event_id")]
using System.Collections.Generic;
using System.Linq;
using System.Web;namespace SXT.Sample.Web.Admin.Project.SystemDemo.Model
{
public class Class1
{
}
}
public class DbField : Attribute
{
#region 初始数据库字段属性 [Description("数据库对应字段信息")]
public DbField(bool _useable)
{
this.FieldName = string.Empty;
this.FieldType = typeof(string);
this.Primary = false;
this.Identity = false;
this.MaxLength = 0;
this.Useable = _useable;
} [Description("数据库对应字段信息")]
public DbField(bool _useable, string _name)
{
this.FieldName = _name;
this.FieldType = typeof(string);
this.Primary = false;
this.Identity = false;
this.MaxLength = 0;
this.Useable = _useable;
}
#endregion. /// <summary>
/// 对应数据库字段名称
/// </summary>
public string FieldName { get; private set; } /// <summary>
/// 字段类型
/// </summary>
public Type FieldType { get; private set; } /// <summary>
/// 默认信息值
/// </summary>
public bool Primary { get; set; } /// <summary>
/// 自增键值
/// </summary>
public bool Identity { get; set; } /// <summary>
/// 字符串最大长度
/// </summary>
public int MaxLength { get; set; } /// <summary>
/// 是否可用于数据更新或绑定数据。
/// </summary>
public bool Useable { get; set; } /// <summary>
/// 是否ENCODEURL
/// </summary>
public bool Encode { get; set; }
}