Gentle.NET Attribute
------------------------------------------------------------
Gentle.NET Attribute
------------------------------------------------------------
数据表特性(用在实体类上)
[TableName("Product", CacheStrategy.Temporary)]
注:缓存策略
public enum CacheStrategy
{
Never, // 每次都直接从数据库获取记录
Temporary, // 读取记录后丢到Cache中,并指定失效时间。每次查询时先尝试从cache中获取,若不存在才查询数据库
Permonent // 类似Tempory,但不指定失效时间
}
数据字段特性
针对不同的数据库以下特性部分有效,具体请查看pdf文档Page55-57
[Size]
[Type]
[IsNullable]
[IsUnique]
[IsPrimaryKey]
[IsForeignKey]
[IsAutoGenerated]
例如:主键,自增字段
[TableColumn("id", NotNull=true), PrimaryKey(AutoGenerated=true)]
protected int id;
[TableColumn("name", NullValue="")]
protected string name;
[TableColumn( "ph_Id", NotNull=true ), PrimaryKey( AutoGenerated=true ), SequenceName( "PROPERTYHOLDER_SEQ" )]
public virtual int Id
{
get { return id; }
set { id = value; }
}
Gentle.Framework Attribute
[Concurrency]
[CustomView]
[ForeignKey]
[Inheritance]
[PrimaryKey]
[SequenceName]
[SoftDelete]
[TableColumn]
[TableName]
数据视图特性(用在Property上)Gentle.Common.Attributes
以下特性可用在Property上
[Caption("Caption")]
[AllowSort(false)]
[ReadOnly(false)]
[Visible(false)]
例如
[Caption("Company"), ReadOnly(true)]
property string CompanyName
{
get{ return companyName; }
set{ companyName = value; }
}
[AllowSort(false)]
public string Name
{
get { return mName; }
set { mName = value; }
}
[Visible(false)]
public string Name
{
get { return mName; }
set { mName = value; }
}
数据校验特性
[RegexValidator(Expression=@"[A-Z]+[a-z])]
[RequiredValidator()]
[RangeValidator( Min=20.5, Max=100.5 )]
Gentle.NET Attribute相关推荐
- 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](7)
[论文阅读]A Gentle Introduction to Graph Neural Networks [图神经网络入门](7) Into the Weeds Other types of grap ...
- 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](6)
[论文阅读]A Gentle Introduction to Graph Neural Networks [图神经网络入门](6) GNN playground Some empirical GNN ...
- 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](5)
[论文阅读]A Gentle Introduction to Graph Neural Networks [图神经网络入门](5) Graph Neural Networks 图神经网络 Now th ...
- 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](4)
[论文阅读]A Gentle Introduction to Graph Neural Networks [图神经网络入门](4) The challenges of using graphs in ...
- 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](1)
[论文阅读]A Gentle Introduction to Graph Neural Networks [图神经网络入门](1) 最近读了一篇Distill网站上的一篇文章,讲的是图神经网络的入门, ...
- Gentle中的数据表实体类相关自定义属性的设置和获得
1.自定义 表名属性 TableNameAttribute 2.自定义 主键属性 PrimaryKeyAttribute 3.自定义 列名属性 TableColumnAttribute 4.数据表pe ...
- Gentle.NET 使用文档
------------------------------------------------------------ 概述 ------------------------------------ ...
- Python错误:AttributeError: 'generator' object has no attribute 'next'解决办法
今天在学习生成器对象(generation object)运行以下代码时,遇到了一个错误: #定义生成器函数 def liebiao(): for x in range(10): yield x #函 ...
- Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
最近安装项目到自己oppo手机上提示Error:warning: Ignoring InnerClasses attribute for an anonymous inner class,但是在模拟机 ...
最新文章
- 0011_练习题d1
- 8.Deep Interest Evolution Network for Click-Through Rate Prediction论文详解
- 百度地图3.1课程—检索演示
- POJ1201基础差分约束
- Android中的AsyncTask异步任务的简单介绍
- [iOS]利用通知实现监听系统键盘
- python对象点方法_python面向对象知识点疏理
- oracle查看表空间和物理文件大小
- C++模板元 -- 变长参数模板
- JS 正则(RegExp)
- python列表、元组、字典、集合区别及他们之间的转换(超全)
- 如何在整个数据库中查寻一条数据?
- 2007五一[西北行] - 第二天:延安(窑洞,杨家岭,宝塔山...)
- 【小程序源码】视频壁纸支持多种分类短视频另外也有静态壁纸
- 法国主要贸易海港加入区块链货运物流试点
- 计算机域名长啥样,域名是什么 什么样的域名是一个好域名【详解】
- 小米将推运动相机无疑,但它进入的是个怎样的市场?
- Tomcat-Session反序列化学习
- js---javaScript基础知识
- 瞬间击退眼睛疲劳的五大运动