Entity Framework Fluent API and Indexing
来源:互联网 发布:程序员年入百万 编辑:程序博客网 时间:2024/06/05 00:07
public class People { public int Id { get; set; } public string Firstname { get; set; } public string Lastname { get; set; } public string PhoneNumber { get; set; } public string NationalInsuranceNo { get; set; }}
Single column Indexes
modelBuilder.Entity<People>() .Property(x => x.Firstname) .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("ix_people_firstname")));
Multi Column Indexes
modelBuilder.Entity<People>() .Property(x => x.Firstname) .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("ix_people_fullname", 1)));modelBuilder.Entity<People>() .Property(x => x.Lastname) .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("ix_people_fullname", 2)));
Unique Indexes
modelBuilder.Entity<People>() .Property(x => x.NationalInsuranceNo) .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("ix_people_nationalinsurance") {IsUnique = true}));
Clustered Indexes
modelBuilder.Entity<People>() .Property(x => x.Id) .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("ix_people_nationalinsurance") { IsClustered = true}));
What's Not Possible Using Fluent API
As of Entity Framework 6.1.1
- Include Fields
- Sort Order (ASC,DESC)
- Filtered Indexes
Whilst this is a big step forwards it still feels like a work in progress. I would hope to end up with a friendlier and more complete syntax for doing this something like...
0 0
- Entity Framework Fluent API and Indexing
- Entity Framework Fluent API
- EF Mapping2 Entity Framework Fluent API
- EF Mapping Entity Framework Fluent API
- EF Mapping Entity Framework Fluent API
- 【配置属性】—Entity Framework实例详解(DataAnnotations and Fluent API)
- 【配置属性】—Entity Framework实例详解(DataAnnotations and Fluent API)
- Entity Framework:使用Fluent API配置数据表映射
- Entity Framework Code First (五)Fluent API - 配置关系
- Entity Framework Code First (四)Fluent API - 配置属性/类型
- EF Mappings1 Entity Mappings using Fluent API
- 全自动迁移数据库的实现 (Fluent NHibernate, Entity Framework Core)
- Export Grid Data To Excel In Advance Kendo UI Using MVC WEB API And Entity Framework
- Entity Framework API介绍 -- DbSet<>().Find()
- Entity Framework Core 数据库自动迁移API
- ASP.NET MVC4 Entity Framework and Mysql
- apache fluent api
- Liferay Indexing and search
- 这个有关事务和Spring事务处理的写的很好~
- Java 中 Map与JavaBean实体类之间的相互转化
- 双链表头插法个人图解
- tcp窗口滑动以及拥塞控制
- 等待
- Entity Framework Fluent API and Indexing
- 求一个整数N,二进制中1的个数
- Leetcode 113. Path Sum II 路径和2 解题报告
- 【codevs 1902】方格取数3(最小割)
- Oracle 分区表相关语法
- Lua语法学习笔记(二)
- python笔记 ---蛋疼的 动态类型+强类型语言
- 一些CSS和浏览器之间的怪异显示及对应的解决办法
- 如何在ecs上面配置php环境