.net 映射数据库操作--自定义属性忽略字段
2011-03-14 14:44
288 查看
1.自定义属性类:
public class ModelPropertyAttribute : Attribute
{
bool nottablecolum;
public bool NotTableColumn { get { return this.nottablecolum; } }
public ModelPropertyAttribute(bool nottablecolums)
{
this.nottablecolum = nottablecolums;
}
public override string ToString()
{
return nottablecolum ? "nottablecolum" : "";
}
}
2.需要属性,但不属于数据库字段的时候使用
[Common.Model.ModelProperty(true)]
public decimal SendValue
{
get{ }
set{ }
}
public class ModelPropertyAttribute : Attribute
{
bool nottablecolum;
public bool NotTableColumn { get { return this.nottablecolum; } }
public ModelPropertyAttribute(bool nottablecolums)
{
this.nottablecolum = nottablecolums;
}
public override string ToString()
{
return nottablecolum ? "nottablecolum" : "";
}
}
2.需要属性,但不属于数据库字段的时候使用
[Common.Model.ModelProperty(true)]
public decimal SendValue
{
get{ }
set{ }
}
相关文章推荐
- 1、@Transient @[email protected]�射,ORM框架将忽略该属性; 如果一个属性并非数据库表的字段映射,就务必将其标示为@Transient,否则ORM框架默认其注解为@B
- 使用MyBatis的默认(数据库字段和属性名忽略大小匹配)映射方式,必须有无惨构造函数。
- myBatis配置实现数据库字段下划线映射到java对象的驼峰式命名属性
- .net 添加自定义操作----安装数据库
- hibernate映射类中通过@Transient可能标注一个属性不是数据库的字段
- EF实体类指定部分属性不映射成数据库字段的方法
- MyBatis学习笔记-03.MyBatis中五种成功映射数据库字段与实体类属性不一致的解决方案
- .net 文件上传至数据库二进制字段 及读取操作。
- Log4net自定义信息(变量或属性或字段)存入数据库
- JQuery之自定义属性、与ashx通信实现数据库操作
- myBatis配置实现数据库字段下划线映射到java对象的驼峰式命名属性
- mybatis数据库字段带下划线,映射支持java类属性驼峰命名
- Hibernate 忽略非数据库字段属性
- mybatis数据库字段带下划线,映射支持java类属性驼峰命名
- Hibernate 实体类注解 Entity方式5、@Basic(fetch=FetchType,optional=true) 可选 @Basic表示一个简单的属性到数据库表的字段的映射,对于没有
- Hibernate @Transient : 标识不和数据库字段进行映射的临时属性
- mybatis数据库字段带下划线,映射支持java类属性驼峰命名
- 安卓Android通过字段映射创建sqlite数据库,操作数据库,创建表,增、删、改查,通用方法,轻松编程(by寒冬)
- 数据库中时间字段为null,获取数据库数据映射到类,类中相应的属性的值是null还是时间默认值
- C# 操作 Word 修改word的高级属性中的自定义属性