What is New in Entity Framework 5 Shipped in Asp.Net 5
Entity Framework 5 New Stuff
You can Log Messages using a short cut method called LogTo(), for example, LogTo(Console.WriteLine, LogLevel.Information).EnableSensitiveDataLogging() - This will allow you to see Database Log Messages through Entity Framework so that you don't have to Inject ILogger through Dependency Injection.
You can now Create Indexes with a simple Attribute like so: [Index(nameOf(NameOfYourColumn))] public int Id {get; set;} public string NameOfYourColumn {get;set;}
SQL Server is Case Insensitive by default, if you want to use Case Sensitive Database Operations like Postgres Database, EF Core will let you defined collation on either Database, Table, or Column.
For Example: modelBuilder.UseCollation("SQL_Latin1_General_CP1_CS_AS")
- This will make SQL Server care about Data Conversion, look at it as the data "name" is treated as the same as "Name". But with the Collation defined, the field with data "name" is not equal to the field with data "Name".
[Query Optimization] If you are in SQL Server Query Window/Tab and would like to see the execution plan for a query or a Stored Procedure just use:
SET SHOWPLAN_ALL ON;
in front of the query, you are about to execute.
[Important ] - When the query has executed, pay attention to the result message if it says: Index Seek or Index Scan.
If the result message shows the Index was scanned then, it is really bad. You should always strive to make your query SEEK Indexes.
Index SEEK is always better than Index SCAN, if your execution plan Scans on indexes just imagine how long it will take to retrieve one single record when you millions of records in your table. Always strive for SEEK instead of SCAN.