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的更多相关文章

  1. Entity Framework Code-First(9.6):DataAnnotations - StringLength Attribute

    DataAnnotations - StringLength Attribute: StringLength attribute can be applied to a string type pro ...

  2. Entity Framework Code-First(9.5):DataAnnotations - MaxLength Attribute

    DataAnnotations - MaxLength Attribute: MaxLength attribute can be applied to a string or array type ...

  3. Entity Framework Code-First(9.10):DataAnnotations - NotMapped Attribute

    DataAnnotations - NotMapped Attribute: NotMapped attribute can be applied to properties of a class. ...

  4. Entity Framework Code-First(9.9):DataAnnotations - ForeignKey Attribute

    DataAnnotations - ForeignKey Attribute: ForeignKey attribute can be applied to properties of a class ...

  5. Entity Framework Code-First(9.8):DataAnnotations - Column Attribute

    DataAnnotations - Column Attribute: Column attribute can be applied to properties of a class. Defaul ...

  6. Entity Framework Code-First(9.7):DataAnnotations - Table Attribute

    DataAnnotations - Table Attribute: Table attribute can be applied to a class. Default Code-First con ...

  7. Entity Framework Code-First(9.3):DataAnnotations - ConcurrencyCheck Attribute

    ConcurrencyCheck Attribute: ConcurrencyCheck attribute can be applied to a property of a domain clas ...

  8. Entity Framework Code-First(9.1):DataAnnotations - Key Attribute

    DataAnnotations - Key Attribute: Key attribute can be applied to properties of a class. Default Code ...

  9. 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 ...

随机推荐

  1. Spark Structured Streaming框架(1)之基本用法

     Spark Struntured Streaming是Spark 2.1.0版本后新增加的流计算引擎,本博将通过几篇博文详细介绍这个框架.这篇是介绍Spark Structured Streamin ...

  2. 如何彻底禁止手机连接usb,代码实…【转】

    本文转载自:https://blog.csdn.net/jun4331247/article/details/51201825 作为系统第三次被黑的修复方法,捯饬了半天,没效果,最后大神一出手,果然出 ...

  3. cat echo 打印菜单

    cat << END        =============================        1.apple        2.pear        3.banana   ...

  4. mysql日志总结

    1.mysql慢查询设置 log-slow-queries=/alidata/mysql-log/mysql-slow.loglong_query_time = 1log-queries-not-us ...

  5. IE Firefox css 差别

    1.单位问题 问题:任何距离的数值ie可以不加单位,ff必须要求写单位(0除外) 解决:写全单位如padding:0px; 2.水平居中 问题:div里的内容,ie默认为center,而ff默认lef ...

  6. linux sed 命

    sed(stream editor):是流编辑器,按行进行操作,对符合模式的行在内存中进行操作,不对原文件进行修改,处理结束后将模式空间打印到屏幕. sed 的模式空间 处理文件流的内存空间叫模式空间 ...

  7. POJ 2728 Desert King:最优比率生成树

    题目链接:http://poj.org/problem?id=2728 题意: 给你n个点(x,y,z),让你求一棵生成树,使得 k = ∑ |z[i]-z[j]| / ∑ dis(i,j)最小. | ...

  8. 在解析XML时要注意解析元素和解析标签属性的区别

    解析元素时: Sting str = ele.elementText("name"); 而解析标签属性时: String key = ele.attributeValue(&quo ...

  9. 【遍历二叉树】07恢复二叉搜索树【Recover Binary Search Tree】

    开一个指针数组,中序遍历这个二叉搜索树,将节点的指针依次保存在数组里, 然后寻找两处逆序的位置, 中序便利里BST得到的是升序序列 ++++++++++++++++++++++++++++++++++ ...

  10. Mule ESB学习【转-结合了网络上的一些资源】

    1.SOA标准之一:SCA架构思想 SOA在Java领域有两套标准:一个是SUN推出的JBI(没有得到BEA和IBM的承认),另外一个是:IBM和BEA等公司推出的SCA和SDO标准. JBI之关注J ...