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 ...
随机推荐
- 关于modelsim添加库的说明
声明:以下纯属个人习惯. 1.工程建好后添加一个编译好的库的方法是:file->new->library选择a map to an existing library.然后将这个库在你这工程 ...
- bzoj 4671 异或图——容斥+斯特林反演+线性基
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4671 考虑计算不是连通图的方案,乘上容斥系数来进行容斥. 可以枚举子集划分(复杂度是O(Be ...
- BZOJ3790:神奇项链
浅谈\(Manacher\):https://www.cnblogs.com/AKMer/p/10431603.html 题目传送门:https://lydsy.com/JudgeOnline/pro ...
- mysql + keepalived架构
mysql + keepalived架构 文档(这个文章共有三篇): http://blog.itpub.net/27000195/viewspace-1364706/
- HPPTS SSL
https加密.解密.及验证过程如下图: HTTPS怎么实现安全传输的? 建立安全传输 HTTPS中, 客户端首先打开一条到WEB服务器443端口的连接. 一旦建立了TCP连接 ,客户端和服务器就会初 ...
- Instantiate实例化的注意事项
_obj= Resources.Load("xxx") as GameObject;Instantiate(_obj); 这里的_obj对象和 _obj= Instantiate( ...
- 权益保护-知识产权:知识产权(IP)百科
ylbtech-权益保护-知识产权:知识产权(IP)百科 知识产权,也称其为“知识所属权”,指“权利人对其智力劳动所创作的成果和经营活动中的标记.信誉所依法享有的专有权利”,一般只在有限时间内有效.各 ...
- fatal: read error: Connection reset by peer解决办法
标签(空格分隔): ceph源码安装,git 问题描述: 源码安装ceph,克隆代码时提示如下错误: [root@localhost ~]# git clone git://github.com/ce ...
- JS面向对象编程,对象,属性,方法。
document.write('<script type="text/javascript" src="http://api.map.baidu.com/api?v ...
- thread_local变量
thread_local变量是C++ 11新引入的一种存储类型.它会影响变量的存储周期(Storage duration),C++中有4种存储周期: automatic static dynamic ...