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 ...
随机推荐
- SQl Server 中登录名 、用户、角色、概念一览
转载:http://www.2cto.com/database/201306/216922.html 数据库,角色,用户,安全 登录SQL server 2008可以用w ...
- 最短路N题Tram SPFA
#include <algorithm>#include <queue>#include <cstdio>#include <cstdlib>#inc ...
- 使用MapReduce将HDFS数据导入Mysql
使用MapReduce将Mysql数据导入HDFS代码链接 将HDFS数据导入Mysql,代码示例 package com.zhen.mysqlToHDFS; import java.io.DataI ...
- FineReport报表使用
FineReport报表是帆软公司推出的可以嵌入java的免费报表. FineReport有2部分组成,一有c/s端的报表工具制作cpt结尾的报表文件:二是 java调用报表的web程序. 这里主要说 ...
- GVM管理Go版本
1.为什么要安装GVM 1.1什么是GVM GVM是一个golang虚拟环境配置工具,其允许一台机器上安装多个golang版本,gvm是第三方开发的Go多版本管理工具,类似ruby里面的rvm工具.使 ...
- DIV+CSS专题:第一天 XHTML CSS基础知识
欢迎大家学习<十天学会web标准>,也就是我们常说的DIV+CSS.不过这里的DIV+CSS是一种错误的叫法,建议大家还是称之为web标准. 学习本系列教程需有一定html和css基础 ...
- BZOJ 2243 [SDOI2011]染色:树剖【维护路径上颜色段】
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2243 题意: 给定一棵有n个节点的无根树和m个操作,操作有2类: 1.将节点a到节点b路径 ...
- 仿联想商城laravel实战---2、后端页面搭建(验证码如何在页面中使用)
仿联想商城laravel实战---2.后端页面搭建(验证码如何在页面中使用) 一.总结 一句话总结: 放在img里面,img的src就是生产验证码的控制器路径: img src="/admi ...
- jQuery向上遍历DOM树之parents(),parent(),closest()之间的区别
http://www.poluoluo.com/jzxy/201312/253059.html 在这个sprint中,因为要写前端UI,所以用到了jQuery,但是jQuery在向上遍历DOM树的AP ...
- 基于T4的生成方式
一.什么是T4模板 T4是对“Text Template Transformation Toolkit”(4个T)的简称.是一个基于文本文件转换的工具包.T4的核心是一个基于“文本模板”的转换引擎(以 ...