Skip to content

Commit d5c6240

Browse files
committed
Add EF7 function translations
Resolves dotnet#3868
1 parent c3d4ef9 commit d5c6240

File tree

6 files changed

+66
-8
lines changed

6 files changed

+66
-8
lines changed

entity-framework/core/providers/cosmos/functions.md

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ MathF.Truncate(x) | TRUNC(@x) | EF Core 6.0
6464

6565
.NET | SQL | Added in
6666
------------------------------------------------------------- | ---------------------------------------------------------- | --------
67+
Regex.IsMatch(input, pattern) | RegexMatch(@pattern, @input) | EF Core 7.0
68+
Regex.IsMatch(input, pattern, options) | RegexMatch(@input, @pattern, @options) | EF Core 7.0
6769
string.Concat(str0, str1) | @str0 + @str1 | EF Core 6.0
6870
string.Equals(a, b, StringComparison.Ordinal) | STRINGEQUALS(@a, @b) | EF Core 6.0
6971
string.Equals(a, b, StringComparison.OrdinalIgnoreCase) | STRINGEQUALS(@a, @b, true) | EF Core 6.0

entity-framework/core/providers/sql-server/functions.md

+19
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ uid: core/providers/sql-server/functions
99

1010
This page shows which .NET members are translated into which SQL functions when using the SQL Server provider.
1111

12+
## Aggregate functions
13+
14+
.NET | SQL | Added in
15+
----------------------------------------------------------------------- | -------------------------------- | --------
16+
EF.Functions.StandardDeviationSample(group.Select(x => x.Property)) | STDEV(Property) | EF Core 7.0
17+
EF.Functions.StandardDeviationPopulation(group.Select(x => x.Property)) | STDEVP(Property) | EF Core 7.0
18+
EF.Functions.VarianceSample(group.Select(x => x.Property)) | VAR(Property) | EF Core 7.0
19+
EF.Functions.VariancePopulation(group.Select(x => x.Property)) | VARP(Property) | EF Core 7.0
20+
group.Average(x => x.Property) | AVG(Property)
21+
group.Count() | COUNT(*)
22+
group.LongCount() | COUNT_BIG(*)
23+
group.Max(x => x.Property) | MAX(Property)
24+
group.Min(x => x.Property) | MIN(Property)
25+
group.Sum(x => x.Property) | SUM(Property)
26+
string.Concat(group.Select(x => x.Property)) | STRING_AGG(Property, N'') | EF Core 7.0
27+
string.Join(separator, group.Select(x => x.Property)) | STRING_AGG(Property, @separator) | EF Core 7.0
28+
1229
## Binary functions
1330

