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 ...
随机推荐
- debian下使用ft232为stm32f429i-discovery烧写uboot和uImage
操作系统:debian 软件: openocd minicom 硬件: MiniUSB线.stm32f429i-discovery, WaveShare FT232串口模块(可以在淘宝上买到) 关 ...
- LINQ 学习路程 -- 查询操作 Skip SkipWhile Take TakeWhile
Method Description Skip 跳过序列中指定数量元素,然后返回剩余序列 SkipWhile 只要满足条件,就跳过序列中的元素,然后返回剩余函数 Take 从序列的开头返回指定数量的连 ...
- 算法(Algorithms)第4版 练习 2.2.10
关键代码实现: private static void merge(Comparable[] input, int lo, int mid, int hi) { //copy input[lo,mid ...
- 算法(Algorithms)第4版 练习 2.1.25
代码实现: package com.qiusongde; import edu.princeton.cs.algs4.In; import edu.princeton.cs.algs4.StdOut; ...
- C++难点的一些总结
一. C++成员函数的重载 C++中的成员函数有四种,分别是普通成员函数,virtual虚函数,const成员函数. (1) void func(int a); (2) virtual void fu ...
- KISSY(JS)炫动导航,缓动应用实例(^_^)
一个基于KISSY的简单的动画导航,效果还不错,有点像flash的效果.鼠标移到每一个连接上,背景滑块会迅速移到该链接下方,同时平滑改变大小,自适应链接尺寸,并伴随来回的轻微波动,动感相当不错,呵呵, ...
- Cocos2d-x中手动构造Json::Value
由于项目需要Json::Value 不是由服务器传送过来,而是自己手动构造. 带数组的json Json::Value items; for(int i=0,i<2;i++) { items[i ...
- BZOJ 1656 [Usaco2006 Jan] The Grove 树木:bfs【射线法】
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1656 题意: 给你一个n*m的地图,'.'表示空地,'X'表示树林,'*'表示起点. 所有 ...
- DoTween插件
doteeen(hotween第二个版本) hotween leantween gokit itween(多个相同动画类型的插件):性能最高的是dotween 引用命名空间:using DG.Twee ...
- C++(六)— 输入方式
1.输入包含空格的字符串 使用 getline(cin, str)读取一行字符串,遇到换行符停止:cin>>str,是遇到空格就停止. 实现:输入两个字符,在第一个字符中删除第二个字符中出 ...