Skip to content

Commit

Permalink
Updates to what's new for 5.0 preview 1 (#2187)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Mar 16, 2020
1 parent e6709f5 commit 385be55
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 15 deletions.
8 changes: 4 additions & 4 deletions entity-framework/core/what-is-new/ef-core-5.0/plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Tracked by [#2266](https://github.com/aspnet/EntityFrameworkCore/issues/2266)

T-shirt size: XL

Status: Not started
Status: In-progress

We're doing TPT because it is both a highly requested feature (~254 votes; 3rd overall) and because it requires some low-level changes that we feel are appropriate for the foundational nature of the overall .NET 5 plan. We expect this to result in breaking changes for database providers, although these should be much less severe than the changes required for 3.0.

Expand All @@ -74,7 +74,7 @@ Tracked by [#1833](https://github.com/aspnet/EntityFrameworkCore/issues/1833)

T-shirt size: M

Status: Not started
Status: In-progress

Filtered Include is a highly-requested feature (~317 votes; 2nd overall) that isn't a huge amount of work, and that we believe will unblock or make easier many scenarios that currently require model-level filters or more complex queries.

Expand All @@ -86,7 +86,7 @@ Tracked by [#17270](https://github.com/aspnet/EntityFrameworkCore/issues/17270)

T-shirt size: L

Status: Not started
Status: In-progress

We have made progress in previous releases towards supporting raw SQL, keyless types, and related areas. However, there are both gaps and inconsistencies in the way everything works together as a whole. The goal for 5.0 is to fix these and create a good experience for defining, migrating, and using different types of entities and their associated queries and database artifacts. This may also involve updates to the compiled query API.

Expand Down Expand Up @@ -179,7 +179,7 @@ Tracked by [#1920](https://github.com/dotnet/EntityFramework.Docs/issues/1920)

T-shirt size: L

Status: Not started
Status: In-progress

The idea here is to make it easier to understand what is going on in the internals of EF Core. This can be useful to anyone using EF Core, but the primary motivation is to make it easier for external people to:

Expand Down
80 changes: 69 additions & 11 deletions entity-framework/core/what-is-new/ef-core-5.0/whatsnew.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
---
title: What's New in EF Core 5.0
author: ajcvickers
ms.date: 01/29/2020
ms.date: 03/15/2020
uid: core/what-is-new/ef-core-5.0/whatsnew.md
---

# What's New in EF Core 5.0

EF Core 5.0 is currently in development.
This page will contain an overview of interesting changes introduced in each preview.
The first preview of EF Core 5.0 is tentatively expected in in the first quarter of 2020.

This page does not duplicate the [plan for EF Core 5.0](plan.md).
The plan describes the overall themes for EF Core 5.0, including everything we are planning to include before shipping the final release.

We will add links from here to the official documentation as it is published.

## Preview 1 (Not yet shipped)
## Preview 1

### Simple logging

Expand All @@ -35,15 +34,22 @@ Preliminary documentation is included in the [EF weekly status for January 9, 20

Additional documentation is tracked by issue [#1331](https://github.com/dotnet/EntityFramework.Docs/issues/1331).

### Enhanced debug views
### Use a C# attribute to indicate that an entity has no key

Debug views are an easy way to look at the internals of EF Core when debugging issues.
A debug view for the Model was implemented some time ago.
For EF Core 5.0, we have made the model view easier to read and added a new debug view for tracked entities in the state manager.
An entity type can now be configured as having no key using the new `KeylessAttribute`.
For example:

Preliminary documentation is included in the [EF weekly status for December 12, 2019](https://github.com/dotnet/efcore/issues/15403#issuecomment-565196206).
```CSharp
[Keyless]
public class Address
{
public string Street { get; set; }
public string City { get; set; }
public int Zip { get; set; }
}
```

Additional documentation is tracked by issue [#2086](https://github.com/dotnet/EntityFramework.Docs/issues/2086).
Documentation is tracked by issue [#2186](https://github.com/dotnet/EntityFramework.Docs/issues/2186).

### Connection or connection string can be changed on initialized DbContext

Expand All @@ -61,6 +67,16 @@ However, proxies come with their own set of limitations, so they are not for eve

Documentation is tracked by issue [#2076](https://github.com/dotnet/EntityFramework.Docs/issues/2076).

### Enhanced debug views

Debug views are an easy way to look at the internals of EF Core when debugging issues.
A debug view for the Model was implemented some time ago.
For EF Core 5.0, we have made the model view easier to read and added a new debug view for tracked entities in the state manager.

Preliminary documentation is included in the [EF weekly status for December 12, 2019](https://github.com/dotnet/efcore/issues/15403#issuecomment-565196206).

Additional documentation is tracked by issue [#2086](https://github.com/dotnet/EntityFramework.Docs/issues/2086).

### Improved handling of database null semantics

Relational databases typically treat NULL as an unknown value and therefore not equal to any other NULL.
Expand Down Expand Up @@ -88,10 +104,52 @@ MyEnumColumn VARCHAR(10) NOT NULL CHECK (MyEnumColumn IN('Useful', 'Useless', 'U

Documentation is tracked by issue [#2082](https://github.com/dotnet/EntityFramework.Docs/issues/2082).

### IsRelational

A new `IsRelational` method has been added in addition to the existing `IsSqlServer`, `IsSqlite`, and `IsInMemory`.
This can be used to test if the DbContext is using any relational database provider.
For example:

```CSharp
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
if (Database.IsRelational())
{
// Do relational-specific model configuration.
}
}
```

Documentation is tracked by issue [#2185](https://github.com/dotnet/EntityFramework.Docs/issues/2185).

### Cosmos optimistic concurrency with ETags

The Azure Cosmos DB database provider now supports optimistic concurrency using ETags.
Use the model builder in OnModelCreating to configure an ETag:

```CSharp
builder.Entity<Customer>().Property(c => c.ETag).IsEtagConcurrency();
```

SaveChanges will then throw an `DbUpdateConcurrencyException` on a concurrency conflict, which [can be handled](https://docs.microsoft.com/ef/core/saving/concurrency) to implement retries, etc.


Documentation is tracked by issue [#2099](https://github.com/dotnet/EntityFramework.Docs/issues/2099).

### Query translations for more DateTime constructs

Queries containing new DataTime construction are now translated.
Also, the SQL Server function DateDiffWeek is now mapped.
Queries containing new DateTime construction are now translated.

In addition, the following SQL Server functions are now mapped:
* DateDiffWeek
* DateFromParts

For example:

```CSharp
var count = context.Orders.Count(c => date > EF.Functions.DateFromParts(DateTime.Now.Year, 12, 25));

```

Documentation is tracked by issue [#2079](https://github.com/dotnet/EntityFramework.Docs/issues/2079).

Expand Down

0 comments on commit 385be55

Please sign in to comment.