Entity Framework Code-First(9.2):DataAnnotations - TimeStamp Attribute
DataAnnotations - TimeStamp Attribute:
TimeStamp attribute can be applied to only one byte array property of a domain class. TimeStamp attribute creates a column with timestamp datatype. Code-First automatically use this TimeStamp column in concurrency check.
Consider the following example.
using System.ComponentModel.DataAnnotations; public class Student
{
public Student()
{ } public int StudentKey { get; set; } public string StudentName { get; set; } [TimeStamp]
public byte[] RowVersion { get; set; }
}
As you can see in the above example, TimeStamp attribute is applied to Byte[] property of the Student class. So, Code First will create a timestamp column RowVersion in the Student table as shown below.

Entity Framework Code-First(9.2):DataAnnotations - TimeStamp Attribute的更多相关文章
- Entity Framework Code-First(9.6):DataAnnotations - StringLength Attribute
DataAnnotations - StringLength Attribute: StringLength attribute can be applied to a string type pro ...
- Entity Framework Code-First(9.5):DataAnnotations - MaxLength Attribute
DataAnnotations - MaxLength Attribute: MaxLength attribute can be applied to a string or array type ...
- Entity Framework Code-First(9.10):DataAnnotations - NotMapped Attribute
DataAnnotations - NotMapped Attribute: NotMapped attribute can be applied to properties of a class. ...
- Entity Framework Code-First(9.9):DataAnnotations - ForeignKey Attribute
DataAnnotations - ForeignKey Attribute: ForeignKey attribute can be applied to properties of a class ...
- Entity Framework Code-First(9.8):DataAnnotations - Column Attribute
DataAnnotations - Column Attribute: Column attribute can be applied to properties of a class. Defaul ...
- Entity Framework Code-First(9.7):DataAnnotations - Table Attribute
DataAnnotations - Table Attribute: Table attribute can be applied to a class. Default Code-First con ...
- Entity Framework Code-First(9.3):DataAnnotations - ConcurrencyCheck Attribute
ConcurrencyCheck Attribute: ConcurrencyCheck attribute can be applied to a property of a domain clas ...
- Entity Framework Code-First(9.1):DataAnnotations - Key Attribute
DataAnnotations - Key Attribute: Key attribute can be applied to properties of a class. Default Code ...
- Entity Framework Code-First(9.4):DataAnnotations - Required Attribute
Required attribute can be applied to a property of a domain class. EF Code-First will create a NOT N ...
随机推荐
- Never Go Away
Hey if you ever want to leave it allif you ever want to lose control leave it all escape so far away ...
- java.sql.SQLException: Column count doesn't match value count at row 1 Query: insert into category values(null,?,?,?) Parameters: [1111111, 1111, 软件]
java.sql.SQLException 问题: java.sql.SQLException: Column count doesn't match value count at row 1 Que ...
- 修改myEclipse2014web项目名称
重命名项目名称后 右键点击你的项目,然后选择属性---->然后点击myeclipse—>Project Facets—> web 选项,修改web context-root名称为你要 ...
- R数据类型
2.2.1 向量向量是用于存储数值型.字符型或逻辑型数据的一维数组.执行组合功能的函数c()可用来创建向量.各类向量如下例所示: a <-c(1, 2, 5, 3, 6, -2, 4) b &l ...
- C语言链表结构体(学习笔记)
#include <stdio.h> #define LENTEST 100 // 采取逐步删除的方法求的素数 //先假设1-100都是素数,然后剔除2的倍数, //3的倍数,直到剔除所有 ...
- PHP基础陷阱题(变量赋值)
PHP基础陷阱题代码,需要的朋友可以参考下 复制代码 代码如下: <?php $a=3; $b=6; if($a=5||$b=7){ $a++; $b++; } var_dump($a, $ ...
- Saiku_学习_03_Saiku+Kylin构建多维分析OLAP平台
一.技术选型 参见:Saiku+Kylin多维分析平台探索 1.saiku Saiku 作为分析平台,提供可视化的操作,能方便的对数据进行查询.分析,并提供图形化显示 2.kylin Kylin 作为 ...
- 【遍历二叉树】07恢复二叉搜索树【Recover Binary Search Tree】
开一个指针数组,中序遍历这个二叉搜索树,将节点的指针依次保存在数组里, 然后寻找两处逆序的位置, 中序便利里BST得到的是升序序列 ++++++++++++++++++++++++++++++++++ ...
- 欧拉函数(汇总&例题)
定义 欧拉函数 $\varphi(n)$表示小于等于$n$的正整数中与$n$互质的数的数目. 性质 1.积性函数(证明). 2.$\varphi(1)=1$(显然) 3.对于质数$n$,$\varph ...
- [冬令营模拟]wzj的题目#1
T1 少膜一个,T3 暴力写挂 强势 rank1 -> rank2 一场比赛两道线段树分治,给力 T1 password 给你 m 个禁止字符串,求长度为 n 的所有字符串中至少包含这些禁止字符 ...