Skip to content

Commit afaddbf

Browse files
authoredMar 31, 2020
Add preview 2 features to What's New doc (#2232)
1 parent acf12a8 commit afaddbf

File tree

1 file changed

+57
-1
lines changed
  • entity-framework/core/what-is-new/ef-core-5.0

1 file changed

+57
-1
lines changed
 

‎entity-framework/core/what-is-new/ef-core-5.0/whatsnew.md

+57-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: What's New in EF Core 5.0
33
description: Overview of new features in EF Core 5.0
44
author: ajcvickers
5-
ms.date: 03/15/2020
5+
ms.date: 03/30/2020
66
uid: core/what-is-new/ef-core-5.0/whatsnew.md
77
---
88

@@ -189,3 +189,59 @@ Documentation is tracked by issue [#2079](https://github.com/dotnet/EntityFramew
189189
Queries that use the string methods Contains, StartsWith, and EndsWith are now translated when using the Azure Cosmos DB provider.
190190

191191
Documentation is tracked by issue [#2079](https://github.com/dotnet/EntityFramework.Docs/issues/2079).
192+
193+
## Preview 2
194+
195+
### Use a C# attribute to specify a property backing field
196+
197+
A C# attribute can now be used to specify the backing field for a property.
198+
This allows EF Core to still write to and read from the backing field as would normally happen, even when the backing field cannot be found automatically.
199+
For example:
200+
201+
```CSharp
202+
public class Blog
203+
{
204+
private string _mainTitle;
205+
206+
public int Id { get; set; }
207+
208+
[BackingField(nameof(_mainTitle))]
209+
public string Title
210+
{
211+
get => _mainTitle;
212+
set => _mainTitle = value;
213+
}
214+
}
215+
```
216+
217+
Documentation is tracked by issue [#2230](https://github.com/dotnet/EntityFramework.Docs/issues/2230).
218+
219+
### Complete discriminator mapping
220+
221+
EF Core uses a discriminator column for [TPH mapping of an inheritance hierarchy](/ef/core/modeling/inheritance).
222+
Some performance enhancements are possible so long as EF Core knows all possible values for the discriminator.
223+
EF Core 5.0 now implements these enhancements.
224+
225+
For example, previous versions of EF Core would always generate this SQL for a query returning all types in a hierarchy:
226+
227+
```sql
228+
SELECT [a].[Id], [a].[Discriminator], [a].[Name]
229+
FROM [Animal] AS [a]
230+
WHERE [a].[Discriminator] IN (N'Animal', N'Cat', N'Dog', N'Human')
231+
```
232+
233+
EF Core 5.0 will now generate the following when a complete discriminator mapping is configured:
234+
```sql
235+
SELECT [a].[Id], [a].[Discriminator], [a].[Name]
236+
FROM [Animal] AS [a]
237+
```
238+
239+
This will be the default behavior starting with preview 3.
240+
241+
### Performance improvements in Microsoft.Data.Sqlite
242+
243+
We have made two performance improvements for SQLIte:
244+
* Retrieving binary and string data with GetBytes, GetChars, and GetTextReader is now more efficient by making use of SqliteBlob and streams.
245+
* Initialization of SqliteConnection is now lazy.
246+
247+
These improvements are in the ADO.NET Microsoft.Data.Sqlite provider and hence also improve performance outside of EF Core.

0 commit comments

Comments
 (0)
Please sign in to comment.