zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    Mybatis入门
    Ajax
    产品经理之产品规划
    产品经理之用户研究(下)
    产品经理之用户研究(上)
    Spring Cloud
    Spring MVC
    synchronized
    Spring Boot入门
    Spring
  • 原文地址:https://www.cnblogs.com/purplefox2008/p/5649584.html
Copyright © 2011-2022 走看看