原文:http://www.entityframeworktutorial.net/code-first/TimeStamp-dataannotations-attribute-in-code-first.aspx

TimeStamp属性只能应用于域类的一个字节数组属性。 TimeStamp属性创建一个带有timestamp数据类型的列。Code First在并发检查中自动使用此TimeStamp列。

请看以下示例:

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; }
}

如上例所示,TimeStamp属性应用于Student类的Byte[]属性。

因此,Code First将在Student表中创建一个时间戳列RowVersion,如下所示:

【译】第11节---数据注解-TimeStamp的更多相关文章

  1. 【译】第12节---数据注解-ConcurrencyCheck

    原文:http://www.entityframeworktutorial.net/code-first/concurrencycheck-dataannotations-attribute-in-c ...

  2. 【译】第20节---数据注解-InverseProperty

    原文:http://www.entityframeworktutorial.net/code-first/inverseproperty-dataannotations-attribute-in-co ...

  3. 【译】第19节---数据注解-NotMapped

    原文:http://www.entityframeworktutorial.net/code-first/notmapped-dataannotations-attribute-in-code-fir ...

  4. 【译】第18节---数据注解-ForeignKey

    原文:http://www.entityframeworktutorial.net/code-first/foreignkey-dataannotations-attribute-in-code-fi ...

  5. 【译】第17节---数据注解-Column

    原文:http://www.entityframeworktutorial.net/code-first/column-dataannotations-attribute-in-code-first. ...

  6. 【译】第16节---数据注解-Table

    原文:http://www.entityframeworktutorial.net/code-first/table-dataannotations-attribute-in-code-first.a ...

  7. 【译】第15节---数据注解-StringLength

    原文:http://www.entityframeworktutorial.net/code-first/stringlength-dataannotations-attribute-in-code- ...

  8. 【译】第14节---数据注解-MaxLength/MinLength

    原文:http://www.entityframeworktutorial.net/code-first/maxlength-minlength-dataannotations-attribute-i ...

  9. 【译】第13节---数据注解-Required

    原文:http://www.entityframeworktutorial.net/code-first/required-attribute-dataannotations-in-code-firs ...

随机推荐

  1. ClassTwo__HomeWork

    1,素数输出 设计思路声明两个函数分别用来实现输出任意两个数之间所有的素数和任意两个数之间最大最小的十个素数 方法一:一个数的因子不会大于它本身的开方; 方法二:创建一个数组来储存素数并输出最大最小的 ...

  2. (Review cs231n) The Gradient Calculation of Neural Network

    前言:牵扯到较多的数学问题 原始的评分函数: 两层神经网络,经过一个激活函数: 如图所示,中间隐藏层的个数的各数为超参数: 和SVM,一个单独的线性分类器需要处理不同朝向的汽车,但是它并不能处理不同颜 ...

  3. ubuntu 18.04下安装配置Hue问题记录

    前段时间将Hadoop 在ubuntu环境下装好,接下来尝试安装Hue来管理Hadoop,参照的资料有: 1.高可用Hadoop平台-Hue In Hadoop 2.ubuntu16.04 安装单机H ...

  4. Javaweb笔记—03(BS及分页的业务流程)

    DAO部分:中间层声明该有的变量 pagerBook pageData sumRow sumPage求出总的记录数id唯一标识:select count(id) as rowsum from book ...

  5. win7改装 CentOS7,装完后开机,没有引导

    本来系统是win7,安装centos是用U盘启动安装方式安装成功后,发现win7的系统引导不见了.之前用的是centos6.4安装后依然保留win7引导的,到centos7就不行了 解决方法1.使用r ...

  6. Linux进程内存分析pmap命令

    转自: http://blog.csdn.net/u013982161/article/details/52654256 名称: pmap - report memory map of a proce ...

  7. java bean属性拷贝工具类比对(性能+功能)

    业务系统中经常需要两个对象进行属性的拷贝,不能否认逐个的对象拷贝是最快速最安全的做法,但是当数据对象的属性字段数量超过程序员的容忍的程度比如通常超过5个属性的时候,代码因此变得臃肿不堪,使用一些方便的 ...

  8. python之字符编码(四)

    一.字符编码的使用: 1.文本编辑器 unicode----->encode-------->utf-8 utf-8-------->decode---------->unic ...

  9. vue 起步

    vue 官网 目前最火的前端框架当属Vue.js了,很多使用过vue的程序员这样评价它,“vue.js兼具angular.js和react.js的优点,并剔除了它们的缺点”.授予了这么高的评价的vue ...

  10. linux command wrap

    $ cat tmux-attach ] ; then tmux ls else tmux attach -t $ fi $ cat /usr/bin/cscope-go.sh #!/bin/bash ...