Entity Framework 6.0 Tutorials(10):Index Attribute
Index Attribute:
Entity Framework 6 provides Index attribute to create Index on a particular column in the database as shown below:
class Student
{
public Student()
{
} public int Student_ID { get; set; }
public string StudentName { get; set; } [Index]
public int RegistrationNumber { get; set; }
}
By default, Index name will be IX_{property name}. However, you can also change the Index name.
You can also make it a Clustered index by specifying IsClustered = true and a unique index by specifying IsUnique=true.
[Index( "INDEX_REGNUM", IsClustered=true, IsUnique=true )]
public int RegistrationNumber { get; set; }
Download Code-First sample project for Index attribute demo.
Entity Framework 6.0 Tutorials(10):Index Attribute的更多相关文章
- Entity Framework 6.0 Tutorials(1):Introduction
以下系统文章为EF6.0知识的介绍,本章是第一篇 原文地址:http://www.entityframeworktutorial.net/entityframework6/introduction.a ...
- Entity Framework 6.0 Tutorials(4):Database Command Logging
Database Command Logging: In this section, you will learn how to log commands & queries sent to ...
- Entity Framework 6.0 Tutorials(11):Download Sample Project
Download Sample Project: Download a sample project for Entity Framework 6 Database-First model below ...
- Entity Framework 6.0 Tutorials(9):Stored Procedure Mapping
Code First - Insert, Update, Delete Stored Procedure Mapping: Entity Framework 6 Code-First provides ...
- Entity Framework 6.0 Tutorials(6):Transaction support
Transaction support: Entity Framework by default wraps Insert, Update or Delete operation in a trans ...
- Entity Framework 6.0 Tutorials(3):Code-based Configuration
Code-based Configuration: Entity Framework 6 has introduced code based configuration. Now, you can c ...
- Entity Framework 6.0 Tutorials(2):Async query and Save
Async query and Save: You can take advantage of asynchronous execution of .Net 4.5 with Entity Frame ...
- Entity Framework 6.0 Tutorials(8):Custom Code-First Conventions
Custom Code-First Conventions: Code-First has a set of default behaviors for the models that are ref ...
- Entity Framework 6.0 Tutorials(7):DbSet.AddRange & DbSet.RemoveRange
DbSet.AddRange & DbSet.RemoveRange: DbSet in EF 6 has introduced new methods AddRange & Remo ...
随机推荐
- 【经典】Noip贪心
一.经典例题 例一:排队接水 题意:n个人到r个水龙头接水,装满水桶的时间分别是t1,t2,t3.... 接水时间是整数且互不相等,怎样安排顺序使每个人等待的 时间和最小. 题解:排队越靠前计算次数越 ...
- jquery ajax 跨域设置
xhrFields: { withCredentials: true},crossDomain: true,
- 5 数组 Swift/Object-C ——《Swift3.0从入门到出家》
Swift中数组是一种数据结构,用来存放多个形同类型的数据结构,数据在数组内的存放是有序的,存进来的数据个读出来的顺序相同 Object-C 中数组能够存放任意类型的数据类型为[AnyObject] ...
- Hbase 参数配置及优化
From:http://www.open-open.com/lib/view/open1346684547787.html 接触hbase已有半年的时间,查了很多资料,也参考了很多别人心得,也希望把自 ...
- jquery中ajax异步调用接口
之前写过一个原始的.无封装的页面,没有引入任何外部js,直接实例化Ajax的XmlRequest对象去异步调用接口,参见Ajax异步调用http接口后刷新页面,可对比一下. 现在我们用jquery包装 ...
- merge into报错ORA-00926、ORA-38014
今天用ibatis写个插入操作,为了兼容修改想使用 merge into语句,以便重复插入时直接 update,具体语句如下: <insert id="wlf"> ME ...
- java代码多线程实现如下
总结:我的比赛得了最差的奖,老师提都没提,所以,我应该有自知之明,你并不是他最喜欢的学生 import java.util.Scanner; //利用多线程实现输入等待…… public class ...
- 几种经典的hash算法
计算理论中,没有Hash函数的说法,只有单向函数的说法.所谓的单向函数,是一个复杂的定义,大家可以去看计算理论或者密码学方面的数据.用“人 类”的语言描述单向函数就是:如果某个函数在给定输入的时候,很 ...
- 权益保护-知识产权:知识产权(IP)百科
ylbtech-权益保护-知识产权:知识产权(IP)百科 知识产权,也称其为“知识所属权”,指“权利人对其智力劳动所创作的成果和经营活动中的标记.信誉所依法享有的专有权利”,一般只在有限时间内有效.各 ...
- python学习(十二) 图形化用户界面
12.1 丰富的平台 12.2 下载和安装wxPython 12.3 创建示例GUI应用程序 12.3.1 开始 12.3.2 窗口和组件 12.3.3 标签.标题和位置 12.3.4 更智能的布局 ...