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

  1. Entity Framework 6.0 Tutorials(1):Introduction

    以下系统文章为EF6.0知识的介绍,本章是第一篇 原文地址:http://www.entityframeworktutorial.net/entityframework6/introduction.a ...

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

  3. Entity Framework 6.0 Tutorials(11):Download Sample Project

    Download Sample Project: Download a sample project for Entity Framework 6 Database-First model below ...

  4. Entity Framework 6.0 Tutorials(9):Stored Procedure Mapping

    Code First - Insert, Update, Delete Stored Procedure Mapping: Entity Framework 6 Code-First provides ...

  5. Entity Framework 6.0 Tutorials(6):Transaction support

    Transaction support: Entity Framework by default wraps Insert, Update or Delete operation in a trans ...

  6. Entity Framework 6.0 Tutorials(3):Code-based Configuration

    Code-based Configuration: Entity Framework 6 has introduced code based configuration. Now, you can c ...

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

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

  9. Entity Framework 6.0 Tutorials(7):DbSet.AddRange & DbSet.RemoveRange

    DbSet.AddRange & DbSet.RemoveRange: DbSet in EF 6 has introduced new methods AddRange & Remo ...

随机推荐

  1. 关于modelsim添加库的说明

    声明:以下纯属个人习惯. 1.工程建好后添加一个编译好的库的方法是:file->new->library选择a map to an existing library.然后将这个库在你这工程 ...

  2. Linux 环境下安装Maven

    1.安装wget命令 如果需要通过使用wget命令,直接通过网络下载maven安装包时,需要在linux系统中安装wget命令. yum -y install wget 2.下载maven安装包 wg ...

  3. Linux环境安装redis

    redis官网地址:http://www.redis.io/ 最新版本:2.8.3 在Linux下安装Redis非常简单,具体步骤如下(官网有说明): 1.下载源码,解压缩后编译源码. $ wget ...

  4. Maven依赖war开发,找不到war里头的class解决方案

    问题描述: 开发一个web系统,需要引用另一个excel.war[在该系统里头是一个excel的导入导出小模块]进行项目 <dependency> <groupId>com.b ...

  5. windows下通过Git Bash使用Git常用命令

    Git跟SVN最大不同的地方就是分布式.SVN的集中式与Git的分布式决定各自的业务场景.既然是分布式的,那么大部分操作就是本地操作.一般Git操作都是通过IDE,比如Eclipse,如果装了Git ...

  6. Delphi AES加密(转)

    (**************************************************************) (* Advanced Encryption Standard (AE ...

  7. 获取sonar扫描结果

    api通过抓包获取 java 1.get和post方法 package com.tools.httpUtil; import java.io.BufferedReader; import java.i ...

  8. Erlang基础 -- 介绍 -- Erlang特点

    前言 Erlang是具有多重范型的编程语言,具有很多特点,主要的特点有以下几个: 函数式 并发性 分布式 健壮性 软实时 热更新 递增式代码加载 动态类型 解释型 函数式 Erlang是函数式编程语言 ...

  9. unittest框架,调用函数类 和 调用函数外的 方法

  10. 复制书稿(book) (二分,贪心+dp)

    复制书稿(book) 时间限制: 1 Sec  内存限制: 128 MB提交: 3  解决: 1[提交][状态][讨论版][命题人:quanxing] 题目描述 现在要把m本有顺序的书分给k个人复制( ...