From the course: Using Entity Framework Core with Legacy Databases
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Adding and altering indexes
From the course: Using Entity Framework Core with Legacy Databases
Adding and altering indexes
- [Instructor] Indexes are invaluable when looking up data in a database that is of any significant size. While most existing databases have some indexes already set up it is common to find a query that is relatively inefficient and significant improvement could be added with a new index. Let's look at some ways that we can handle indexes in Entity Framework Core. By convention indexes are automatically created for each property or property group that compose a foreign key. Let's look at the indexes that we already have on the order table. Under the Model folders we'll open the context and scroll down to the orders table. We can see on the order table that we have an index for the order date. We also have indexes on the foreign keys for the table by convention. The customer ID and the salesperson ID both have indexes defined by convention. Let's look at the snapshot file in the migrations folder to see these indexes defined explicitly. We'll scroll down to the definition of the orders…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Why change the generated model2m 8s
-
(Locked)
Changing names1m 49s
-
(Locked)
Using shadow properties2m 23s
-
(Locked)
Generated properties and default values4m 34s
-
(Locked)
Using backing fields3m 35s
-
(Locked)
Adding and altering indexes3m 38s
-
(Locked)
Adding concurrency tokens and timestamps4m 8s
-
(Locked)
-
-
-