1431
.NET | SQL | Added in
@@ -93,6 +110,7 @@ dateTimeOffset.Month | DATEPART(month, @d
93110
dateTimeOffset.Second | DATEPART(second, @dateTimeOffset)
94111
dateTimeOffset.TimeOfDay | CONVERT(time, @dateTimeOffset)
95112
dateTimeOffset.Year | DATEPART(year, @dateTimeOffset)
113+
EF.Functions.AtTimeZone(dateTime, timeZone) | @dateTime AT TIME ZONE @timeZone | EF Core 7.0
96114
EF.Functions.DateDiffDay(start, end) | DATEDIFF(day, @start, @end)
97115
EF.Functions.DateDiffHour(start, end) | DATEDIFF(hour, @start, @end)
98116
EF.Functions.DateDiffMicrosecond(start, end) | DATEDIFF(microsecond, @start, @end)
@@ -182,6 +200,7 @@ stringValue.Contains(value) | @strin
182200
stringValue.EndsWith(value) | @stringValue LIKE N'%' + @value
183201
stringValue.FirstOrDefault() | SUBSTRING(@stringValue, 1, 1) | EF Core 5.0
184202
stringValue.IndexOf(value) | CHARINDEX(@value, @stringValue) - 1
203+
stringValue.IndexOf(value, startIndex) | CHARINDEX(@value, @stringValue, @startIndex) - 1 | EF Core 7.0
185204
stringValue.LastOrDefault() | SUBSTRING(@stringValue, LEN(@stringValue), 1) | EF Core 5.0
186205
stringValue.Length | LEN(@stringValue)
187206
stringValue.Replace(@oldValue, @newValue) | REPLACE(@stringValue, @oldValue, @newValue)

entity-framework/core/providers/sql-server/spatial.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ As mentioned in the main [Spatial Data](xref:core/modeling/spatial) documentatio
3535

3636
This table shows which NTS members are translated into which SQL functions. Note that the translations vary depending on whether the column is of type geography or geometry.
3737

38-
.NET | SQL (geography) | SQL (geometry)
39-
----------------------------------------- | ------------------------------------------------------------ | --------------
38+
.NET | SQL (geography) | SQL (geometry) | Added in
39+
----------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | --------
40+
EF.Functions.CurveToLine(geometry) | @geometry.STCurveToLine() | @geometry.STCurveToLine() | EF Core 7.0
4041
geometry.Area | @geometry.STArea() | @geometry.STArea()
4142
geometry.AsBinary() | @geometry.STAsBinary() | @geometry.STAsBinary()
4243
geometry.AsText() | @geometry.AsTextZM() | @geometry.AsTextZM()
@@ -92,6 +93,16 @@ polygon.ExteriorRing | @polygon.RingN(1)
9293
polygon.GetInteriorRingN(n) | @polygon.RingN(@n + 2) | @polygon.STInteriorRingN(@n + 1)
9394
polygon.NumInteriorRings | @polygon.NumRings() - 1 | @polygon.STNumInteriorRing()
9495

96+
### Aggregate functions
97+
98+
.NET | SQL | Added in
99+
----------------------------------------------------------------- | ----------------------------- | --------
100+
GeometryCombiner.Combine(group.Select(x => x.Property)) | CollectionAggregate(Property) | EF Core 7.0
101+
ConvexHull.Create(group.Select(x => x.Property)) | ConvexHullAggregate(Property) | EF Core 7.0
102+
UnaryUnionOp.Union(group.Select(x => x.Property)) | UnionAggregate(Property) | EF Core 7.0
103+
EnvelopeCombiner.CombineAsGeometry(group.Select(x => x.Property)) | EnvelopeAggregate(Property) | EF Core 7.0
104+
105+
95106
## Additional resources
96107

97108
* [Spatial Data in SQL Server](/sql/relational-databases/spatial/spatial-data-sql-server)

entity-framework/core/providers/sqlite/functions.md

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ uid: core/providers/sqlite/functions
99

1010
This page shows which .NET members are translated into which SQL functions when using the SQLite provider.
1111

12+
## Aggregate functions
13+
14+
.NET | SQL | Added in
15+
----------------------------------------------------- | ---------------------------------- | --------
16+
group.Average(x => x.Property) | AVG(Property)
17+
group.Count() | COUNT(*)
18+
group.LongCount() | COUNT(*)
19+
group.Max(x => x.Property) | MAX(Property)
20+
group.Min(x => x.Property) | MIN(Property)
21+
group.Sum(x => x.Property) | SUM(Property)
22+
string.Concat(group.Select(x => x.Property)) | group_concat(Property, '') | EF Core 7.0
23+
string.Join(separator, group.Select(x => x.Property)) | group_concat(Property, @separator) | EF Core 7.0
24+
1225
## Binary functions
1326

1427
.NET | SQL | Added in

entity-framework/core/providers/sqlite/spatial.md

+9
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ polygon.ExteriorRing | ExteriorRing(@polygon)
127127
polygon.GetInteriorRingN(n) | InteriorRingN(@polygon, @n + 1)
128128
polygon.NumInteriorRings | NumInteriorRing(@polygon)
129129

130+
### Aggregate functions
131+
132+
.NET | SQL | Added in
133+
----------------------------------------------------------------- | ----------------------------- | --------
134+
GeometryCombiner.Combine(group.Select(x => x.Property)) | Collect(Property) | EF Core 7.0
135+
ConvexHull.Create(group.Select(x => x.Property)) | ConvexHull(Collect(Property)) | EF Core 7.0
136+
UnaryUnionOp.Union(group.Select(x => x.Property)) | GUnion(Property) | EF Core 7.0
137+
EnvelopeCombiner.CombineAsGeometry(group.Select(x => x.Property)) | Extent(Property) | EF Core 7.0
138+
130139
## Additional resources
131140

132141
* [SpatiaLite Homepage](https://www.gaia-gis.it/fossil/libspatialite)

entity-framework/core/querying/complex-query-operators.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,16 @@ ORDER BY [p].[AuthorId]
116116

117117
The aggregate operators EF Core supports are as follows
118118

119-
- Average
120-
- Count
121-
- LongCount
122-
- Max
123-
- Min
124-
- Sum
119+
.NET | SQL
120+
------------------------ | ---
121+
Average(x => x.Property) | AVG(Property)
122+
Count() | COUNT(*)
123+
LongCount() | COUNT(*)
124+
Max(x => x.Property) | MAX(Property)
125+
Min(x => x.Property) | MIN(Property)
126+
Sum(x => x.Property) | SUM(Property)
127+
128+
Additional aggregate operators may be supported. Check your provider docs for more function mappings.
125129

126130
## Left Join
127131

0 commit comments

Comments
 (0)