原文: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. Linux服务器安装部署redis

    参考地址: redis教程:http://www.runoob.com/redis/redis-tutorial.html redis百度百科:https://baike.baidu.com/item ...

  2. Flask的请求对象--request

    request-Flask的请求对象 请求解析和响应封装大部分是有Werkzeug完成的,Flask子类化Werkzeug的请求(Request)对象和响应(Response)对象,并添加了和程序的特 ...

  3. 20165215 2017-2018-2《Java程序设计》第一周学习总结

    20165215 2017-2018-2 <Java程序设计>第一周学习总结 教材学习内容总结 跟随网课学习了<Java2 实用教程>的第一章,进行了基础的编译练习 在Ubun ...

  4. 文件缓冲区在fork后复制

    场景:父进程trace进程A,当A进程fork子进程B时,让父进程也fork子进程去trace子进程B,用于trace的进程将被trace的进程发生的系统调用号通过fprintf存入各自文件中 问题: ...

  5. how to backup your system of Autel MS908 Pro

    how to backup your system of Autel Scan Tool Autel MS908 Pro: Connect the tablet to a PC desktop or ...

  6. 原生tab选项卡制作

    html部分 <div class="tab"> <div class="nav"> <ul> <li class=& ...

  7. 理解Sql Server 事务隔离层级(Transaction Isolation Level)

    关于Sql Server 事务隔离级别,百度百科是这样描述的 隔离级别:一个事务必须与由其他事务进行的资源或数据更改相隔离的程度.隔离级别从允许的并发副作用(例如,脏读或虚拟读取)的角度进行描述. 隔 ...

  8. P2221 [HAOI2012]高速公路(线段树)

    P2221 [HAOI2012]高速公路 显然答案为 $\dfrac{\sum_{i=l}^r\sum_{j=l}^{r}dis[i][j]}{C_{r-l+1}^2}$ 下面倒是挺好算,组合数瞎搞 ...

  9. 12: nginx原理及常用配置

    1.1 nginx基本介绍 1.nginx高并发原理( 多进程+epoll实现高并发 ) 1. Nginx 在启动后,会有一个 master 进程和多个相互独立的 worker 进程. 2. 每个子进 ...

  10. 转:网卡、光纤网卡、ISCSI卡有什么区别?

    网卡.光纤网卡.ISCSI卡有什么区别? 感谢: http://www.it.com.cn/f/server/063/6/241650.htm 在讨论这个问题的时候,需要先说清楚一个问题:我们知道,在 ...