Skip to content

Commit fcb649a

Browse files
committed
Group breaking changes by impact
And fix some issues
1 parent b81521e commit fcb649a

File tree

3 files changed

+75
-63
lines changed

3 files changed

+75
-63
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
],
1212
"cSpell.words": [
1313
"LINQ",
14+
"dbcontext",
1415
"mitigations",
1516
"navigations",
1617
"parameterizable",
18+
"pluralizer",
1719
"queryable",
1820
"savepoint",
1921
"savepoints",

entity-framework/core/what-is-new/ef-core-3.x/breaking-changes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Changes that we expect to only impact database providers are documented under [p
7171
| [Multiple ambiguous self-referencing relationships must be configured](#mersa) | Low |
7272
| [DbFunction.Schema being null or empty string configures it to be in model's default schema](#udf-empty-string) | Low |
7373

74+
## High impact
75+
7476
### LINQ queries are no longer evaluated on the client
7577

7678
[Tracking Issue #14935](https://github.com/aspnet/EntityFrameworkCore/issues/14935)
@@ -127,6 +129,8 @@ Use EF Core 3.1.
127129

128130
<a name="no-longer"></a>
129131

132+
## Medium impact
133+
130134
### Entity Framework Core is no longer part of the ASP.NET Core shared framework
131135

132136
[Tracking Issue Announcements#325](https://github.com/aspnet/Announcements/issues/325)
@@ -179,6 +183,8 @@ dotnet tool install --global dotnet-ef
179183

180184
You can also obtain it a local tool when you restore the dependencies of a project that declares it as a tooling dependency using a [tool manifest file](/dotnet/core/tools/global-tools#install-a-local-tool).
181185

186+
## Low impact
187+
182188
<a name="fromsql"></a>
183189

184190
### FromSql, ExecuteSql, and ExecuteSqlAsync have been renamed

entity-framework/core/what-is-new/ef-core-5.0/breaking-changes.md

Lines changed: 67 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,7 @@ The following API and behavior changes have the potential to break existing appl
2828
| [IndexBuilder.HasName is now obsolete](#index-obsolete) | Low |
2929
| [A pluarlizer is now included for scaffolding reverse engineered models](#pluralizer) | Low |
3030

31-
<a name="geometric-sqlite"></a>
32-
33-
### Removed HasGeometricDimension method from SQLite NTS extension
34-
35-
[Tracking Issue #14257](https://github.com/aspnet/EntityFrameworkCore/issues/14257)
36-
37-
#### Old behavior
38-
39-
HasGeometricDimension was used to enable additional dimensions (Z and M) on geometry columns. However, it only ever affected database creation. It was unnecessary to specify it to query values with additional dimensions. It also didn't work correctly when inserting or updating values with additional dimensions ([see #14257](https://github.com/aspnet/EntityFrameworkCore/issues/14257)).
40-
41-
#### New behavior
42-
43-
To enable inserting and updating geometry values with additional dimensions (Z and M), the dimension needs to be specified as part of the column type name. This API matches more closely to the underlying behavior of SpatiaLite's AddGeometryColumn function.
44-
45-
#### Why
46-
47-
Using HasGeometricDimension after specifying the dimension in the column type is unnecessary and redundant, so we removed HasGeometricDimension entirely.
48-
49-
#### Mitigations
50-
51-
Use `HasColumnType` to specify the dimension:
52-
53-
```csharp
54-
modelBuilder.Entity<GeoEntity>(
55-
x =>
56-
{
57-
// Allow any GEOMETRY value with optional Z and M values
58-
x.Property(e => e.Geometry).HasColumnType("GEOMETRYZM");
59-
60-
// Allow only POINT values with an optional Z value
61-
x.Property(e => e.Point).HasColumnType("POINTZ");
62-
});
63-
```
31+
## Medium impact
6432

6533
<a name="required-dependent"></a>
6634

@@ -102,6 +70,70 @@ modelBuilder.Entity<Blog>()
10270
.IsRequired();
10371
```
10472

73+
<a name="defining-query"></a>
74+
75+
### Defining query is replaced with provider-specific methods
76+
77+
[Tracking Issue #18903](https://github.com/dotnet/efcore/issues/18903)
78+
79+
#### Old behavior
80+
81+
Entity types were mapped to defining queries at the Core level. Anytime the entity type was used in the query root of the entity type was replaced by the defining query for any provider.
82+
83+
#### New behavior
84+
85+
APIs for defining query are deprecated. New provider-specific APIs were introduced.
86+
87+
#### Why
88+
89+
While defining queries were implemented as replacement query whenever query root is used in the query, it had a few issues:
90+
91+
- If defining query is projecting entity type using `new { ... }` in `Select` method, then identifying that as an entity required additional work and made it inconsistent with how EF Core treats nominal types in the query.
92+
- For relational providers `FromSql` is still needed to pass the SQL string in LINQ expression form.
93+
94+
Initially defining queries were introduced as client-side views to be used with In-Memory provider for keyless entities (similar to database views in relational databases). Such definition makes it easy to test application against in-memory database. Afterwards they became broadly applicable, which was useful but brought inconsistent and hard to understand behavior. So we decided to simplify the concept. We made LINQ based defining query exclusive to In-Memory provider and treat them differently. For more information, [see this issue](https://github.com/dotnet/efcore/issues/20023).
95+
96+
#### Mitigations
97+
98+
For relational providers, use `ToSqlQuery` method in `OnModelCreating` and pass in a SQL string to use for the entity type.
99+
For the In-Memory provider, use `ToInMemoryQuery` method in `OnModelCreating` and pass in a LINQ query to use for the entity type.
100+
101+
## Low impact
102+
103+
<a name="geometric-sqlite"></a>
104+
105+
### Removed HasGeometricDimension method from SQLite NTS extension
106+
107+
[Tracking Issue #14257](https://github.com/aspnet/EntityFrameworkCore/issues/14257)
108+
109+
#### Old behavior
110+
111+
HasGeometricDimension was used to enable additional dimensions (Z and M) on geometry columns. However, it only ever affected database creation. It was unnecessary to specify it to query values with additional dimensions. It also didn't work correctly when inserting or updating values with additional dimensions ([see #14257](https://github.com/aspnet/EntityFrameworkCore/issues/14257)).
112+
113+
#### New behavior
114+
115+
To enable inserting and updating geometry values with additional dimensions (Z and M), the dimension needs to be specified as part of the column type name. This API matches more closely to the underlying behavior of SpatiaLite's AddGeometryColumn function.
116+
117+
#### Why
118+
119+
Using HasGeometricDimension after specifying the dimension in the column type is unnecessary and redundant, so we removed HasGeometricDimension entirely.
120+
121+
#### Mitigations
122+
123+
Use `HasColumnType` to specify the dimension:
124+
125+
```csharp
126+
modelBuilder.Entity<GeoEntity>(
127+
x =>
128+
{
129+
// Allow any GEOMETRY value with optional Z and M values
130+
x.Property(e => e.Geometry).HasColumnType("GEOMETRYZM");
131+
132+
// Allow only POINT values with an optional Z value
133+
x.Property(e => e.Point).HasColumnType("POINTZ");
134+
});
135+
```
136+
105137
<a name="cosmos-partition-key"></a>
106138

107139
### Cosmos: Partition key is now added to the primary key
@@ -291,34 +323,6 @@ modelBuilder.Entity<BaseEntity>()
291323
.Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Save);
292324
```
293325

294-
<a name="defining-query"></a>
295-
296-
### Defining query is replaced with provider-specific methods
297-
298-
[Tracking Issue #18903](https://github.com/dotnet/efcore/issues/18903)
299-
300-
#### Old behavior
301-
302-
Entity types were mapped to defining queries at the Core level. Anytime the entity type was used in the query root of the entity type was replaced by the defining query for any provider.
303-
304-
#### New behavior
305-
306-
APIs for defining query are deprecated. New provider-specific APIs were introduced.
307-
308-
#### Why
309-
310-
While defining queries were implemented as replacement query whenever query root is used in the query, it had a few issues:
311-
312-
- If defining query is projecting entity type using `new { ... }` in `Select` method, then identifying that as an entity required additional work and made it inconsistent with how EF Core treats nominal types in the query.
313-
- For relational providers `FromSql` is still needed to pass the SQL string in LINQ expression form.
314-
315-
Initially defining queries were introduced as client-side views to be used with In-Memory provider for keyless entities (similar to database views in relational databases). Such definition makes it easy to test application against in-memory database. Afterwards they became broadly applicable, which was useful but brought inconsistent and hard to understand behavior. So we decided to simplify the concept. We made LINQ based defining query exclusive to In-Memory provider and treat them differently. For more information, [see this issue](https://github.com/dotnet/efcore/issues/20023).
316-
317-
#### Mitigations
318-
319-
For relational providers, use `ToSqlQuery` method in `OnModelCreating` and pass in a SQL string to use for the entity type.
320-
For the In-Memory provider, use `ToInMemoryQuery` method in `OnModelCreating` and pass in a LINQ query to use for the entity type.
321-
322326
<a name="no-client-methods"></a>
323327

324328
### Provider-specific EF.Functions methods throw for InMemory provider
@@ -367,13 +371,13 @@ If your project includes migrations generated prior to EF Core version 2.0.0, yo
367371

368372
<a name="pluralizer"></a>
369373

370-
### A pluarlizer is now included for scaffolding reverse engineered models
374+
### A pluralizer is now included for scaffolding reverse engineered models
371375

372376
[Tracking Issue #11160](https://github.com/dotnet/efcore/issues/11160)
373377

374378
#### Old behavior
375379

376-
Previously, you had to install a separate pluralizer package in order to pluralize DbSet and collection navigation names and singularize table names when scaffoding a DbContext and entity types by reverse engineering a database schema.
380+
Previously, you had to install a separate pluralizer package in order to pluralize DbSet and collection navigation names and singularize table names when scaffolding a DbContext and entity types by reverse engineering a database schema.
377381

378382
#### New behavior
379383

0 commit comments

Comments
 (0)