From b0c96b058c07b784d945094cba129f5f5620f42f Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Wed, 9 Sep 2026 22:34:40 +0800 Subject: [PATCH 01/13] Read the values ACE caches for a calculated column A corpus of 27 .accdb files downloaded from the web turned up one table LibRed could not read: fctSales in AdventureWorks_Learn_To_Write_DAX, whose OrderDate is a calculated DateTime. The decoder was handed the whole 31-byte slot and refused it as a DateTime of the wrong width. ACE does not store a bare value there. It wraps the result it last computed in an envelope -- 16 reserved bytes, a 4-byte little-endian payload length, the payload, 3 bytes of padding -- and the payload is the value in its ordinary on-disk encoding, so it goes straight to the normal type codec once unwrapped. The descriptor's type is a STORAGE type, not the result type: ACE widens it to the next type in its family and keeps the payload at the result's natural width, so the payload length is what says how to read it. The (declared, width) pair is unambiguous -- Boolean and Byte both store one byte but promote to different declared types. A zero-length payload is Null, and the null-bitmap bit stays set regardless, which makes a calculated Boolean a trap: an ordinary Boolean IS its bitmap bit, but a calculated one carries a real payload and its bit is set for a stored False too, so the old short-circuit reported True for every row. A calculated Memo arrives through the long-value machinery instead: ACE declares it Text with length 0, gives it a long-value map entry, and stores a descriptor that resolves to the same envelope. The guard added in b0ef9760 required long-value map entries to name a Memo/OLE column and rejected that -- and because the catalog reads every table definition, one such column made the whole database unopenable. Writing is refused rather than attempted. Only ACE can evaluate the expression, so encoding the decoded value back would put a bare value where an envelope belongs; the check sits on AssembleRow, which both row writers pass through. DELETE stays allowed, and now frees a calculated Memo's pages -- it keyed the free off the declared type, walked past a Memo declared Text, and orphaned them. Measured against ACE-authored columns of every type DAO will create; the corpus goes from 342 tables read with one failure to 343 with none. Co-Authored-By: Claude Opus 5 --- src/LibRed/LibRed.Core/Catalog/ColumnDef.cs | 10 +- .../LibRed.Core/Pages/TableDefinitionPage.cs | 7 +- .../LibRed.Core/Storage/CalculatedValue.cs | 72 +++++ src/LibRed/LibRed.Core/Storage/RowDecoder.cs | 22 +- src/LibRed/LibRed.Core/Storage/RowEncoder.cs | 11 + src/LibRed/LibRed.Core/Storage/RowInserter.cs | 3 +- .../LibRed.Core/Storage/Types/JetTypeCodec.cs | 15 +- src/LibRed/docs/format/appendix-structures.md | 17 ++ src/LibRed/docs/format/page-02b-columns.md | 50 ++++ .../CalculatedColumnAccessTests.cs | 268 ++++++++++++++++++ 10 files changed, 465 insertions(+), 10 deletions(-) create mode 100644 src/LibRed/LibRed.Core/Storage/CalculatedValue.cs create mode 100644 test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs diff --git a/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs b/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs index 533c4b89..ac1b3db2 100644 --- a/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs +++ b/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs @@ -54,10 +54,16 @@ public sealed class ColumnDef /// The column can store compressed Unicode text (§7) — extended-flag bit 0x10/0x01. public bool SupportsCompressedUnicode { get; init; } - /// A calculated (computed) column (ACE 14+) — extended-flag bits 0x10/0xC0. LibRed reads and - /// preserves the flag; evaluating a calculated column's expression is separate (see the format spec). + /// A calculated (computed) column (ACE 14+) — extended-flag bits 0x10/0xC0. LibRed reads the + /// flag, preserves it, and decodes the cached result ACE stores for the column; evaluating the + /// expression itself is separate (see the format spec). public bool IsCalculated { get; init; } + /// The column owns a long-value (LVAL) map in the TDEF, so its stored chunk is a long-value + /// descriptor rather than the value itself. True for Memo/OLE — and for a calculated column whose + /// result can outgrow the row, which ACE gives a map whatever the column's declared type. + public bool HasLongValueMap { get; internal set; } + /// AutoNumber (COUNTER) seed and increment. The increment is read from the TDEF header (0x18); /// the seed is the header's last-assigned value (0x14) plus the increment — which equals the original /// seed on a freshly created table (before any inserts advance the last value). Default 1/1. diff --git a/src/LibRed/LibRed.Core/Pages/TableDefinitionPage.cs b/src/LibRed/LibRed.Core/Pages/TableDefinitionPage.cs index 33e1d915..004715f8 100644 --- a/src/LibRed/LibRed.Core/Pages/TableDefinitionPage.cs +++ b/src/LibRed/LibRed.Core/Pages/TableDefinitionPage.cs @@ -210,12 +210,17 @@ private void ReadLongValueMaps(PageBuffer buffer, int pos) ColumnDef? column = _columns.FirstOrDefault(c => c.ColumnId == colNum); if (column is null) throw new InvalidDataException($"TDEF long-value map references unknown column id {colNum}."); - if (column.Type is not (JetDataType.Memo or JetDataType.Ole)) + // A calculated column also gets a map, whatever its declared type: its cached result is stored + // as an envelope in the variable section and spills to an LVAL page when it outgrows the row. + // ACE writes one for a calculated Memo declared as Text, which this guard used to reject — + // and because the catalog loads every TDEF, that made the whole database unopenable. + if (column.Type is not (JetDataType.Memo or JetDataType.Ole) && !column.IsCalculated) throw new InvalidDataException( $"TDEF long-value map references non-long-value column '{column.Name}' ({column.Type})."); if (!seen.Add(colNum)) throw new InvalidDataException($"TDEF contains duplicate long-value map entries for column id {colNum}."); + column.HasLongValueMap = true; _longValueOwnedMaps[colNum] = (buffer.ReadByte(pos + 2), buffer.ReadInt24(pos + 3)); _longValueFreeMaps[colNum] = (buffer.ReadByte(pos + 6), buffer.ReadInt24(pos + 7)); pos += 10; diff --git a/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs b/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs new file mode 100644 index 00000000..8e4b5279 --- /dev/null +++ b/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs @@ -0,0 +1,72 @@ +using System.Buffers.Binary; +using LibRed.Catalog; + +namespace LibRed.Storage; + +/// +/// Unwraps the envelope ACE stores a calculated column's cached result in (spec: page-02b-columns § +/// "Calculated columns"). A calculated column is always variable-length, and its slot holds a fixed +/// header rather than a bare value: +/// +/// [reserved:16] [payloadLength:4] [payload:n] [padding:3] +/// +/// The payload is the value in its ordinary on-disk encoding for the column's declared type, so it goes +/// straight to — text keeps the usual compressed/raw UTF-16 choice. +/// When the column also owns a long-value map (a calculated Memo), the slot is a long-value descriptor +/// and the envelope is what that descriptor resolves to. +/// +internal static class CalculatedValue +{ + /// Reserved bytes before the length; zero in every file measured. + private const int HeaderSize = 16; + + /// Little-endian payload length. + private const int LengthSize = 4; + + /// Zero padding after the payload. + private const int PaddingSize = 3; + + /// The smallest envelope: header, length and padding with an empty payload. + public const int MinimumSize = HeaderSize + LengthSize + PaddingSize; + + /// Decodes the cached result inside , or null when the + /// expression evaluated to Null (ACE stores that as a zero-length payload, not a cleared null bit). + public static object? Decode(ColumnDef column, ReadOnlySpan envelope) + { + ReadOnlySpan payload = Payload(envelope, column); + return payload.Length == 0 ? null : Types.JetTypeCodec.Decode(column, StoredType(column, payload.Length), payload); + } + + /// + /// The type the payload is actually encoded in. ACE widens a calculated column's descriptor type to the + /// next storage type in its family and keeps the payload at the result's natural width, so the declared + /// type alone reads the wrong number of bytes. Measured against ACE-authored columns of every type DAO + /// will create; the (declared, width) pair is unambiguous, including Boolean and Byte, which promote to + /// different declared types and so stay distinguishable at one byte. + /// + private static JetDataType StoredType(ColumnDef column, int payloadLength) => column.Type switch + { + JetDataType.Int16 when payloadLength == 1 => JetDataType.Boolean, + JetDataType.Int32 when payloadLength == 1 => JetDataType.Byte, + JetDataType.Int32 when payloadLength == 2 => JetDataType.Int16, + JetDataType.Double when payloadLength == 4 => JetDataType.Single, + _ => column.Type, + }; + + /// The stored value inside , ready for the ordinary type codec. + public static ReadOnlySpan Payload(ReadOnlySpan envelope, ColumnDef column) + { + if (envelope.Length < MinimumSize) + throw new InvalidDataException( + $"Calculated column '{column.Name}' has a {envelope.Length}-byte stored value; " + + $"its envelope needs at least {MinimumSize}."); + + uint length = BinaryPrimitives.ReadUInt32LittleEndian(envelope.Slice(HeaderSize, LengthSize)); + if (length > envelope.Length - MinimumSize) + throw new InvalidDataException( + $"Calculated column '{column.Name}' declares a {length}-byte value inside a " + + $"{envelope.Length}-byte envelope."); + + return envelope.Slice(HeaderSize + LengthSize, (int)length); + } +} diff --git a/src/LibRed/LibRed.Core/Storage/RowDecoder.cs b/src/LibRed/LibRed.Core/Storage/RowDecoder.cs index bf087f5f..418f80ba 100644 --- a/src/LibRed/LibRed.Core/Storage/RowDecoder.cs +++ b/src/LibRed/LibRed.Core/Storage/RowDecoder.cs @@ -43,7 +43,11 @@ public sealed class RowDecoder(IReadOnlyList columns, JetFormatBase f // Jet stores Boolean (YesNo) columns with no fixed/variable data: the value // IS the null-bitmap bit (set = true). Booleans are never null. - if (column.Type == JetDataType.Boolean) + // + // A CALCULATED Boolean is the exception, and a silent one: it carries a real variable-length + // slot, and its bitmap bit means "present" like every other calculated column, so it is set + // for a stored False too. Reading the bit here would report True for every row. + if (column.Type == JetDataType.Boolean && !column.IsCalculated) { values[column.Index] = present; continue; @@ -59,6 +63,18 @@ public sealed class RowDecoder(IReadOnlyList columns, JetFormatBase f ? FixedSlice(row, layout, column) : layout.VarChunk(column.VariableIndex); + // A calculated column stores ACE's cached result wrapped in an envelope, routed through a + // long-value descriptor when the column owns a long-value map (which is how a calculated Memo + // arrives — ACE declares it Text, so the Memo branch below would never fire for it). + if (column.IsCalculated) + { + ReadOnlySpan envelope = column.HasLongValueMap && _longValues is not null + ? _longValues.Resolve(raw) + : raw; + values[column.Index] = CalculatedValue.Decode(column, envelope); + continue; + } + // Memo / OLE columns store a long-value descriptor, not the data itself. if (_longValues is not null && column.Type is JetDataType.Memo or JetDataType.Ole) { @@ -87,8 +103,10 @@ public Dictionary LongValueRaw(ReadOnlySpan row) ReadOnlySpan nullBitmap = row[^nullBitmapSize..]; + // Keyed on owning a long-value map rather than on the declared type: a calculated Memo is declared + // Text and still stores a descriptor, so a type test alone walks past its pages and orphans them. foreach (ColumnDef column in _columns) - if (column.Type is JetDataType.Memo or JetDataType.Ole + if ((column.Type is JetDataType.Memo or JetDataType.Ole || column.HasLongValueMap) && IsPresent(nullBitmap, layout.ColumnCount, column.ColumnId)) result[column.Index] = layout.VarChunk(column.VariableIndex).ToArray(); diff --git a/src/LibRed/LibRed.Core/Storage/RowEncoder.cs b/src/LibRed/LibRed.Core/Storage/RowEncoder.cs index fbeb2057..6491810a 100644 --- a/src/LibRed/LibRed.Core/Storage/RowEncoder.cs +++ b/src/LibRed/LibRed.Core/Storage/RowEncoder.cs @@ -111,6 +111,17 @@ private static void EnsureFitsDeclaredLength(ColumnDef column, byte[] encoded) internal static byte[] AssembleRow(int maxColumnId, ReadOnlySpan fixedRegion, IReadOnlyList varChunks, IReadOnlyList columns, object?[] values) { + // A calculated column's slot is not a value but an envelope holding ACE's cached result + // (page-02b §3.4a), and only ACE can evaluate the expression that fills it. Encoding the decoded + // value back would write a bare value into that slot, which ACE then reads as a corrupt envelope. + // Refusing is the honest outcome until LibRed can evaluate the expression itself: LibRed reads + // these tables, and until this guard existed reading them was impossible anyway. + foreach (ColumnDef column in columns) + if (column.IsCalculated) + throw new NotSupportedException( + $"Table has calculated column '{column.Name}', whose stored value only ACE can compute. " + + "LibRed reads calculated columns but cannot write a row that contains one."); + foreach (ColumnDef column in columns) if (!column.IsFixedLength && column.VariableIndex >= 0 && column.VariableIndex < varChunks.Count) EnsureFitsDeclaredLength(column, varChunks[column.VariableIndex]); diff --git a/src/LibRed/LibRed.Core/Storage/RowInserter.cs b/src/LibRed/LibRed.Core/Storage/RowInserter.cs index f1135834..1a72f210 100644 --- a/src/LibRed/LibRed.Core/Storage/RowInserter.cs +++ b/src/LibRed/LibRed.Core/Storage/RowInserter.cs @@ -225,7 +225,8 @@ public void Delete(RowId id) // Free the deleted row's chained long-value pages. var oldDescriptors = new RowDecoder(_table.Columns, format).LongValueRaw(ReadRowBytes(id)); foreach (ColumnDef column in _table.Columns) - if (column.Type is JetDataType.Memo or JetDataType.Ole && oldDescriptors.TryGetValue(column.Index, out byte[]? d)) + if ((column.Type is JetDataType.Memo or JetDataType.Ole || column.HasLongValueMap) + && oldDescriptors.TryGetValue(column.Index, out byte[]? d)) FreeLongValue(column, d); byte[] page = ArrayPool.Shared.Rent(format.PageSize); diff --git a/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs b/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs index b52f726b..ea69e71c 100644 --- a/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs +++ b/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs @@ -14,9 +14,16 @@ namespace LibRed.Storage.Types; public static class JetTypeCodec { /// Decodes a single non-null column value from its raw bytes. - public static object? Decode(ColumnDef column, ReadOnlySpan value) + public static object? Decode(ColumnDef column, ReadOnlySpan value) => Decode(column, column.Type, value); + + /// Decodes as rather than the column's declared + /// type. Only a calculated column needs this: ACE promotes its descriptor type to a wider storage type + /// (Boolean→Int16, Byte/Int16→Int32, Single→Double) while storing the payload at its natural width, so the + /// stored width is what says how to read it. still supplies the name for errors + /// and the scale for FixedPoint. + internal static object? Decode(ColumnDef column, JetDataType type, ReadOnlySpan value) { - int expectedLength = column.Type switch + int expectedLength = type switch { JetDataType.Byte => 1, JetDataType.Int16 => 2, @@ -29,9 +36,9 @@ public static class JetTypeCodec }; if (expectedLength >= 0 && value.Length != expectedLength) throw new InvalidDataException( - $"Column '{column.Name}' ({column.Type}) has {value.Length} bytes; expected {expectedLength}."); + $"Column '{column.Name}' ({type}) has {value.Length} bytes; expected {expectedLength}."); - switch (column.Type) + switch (type) { case JetDataType.Boolean: return value.Length > 0 && value[0] != 0; diff --git a/src/LibRed/docs/format/appendix-structures.md b/src/LibRed/docs/format/appendix-structures.md index b4611ac4..83d7d51a 100644 --- a/src/LibRed/docs/format/appendix-structures.md +++ b/src/LibRed/docs/format/appendix-structures.md @@ -127,6 +127,23 @@ Nullability is **not** in the descriptor — it's the `Required` property in `Lv --- +## Calculated-column value envelope — variable slot, *n* + 23 bytes → [page-02b §3.4a](page-02b-columns.md) + +| Offset | Size | Meaning | +| --- | --- | --- | +| `0x00` | 16 | Reserved (zero) | +| `0x10` | 4 | Payload length, little-endian | +| `0x14` | *n* | Payload — the value in its ordinary encoding | +| `0x14`+*n* | 3 | Padding (zero) | + +The descriptor's type at `0x00` is a **promoted storage type**; the payload length says the real one +(Int16+1 = Boolean, Int32+1 = Byte, Int32+2 = Int16, Double+4 = Single). Length `0` means Null, and the +null-bitmap bit is set regardless — including for a calculated Boolean storing False. A calculated Memo is +declared Text with length `0`, owns a long-value map entry, and reaches the envelope through a long-value +descriptor. + +--- + ## Index statistics block — 12 bytes, one per real index → [page-02d](page-02d-constraints.md) | Offset | Size | Meaning | diff --git a/src/LibRed/docs/format/page-02b-columns.md b/src/LibRed/docs/format/page-02b-columns.md index 0c725efd..4d80f658 100644 --- a/src/LibRed/docs/format/page-02b-columns.md +++ b/src/LibRed/docs/format/page-02b-columns.md @@ -79,6 +79,56 @@ > [system-catalog.md](system-catalog.md), and the **`DEFAULT` expression semantics** (what a default may > contain, how it is evaluated) in [page-02c-default-values.md](page-02c-default-values.md). +### 3.4a Calculated columns + +A calculated column (extended flag `0xC0` at `0x10`, ACE 14+) does not store a bare value. It is **always +variable-length**, and its slot holds a fixed envelope around the result ACE last computed: + +| Offset | Size | Meaning | +| --- | --- | --- | +| `0x00` | 16 | Reserved; zero in every row measured | +| `0x10` | 4 | Payload length, little-endian | +| `0x14` | *n* | Payload — the value in its ordinary on-disk encoding for its type | +| `0x14`+*n* | 3 | Padding; zero in every row measured | + +so a stored value occupies *n* + 23 bytes. The payload is encoded exactly as the same value would be in an +ordinary column — text keeps the usual compressed (`FF FE` prefix) or raw UTF-16LE choice — so it can go +straight to the normal type codec. + +> **The descriptor's type is a *storage* type, not the result type.** ACE widens the declared type to the +> next one in its family and stores the payload at the result's natural width, so reading `0x17` bytes for +> the declared type reads the wrong number. The payload length is what says how to decode it: +> +> | Descriptor type (`0x00`) | Payload length | Value is | +> | --- | --- | --- | +> | `0x03` Int16 | 1 | Boolean | +> | `0x04` Int32 | 1 | Byte | +> | `0x04` Int32 | 2 | Int16 | +> | `0x04` Int32 | 4 | Int32 | +> | `0x07` Double | 4 | Single | +> | `0x07` Double | 8 | Double | +> | `0x05` Currency | 8 | Currency | +> | `0x08` DateTime | 8 | DateTime | +> | `0x0A` Text | *n* | Text | +> | any | 0 | **Null** | +> +> The pair is unambiguous: Boolean and Byte both store one byte but promote to *different* declared types. +> A Null result is a zero-length payload — the null-bitmap bit stays **set**, so the bit means "present" +> here and nothing more. That also makes a calculated **Boolean** a trap: an ordinary Boolean *is* its +> bitmap bit, but a calculated one carries a real payload (`FF`/`00`) and its bit is set even when the +> value is False. The declared length at `0x17` is `39` for these columns and is not the payload size. +> +> **A calculated Memo arrives through the long-value machinery.** ACE declares it `0x0A` Text with a +> declared length of `0`, gives it a **long-value map entry**, and stores a long-value descriptor in the +> slot; the envelope above is what that descriptor resolves to. So a long-value map may name a column whose +> declared type is not Memo/OLE — a guard that assumed otherwise rejected the TDEF, and because the catalog +> loads every TDEF that made the whole database unopenable. +> +> Measured against ACE-authored columns of every type DAO will create (`CalculatedColumnAccessTests`), and +> against `AdventureWorks_Learn_To_Write_DAX.accdb`, a database in the wild whose `fctSales.OrderDate` is +> a calculated `DateTime`. LibRed **reads** these values; it does not create calculated columns or +> re-evaluate an expression, so a row it writes cannot refresh one. + > `0x0B`–`0x0C` is a union keyed by type: for a Decimal/Numeric column (type `0x10`) it holds > the **precision** (`0x0B`) and **scale** (`0x0C`) — verified with a `DECIMAL(12,3)` column, > which reads precision = 12, scale = 3; for every other type it reads the constant `0x0409` diff --git a/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs b/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs new file mode 100644 index 00000000..2e24c99f --- /dev/null +++ b/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs @@ -0,0 +1,268 @@ +using System.Reflection; +using LibRed.Catalog; +using LibRed.Storage; +using Xunit; + +namespace LibRed.Core.Tests; + +// Conformance: a calculated column's cached result must decode to the value ACE reads back. +// +// ACE stores the result in the variable-length section wrapped in an envelope (page-02b §3.4a), and the +// descriptor's type is a PROMOTED storage type — the payload's own length is what says how to decode it. +// Neither fact is guessable from the descriptor, so the only way to hold them is to have ACE author a +// column of every type and compare. +// +// LibRed cannot create a calculated column (Access SQL has no syntax for one), so DAO's object model is +// the author here — the same path Access's UI uses. Each column gets its own table because ACE validates +// the expression when the TableDef is appended, and one rejected expression would take the rest with it. +public class CalculatedColumnAccessTests(ITestOutputHelper output) +{ + private const int UseJet = 2; + private const int DbBoolean = 1, DbByte = 2, DbInteger = 3, DbLong = 4, DbCurrency = 5, + DbSingle = 6, DbDouble = 7, DbDate = 8, DbText = 10, DbMemo = 12; + + /// (column, DAO type, text size, expression) — one per type DAO will accept. + private static readonly (string Name, int Type, int Size, string Expression)[] Calculated = + [ + ("CText", DbText, 40, "[A] & \"-x\""), + ("CMemo", DbMemo, 0, "[A] & \"-memo\""), + ("CLong", DbLong, 0, "[Qty]*2"), + ("CInt", DbInteger, 0, "[Qty]+1"), + ("CByte", DbByte, 0, "[Qty]+2"), + ("CDbl", DbDouble, 0, "[Qty]/4"), + ("CSng", DbSingle, 0, "[Qty]/8"), + ("CCur", DbCurrency, 0, "[Price]*2"), + ("CDate", DbDate, 0, "[D1]+1"), + ("CBool", DbBoolean, 0, "[Qty]>1"), + ]; + + // Row 3 is the one that matters twice over: Qty=0 makes [Qty]>1 store False (whose null-bitmap bit is + // set anyway), and the NULLs make [D1]+1 evaluate to Null (stored as a zero-length payload). + private static readonly string[] Seed = + [ + "INSERT INTO {0} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)", + "INSERT INTO {0} (Id, Qty, Price, A, D1) VALUES (2, 3, 0.25, 'zz', #1999-01-02#)", + "INSERT INTO {0} (Id, Qty, Price, A, D1) VALUES (3, 0, 0, NULL, NULL)", + ]; + + [Fact] + public void Decodes_the_same_calculated_values_as_ace() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calculated-"); + try + { + string[] created = CreateFixture(engine!, path); + Assert.NotEmpty(created); + output.WriteLine($"DAO created: {string.Join(", ", created)}"); + + Dictionary> ace = SeedAndReadWithAce(path, created); + + // Opening the catalog at all is half the regression: ACE gives a calculated Memo a long-value + // map entry while declaring it Text, and the catalog reads EVERY table definition — so a guard + // that rejected the entry made every table in the database unreadable, not just that one. + using var db = JetDatabase.Open(path, readOnly: true); + Assert.NotEmpty(db.Catalog.Tables); + + var mismatches = new List(); + foreach (string name in created) + { + Table table = db.OpenTable("T_" + name); + int index = table.Definition.FindColumn(name)!.Index; + List libred = [.. table.Rows().Select(r => r[index])]; + List expected = ace[name]; + + output.WriteLine($" {name,-6} ACE [{Format(expected)}] LibRed [{Format(libred)}]"); + if (libred.Count != expected.Count) + { + mismatches.Add($"{name}: {expected.Count} rows from ACE, {libred.Count} from LibRed"); + continue; + } + for (int i = 0; i < expected.Count; i++) + if (!Matches(expected[i], libred[i])) + mismatches.Add($"{name} row {i + 1}: ACE {Describe(expected[i])}, LibRed {Describe(libred[i])}"); + } + + Assert.Empty(mismatches); + } + finally { TemporaryDatabase.Delete(path); } + } + + // Reading these tables is new, which makes writing one newly reachable — and a write would put a bare + // value where ACE expects an envelope, corrupting the column silently. Refusing is the honest outcome + // while only ACE can evaluate the expression. + [Fact] + public void Refuses_to_write_a_row_containing_a_calculated_column() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calculated-write-"); + try + { + string[] created = CreateFixture(engine!, path); + Assert.Contains("CLong", created); + + using var db = JetDatabase.Open(path, readOnly: false); + Table table = db.OpenTable("T_CLong"); + var values = new object?[table.Definition.Columns.Count]; + values[table.Definition.FindColumn("Id")!.Index] = 1; + + var ex = Assert.Throws(() => table.Insert(values)); + output.WriteLine(ex.Message); + Assert.Contains("CLong", ex.Message); + } + finally { TemporaryDatabase.Delete(path); } + } + + // DELETE does not encode a row, so it is still allowed — but it frees the deleted row's long values, + // and a calculated Memo reaches its pages through a descriptor while being declared Text. Keying that + // off the declared type walked past it and orphaned the pages; ACE must still read the table after. + [Fact] + public void Deleting_a_row_frees_a_calculated_memo_and_leaves_the_table_readable() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calculated-delete-"); + try + { + string[] created = CreateFixture(engine!, path); + Assert.Contains("CMemo", created); + SeedAndReadWithAce(path, ["CMemo"]); + + using (var db = JetDatabase.Open(path, readOnly: false)) + { + Table table = db.OpenTable("T_CMemo"); + RowId first = table.Rows().WithIds().First().Id; + table.Delete(first); + } + + using (var db = JetDatabase.Open(path, readOnly: true)) + { + Table table = db.OpenTable("T_CMemo"); + int index = table.Definition.FindColumn("CMemo")!.Index; + List remaining = [.. table.Rows().Select(r => r[index])]; + Assert.Equal(["zz-memo", "-memo"], remaining); + } + + // ACE is the arbiter of whether the delete left the file coherent. + using var connection = AceTestDatabase.Open(path); + using var command = connection.CreateCommand(); + command.CommandText = "SELECT CMemo FROM T_CMemo ORDER BY Id"; + using var reader = command.ExecuteReader(); + var ace = new List(); + while (reader.Read()) ace.Add(reader.IsDBNull(0) ? null : reader.GetValue(0)); + Assert.Equal(["zz-memo", "-memo"], ace); + } + finally { TemporaryDatabase.Delete(path); } + } + + /// Builds the database and one table per calculated column, returning those DAO accepted. + private string[] CreateFixture(object engine, string path) + { + object workspace = Invoke(engine, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + + var created = new List(); + foreach ((string name, int type, int size, string expression) in Calculated) + { + try + { + object tdf = Invoke(database, "CreateTableDef", "T_" + name)!; + object fields = GetProperty(tdf, "Fields")!; + Invoke(fields, "Append", Invoke(tdf, "CreateField", "Id", DbLong)!); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "Qty", DbLong)!); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "Price", DbCurrency)!); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "A", DbText, 20)!); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "D1", DbDate)!); + + object field = size > 0 + ? Invoke(tdf, "CreateField", name, type, size)! + : Invoke(tdf, "CreateField", name, type)!; + SetProperty(field, "Expression", expression); + Invoke(fields, "Append", field); + Invoke(GetProperty(database, "TableDefs")!, "Append", tdf); + created.Add(name); + } + catch (TargetInvocationException ex) + { + // A future ACE could narrow what an expression may contain; skip rather than fail on it. + output.WriteLine($" {name,-6} rejected by DAO: {ex.InnerException?.Message.Trim()}"); + } + } + + Invoke(database, "Close"); + return [.. created]; + } + + /// Seeds the base columns through ACE — which computes and caches each result — then reads the + /// calculated values back the same way, so the expectation is ACE's own answer. + private static Dictionary> SeedAndReadWithAce(string path, string[] created) + { + var values = new Dictionary>(); + using var connection = AceTestDatabase.Open(path); + foreach (string name in created) + { + foreach (string template in Seed) + { + using var insert = connection.CreateCommand(); + insert.CommandText = string.Format(template, "T_" + name); + insert.ExecuteNonQuery(); + } + + using var select = connection.CreateCommand(); + select.CommandText = $"SELECT [{name}] FROM [T_{name}] ORDER BY Id"; + using var reader = select.ExecuteReader(); + var read = new List(); + while (reader.Read()) read.Add(reader.IsDBNull(0) ? null : reader.GetValue(0)); + values[name] = read; + } + return values; + } + + /// Compares across two providers, which disagree about width and decimal scale but not value: + /// ACE hands back a Currency zero as 0.0000 where LibRed says 0. + private static bool Matches(object? ace, object? libred) + { + if (ace is null) return libred is null; + if (libred is null) return false; + if (ace is string || libred is string) return string.Equals(ace.ToString(), libred.ToString(), StringComparison.Ordinal); + if (ace is bool || libred is bool) return Convert.ToBoolean(ace) == Convert.ToBoolean(libred); + if (ace is DateTime || libred is DateTime) return Convert.ToDateTime(ace) == Convert.ToDateTime(libred); + return Convert.ToDecimal(ace) == Convert.ToDecimal(libred); + } + + private static string Format(IEnumerable values) => string.Join(", ", values.Select(Describe)); + + private static string Describe(object? value) => value switch + { + null => "", + string s => $"\"{s}\"", + DateTime d => d.ToString("yyyy-MM-dd HH:mm:ss"), + _ => $"{value} ({value.GetType().Name})", + }; + + private static object? CreateDbEngine() + { + foreach (int n in new[] { 170, 160, 150, 140, 130, 120 }) + { + Type? type = Type.GetTypeFromProgID($"DAO.DBEngine.{n}"); + if (type is null) continue; + try { return Activator.CreateInstance(type); } + catch (Exception) { /* registered but not instantiable in this bitness */ } + } + return null; + } + + private static object? Invoke(object target, string member, params object?[] args) => + target.GetType().InvokeMember(member, BindingFlags.InvokeMethod, null, target, args); + + private static object? GetProperty(object target, string member) => + target.GetType().InvokeMember(member, BindingFlags.GetProperty, null, target, null); + + private static void SetProperty(object target, string member, object? value) => + target.GetType().InvokeMember(member, BindingFlags.SetProperty, null, target, [value]); +} From 6291dca2daa59a68d96416206892f2f936049ca1 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Thu, 10 Sep 2026 01:44:35 +0800 Subject: [PATCH 02/13] Update to .NET 11 RC 1 and EF Core 11 RC 1, and update the tests with it Co-Authored-By: Claude Opus 5 --- AGENTS.md | 4 +- CLAUDE.md | 4 +- Dependencies.targets | 26 +- global.json | 2 +- .../JetQueryTranslationPostprocessor.cs | 26 -- .../LibRedQueryTranslationPostprocessor.cs | 26 -- .../AssemblyInfo.cs | 9 +- .../F1JetFixture.cs | 73 +--- .../JetComplianceTest.cs | 2 - .../ManyToManyFieldsLoadSqlServerTest.cs | 8 +- .../ManyToManyLoadSqlServerTest.cs | 67 ++-- .../AdHocAdvancedMappingsQueryJetTest.cs | 2 +- .../Query/AdHocComplexTypeQueryJetTest.cs | 50 --- .../Query/AdHocManyToManyQueryJetTest.cs | 109 ------ .../Query/AdHocMiscellaneousQueryJetTest.cs | 58 +-- .../Query/AdHocNavigationsQueryJetTest.cs | 48 +-- .../Query/AdHocQuerySplittingQueryJetTest.cs | 8 +- .../NavigationsCollectionJetTest.cs | 6 +- .../Navigations/NavigationsIncludeJetTest.cs | 18 +- .../NavigationsMiscellaneousJetTest.cs | 8 +- .../NavigationsProjectionJetTest.cs | 28 +- .../NavigationsStructuralEqualityJetTest.cs | 26 +- ...mplexNavigationsCollectionsQueryJetTest.cs | 168 ++++---- ...NavigationsCollectionsSplitQueryJetTest.cs | 4 +- .../Query/ComplexNavigationsQueryJetTest.cs | 58 +-- .../Query/ComplexTypeQueryJetTest.cs | 358 +++++++++++++++++- .../Query/CompositeKeysQueryJetTest.cs | 12 +- .../Query/Ef6GroupByJetTest.cs | 12 +- .../Query/EntitySplittingQueryJetTest.cs | 10 +- .../Query/FromSqlQueryJetTest.cs | 4 +- .../Query/GearsOfWarQueryJetTest.cs | 347 +++++++++-------- .../TPCFiltersInheritanceQueryJetFixture.cs | 5 +- .../TPCFiltersInheritanceQueryJetTest.cs | 5 +- .../TPCGearsOfWarQueryJetFixture.cs | 5 +- .../TPCGearsOfWarQueryJetTest.cs | 77 ++-- .../TPCInheritanceQueryJetFixture.cs | 5 + .../TPCInheritanceQueryJetFixtureBase.cs | 5 +- .../TPCInheritanceQueryJetTest.cs | 5 +- .../TPCInheritanceQueryJetTestBase.cs | 7 +- .../TPCManyToManyNoTrackingQueryJetTest.cs | 130 +++++-- .../TPCManyToManyQueryJetFixture.cs | 5 +- .../TPCManyToManyQueryJetTest.cs | 130 +++++-- .../TPCRelationshipsQueryJetTest.cs | 63 ++- .../TPHInheritanceQueryJetFixture.cs | 5 +- .../TPHInheritanceQueryJetTest.cs | 25 +- .../TPTFiltersInheritanceQueryJetFixture.cs | 9 + .../TPTFiltersInheritanceQueryJetTest.cs | 11 +- .../TPTGearsOfWarQueryJetFixture.cs | 5 +- .../TPTGearsOfWarQueryJetTest.cs | 206 +++++----- .../TPTInheritanceQueryJetFixture.cs | 5 +- .../TPTInheritanceQueryJetTest.cs | 23 +- .../TPTManyToManyNoTrackingQueryJetTest.cs | 132 +++++-- .../TPTManyToManyQueryJetFixture.cs | 5 +- .../TPTManyToManyQueryJetTest.cs | 132 +++++-- .../TPTRelationshipsQueryJetTest.cs | 33 +- .../InheritanceRelationshipsQueryJetTest.cs | 30 +- .../Query/ManyToManyNoTrackingQueryJetTest.cs | 26 +- .../Query/ManyToManyQueryJetTest.cs | 119 +++++- ...teOperatorsQueryJetTest.ResultOperators.cs | 2 +- .../Query/NorthwindCompiledQueryJetTest.cs | 12 +- .../NorthwindEFPropertyIncludeQueryJetTest.cs | 84 ++-- ...orthwindFunctionsQueryJetTest.Functions.cs | 2 +- .../Query/NorthwindGroupByQueryJetTest.cs | 36 +- .../NorthwindIncludeNoTrackingQueryJetTest.cs | 56 +-- .../Query/NorthwindIncludeQueryJetTest.cs | 84 ++-- .../Query/NorthwindJoinQueryJetTest.cs | 12 +- .../NorthwindMiscellaneousQueryJetTest.cs | 86 ++--- .../Query/NorthwindNavigationsQueryJetTest.cs | 8 +- .../NorthwindQueryFiltersQueryJetTest.cs | 2 +- .../NorthwindQueryTaggingQueryJetTest.cs | 2 +- .../Query/NorthwindSelectQueryJetTest.cs | 37 +- .../NorthwindSetOperationsQueryJetTest.cs | 14 +- ...hwindSplitIncludeNoTrackingQueryJetTest.cs | 8 +- .../NorthwindSplitIncludeQueryJetTest.cs | 8 +- .../NorthwindStringIncludeQueryJetTest.cs | 84 ++-- .../Query/NorthwindWhereQueryJetTest.cs | 84 ++-- .../Query/NullSemanticsQueryJetTest.cs | 2 +- .../Query/OwnedEntityQueryJetTest.cs | 6 +- .../Query/OwnedQueryJetTest.cs | 6 +- .../Query/PrecompiledQueryJetTest.cs | 10 +- ...PrecompiledSqlPregenerationQueryJetTest.cs | 4 +- .../Query/TPCInheritanceQueryJetFixture.cs | 8 - .../TPTFiltersInheritanceQueryJetFixture.cs | 12 - .../Translations/MathTranslationsJetTest.cs | 18 +- .../Translations/StringTranslationsJetTest.cs | 14 +- .../Properties/AssemblyInfo.cs | 4 +- .../AssemblyInfo.cs | 11 +- .../F1LibRedFixture.cs | 73 +--- .../LibRedComplianceTest.cs | 2 - .../ManyToManyFieldsLoadSqlServerTest.cs | 8 +- .../ManyToManyLoadSqlServerTest.cs | 64 ++-- .../AdHocAdvancedMappingsQueryLibRedTest.cs | 2 +- .../Query/AdHocComplexTypeQueryLibRedTest.cs | 49 --- .../Query/AdHocManyToManyQueryLibRedTest.cs | 107 ------ .../AdHocMiscellaneousQueryLibRedTest.cs | 60 +-- .../Query/AdHocNavigationsQueryLibRedTest.cs | 56 +-- .../AdHocQuerySplittingQueryLibRedTest.cs | 8 +- .../NavigationsCollectionLibRedTest.cs | 12 +- .../NavigationsIncludeLibRedTest.cs | 18 +- .../NavigationsMiscellaneousLibRedTest.cs | 8 +- .../NavigationsProjectionLibRedTest.cs | 30 +- ...NavigationsStructuralEqualityLibRedTest.cs | 26 +- ...OwnedNavigationsSetOperationsLibRedTest.cs | 4 +- ...exNavigationsCollectionsQueryLibRedTest.cs | 256 ++++++------- ...igationsCollectionsSplitQueryLibRedTest.cs | 4 +- .../ComplexNavigationsQueryLibRedTest.cs | 52 +-- .../Query/ComplexTypeQueryLibRedTest.cs | 358 +++++++++++++++++- .../Query/CompositeKeysQueryLibRedTest.cs | 12 +- .../Query/Ef6GroupByLibRedTest.cs | 12 +- .../Query/EntitySplittingQueryLibRedTest.cs | 10 +- .../Query/FromSqlQueryLibRedTest.cs | 6 +- .../Query/GearsOfWarQueryLibRedTest.cs | 357 +++++++++-------- ...TPCFiltersInheritanceQueryLibRedFixture.cs | 5 +- .../TPCFiltersInheritanceQueryLibRedTest.cs | 5 +- .../TPCGearsOfWarQueryLibRedFixture.cs | 5 +- .../TPCGearsOfWarQueryLibRedTest.cs | 67 ++-- .../TPCInheritanceQueryLibRedFixture.cs | 5 +- .../TPCInheritanceQueryLibRedFixtureBase.cs | 5 +- .../TPCInheritanceQueryLibRedTest.cs | 5 +- .../TPCInheritanceQueryLibRedTestBase.cs | 7 +- .../TPCManyToManyNoTrackingQueryLibRedTest.cs | 152 ++++++-- .../TPCManyToManyQueryLibRedFixture.cs | 5 +- .../TPCManyToManyQueryLibRedTest.cs | 152 ++++++-- .../TPCRelationshipsQueryLibRedTest.cs | 63 ++- .../TPHInheritanceQueryLibRedFixture.cs | 5 +- .../TPHInheritanceQueryLibRedTest.cs | 25 +- ...TPTFiltersInheritanceQueryLibRedFixture.cs | 5 +- .../TPTFiltersInheritanceQueryLibRedTest.cs | 11 +- .../TPTGearsOfWarQueryLibRedFixture.cs | 5 +- .../TPTGearsOfWarQueryLibRedTest.cs | 172 ++++----- .../TPTInheritanceQueryLibRedFixture.cs | 5 +- .../TPTInheritanceQueryLibRedTest.cs | 23 +- .../TPTManyToManyNoTrackingQueryLibRedTest.cs | 156 ++++++-- .../TPTManyToManyQueryLibRedFixture.cs | 5 +- .../TPTManyToManyQueryLibRedTest.cs | 156 ++++++-- .../TPTRelationshipsQueryLibRedTest.cs | 33 +- ...InheritanceRelationshipsQueryLibRedTest.cs | 30 +- .../ManyToManyNoTrackingQueryLibRedTest.cs | 40 +- .../Query/ManyToManyQueryLibRedTest.cs | 131 ++++++- ...peratorsQueryLibRedTest.ResultOperators.cs | 2 +- .../Query/NorthwindCompiledQueryLibRedTest.cs | 12 +- ...rthwindEFPropertyIncludeQueryLibRedTest.cs | 120 +++--- ...hwindFunctionsQueryLibRedTest.Functions.cs | 2 +- .../Query/NorthwindGroupByQueryLibRedTest.cs | 60 +-- ...rthwindIncludeNoTrackingQueryLibRedTest.cs | 92 ++--- .../Query/NorthwindIncludeQueryLibRedTest.cs | 120 +++--- .../Query/NorthwindJoinQueryLibRedTest.cs | 12 +- .../NorthwindMiscellaneousQueryLibRedTest.cs | 84 ++-- .../NorthwindNavigationsQueryLibRedTest.cs | 8 +- .../NorthwindQueryFiltersQueryLibRedTest.cs | 2 +- .../NorthwindQueryTaggingQueryLibRedTest.cs | 2 +- .../Query/NorthwindSelectQueryLibRedTest.cs | 68 ++-- .../NorthwindSetOperationsQueryLibRedTest.cs | 16 +- ...ndSplitIncludeNoTrackingQueryLibRedTest.cs | 8 +- .../NorthwindSplitIncludeQueryLibRedTest.cs | 8 +- .../NorthwindStringIncludeQueryLibRedTest.cs | 118 +++--- .../Query/NorthwindWhereQueryLibRedTest.cs | 20 +- .../Query/NullSemanticsQueryLibRedTest.cs | 2 +- .../Query/OwnedEntityQueryLibRedTest.cs | 6 +- .../Query/OwnedQueryLibRedTest.cs | 8 +- .../Query/PrecompiledQueryLibRedTest.cs | 14 +- ...compiledSqlPregenerationQueryLibRedTest.cs | 4 +- .../MathTranslationsLibRedTest.cs | 6 +- .../StringTranslationsLibRedTest.cs | 10 +- .../TimeOnlyTranslationsLibRedTest.cs | 2 +- .../AssemblyInfo.cs | 11 +- .../F1LibRedFixture.cs | 73 +--- .../LibRedComplianceTest.cs | 2 - .../ManyToManyFieldsLoadSqlServerTest.cs | 8 +- .../ManyToManyLoadSqlServerTest.cs | 64 ++-- .../AdHocAdvancedMappingsQueryLibRedTest.cs | 2 +- .../Query/AdHocComplexTypeQueryLibRedTest.cs | 49 --- .../Query/AdHocManyToManyQueryLibRedTest.cs | 108 ------ .../AdHocMiscellaneousQueryLibRedTest.cs | 60 +-- .../Query/AdHocNavigationsQueryLibRedTest.cs | 50 +-- .../AdHocQuerySplittingQueryLibRedTest.cs | 8 +- .../NavigationsCollectionLibRedTest.cs | 10 +- .../NavigationsIncludeLibRedTest.cs | 18 +- .../NavigationsMiscellaneousLibRedTest.cs | 8 +- .../NavigationsProjectionLibRedTest.cs | 28 +- ...NavigationsStructuralEqualityLibRedTest.cs | 26 +- .../OwnedNavigationsCollectionLibRedTest.cs | 2 +- ...OwnedNavigationsSetOperationsLibRedTest.cs | 4 +- ...exNavigationsCollectionsQueryLibRedTest.cs | 168 ++++---- ...igationsCollectionsSplitQueryLibRedTest.cs | 4 +- .../ComplexNavigationsQueryLibRedTest.cs | 40 +- .../Query/ComplexTypeQueryLibRedTest.cs | 358 +++++++++++++++++- .../Query/CompositeKeysQueryLibRedTest.cs | 12 +- .../Query/Ef6GroupByLibRedTest.cs | 16 +- .../Query/EntitySplittingQueryLibRedTest.cs | 10 +- .../Query/FromSqlQueryLibRedTest.cs | 6 +- .../Query/GearsOfWarQueryLibRedTest.cs | 331 ++++++++-------- ...TPCFiltersInheritanceQueryLibRedFixture.cs | 5 +- .../TPCFiltersInheritanceQueryLibRedTest.cs | 5 +- .../TPCGearsOfWarQueryLibRedFixture.cs | 5 +- .../TPCGearsOfWarQueryLibRedTest.cs | 75 ++-- .../TPCInheritanceQueryLibRedFixture.cs | 5 + .../TPCInheritanceQueryLibRedFixtureBase.cs | 5 +- .../TPCInheritanceQueryLibRedTest.cs | 5 +- .../TPCInheritanceQueryLibRedTestBase.cs | 7 +- .../TPCManyToManyNoTrackingQueryLibRedTest.cs | 129 +++++-- .../TPCManyToManyQueryLibRedFixture.cs | 5 +- .../TPCManyToManyQueryLibRedTest.cs | 129 +++++-- .../TPCRelationshipsQueryLibRedTest.cs | 63 ++- .../TPHInheritanceQueryLibRedFixture.cs | 5 +- .../TPHInheritanceQueryLibRedTest.cs | 25 +- ...TPTFiltersInheritanceQueryLibRedFixture.cs | 9 + .../TPTFiltersInheritanceQueryLibRedTest.cs | 11 +- .../TPTGearsOfWarQueryLibRedFixture.cs | 5 +- .../TPTGearsOfWarQueryLibRedTest.cs | 178 +++++---- .../TPTInheritanceQueryLibRedFixture.cs | 5 +- .../TPTInheritanceQueryLibRedTest.cs | 23 +- .../TPTManyToManyNoTrackingQueryLibRedTest.cs | 131 +++++-- .../TPTManyToManyQueryLibRedFixture.cs | 5 +- .../TPTManyToManyQueryLibRedTest.cs | 131 +++++-- .../TPTRelationshipsQueryLibRedTest.cs | 33 +- ...InheritanceRelationshipsQueryLibRedTest.cs | 30 +- .../ManyToManyNoTrackingQueryLibRedTest.cs | 26 +- .../Query/ManyToManyQueryLibRedTest.cs | 118 +++++- ...peratorsQueryLibRedTest.ResultOperators.cs | 2 +- .../Query/NorthwindCompiledQueryLibRedTest.cs | 12 +- ...rthwindEFPropertyIncludeQueryLibRedTest.cs | 90 ++--- ...hwindFunctionsQueryLibRedTest.Functions.cs | 2 +- .../Query/NorthwindGroupByQueryLibRedTest.cs | 36 +- ...rthwindIncludeNoTrackingQueryLibRedTest.cs | 62 +-- .../Query/NorthwindIncludeQueryLibRedTest.cs | 90 ++--- .../Query/NorthwindJoinQueryLibRedTest.cs | 12 +- .../NorthwindMiscellaneousQueryLibRedTest.cs | 80 ++-- .../NorthwindNavigationsQueryLibRedTest.cs | 8 +- .../NorthwindQueryFiltersQueryLibRedTest.cs | 2 +- .../NorthwindQueryTaggingQueryLibRedTest.cs | 2 +- .../Query/NorthwindSelectQueryLibRedTest.cs | 37 +- .../NorthwindSetOperationsQueryLibRedTest.cs | 14 +- ...ndSplitIncludeNoTrackingQueryLibRedTest.cs | 8 +- .../NorthwindSplitIncludeQueryLibRedTest.cs | 8 +- .../NorthwindStringIncludeQueryLibRedTest.cs | 90 ++--- .../Query/NorthwindWhereQueryLibRedTest.cs | 20 +- .../Query/NullSemanticsQueryLibRedTest.cs | 2 +- .../Query/OwnedEntityQueryLibRedTest.cs | 6 +- .../Query/OwnedQueryLibRedTest.cs | 8 +- .../Query/PrecompiledQueryLibRedTest.cs | 10 +- ...compiledSqlPregenerationQueryLibRedTest.cs | 4 +- .../Query/TPCInheritanceQueryLibRedFixture.cs | 8 - ...TPTFiltersInheritanceQueryLibRedFixture.cs | 12 - .../MathTranslationsLibRedTest.cs | 18 +- .../StringTranslationsLibRedTest.cs | 10 +- .../TimeOnlyTranslationsLibRedTest.cs | 2 +- test/LibRed.Ado.Tests/TestAssembly.cs | 5 +- 248 files changed, 5922 insertions(+), 4570 deletions(-) delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCFiltersInheritanceQueryJetFixture.cs (55%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCFiltersInheritanceQueryJetTest.cs (97%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCGearsOfWarQueryJetFixture.cs (95%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCGearsOfWarQueryJetTest.cs (99%) create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixture.cs rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryJetFixtureBase.cs (72%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryJetTest.cs (61%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryJetTestBase.cs (99%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyNoTrackingQueryJetTest.cs (97%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyQueryJetFixture.cs (70%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyQueryJetTest.cs (97%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPCRelationshipsQueryJetTest.cs (99%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPHInheritanceQueryJetFixture.cs (69%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPHInheritanceQueryJetTest.cs (97%) create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetFixture.cs rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTFiltersInheritanceQueryJetTest.cs (96%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTGearsOfWarQueryJetFixture.cs (95%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTGearsOfWarQueryJetTest.cs (99%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTInheritanceQueryJetFixture.cs (77%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTInheritanceQueryJetTest.cs (98%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyNoTrackingQueryJetTest.cs (97%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyQueryJetFixture.cs (70%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyQueryJetTest.cs (97%) rename test/EFCore.Jet.FunctionalTests/Query/{ => Inheritance}/TPTRelationshipsQueryJetTest.cs (99%) delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixture.cs delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetFixture.cs delete mode 100644 test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs delete mode 100644 test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCFiltersInheritanceQueryLibRedFixture.cs (68%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCFiltersInheritanceQueryLibRedTest.cs (98%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCGearsOfWarQueryLibRedFixture.cs (96%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCGearsOfWarQueryLibRedTest.cs (99%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedFixture.cs (51%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedFixtureBase.cs (80%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedTest.cs (72%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedTestBase.cs (99%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyNoTrackingQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyQueryLibRedFixture.cs (79%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPCRelationshipsQueryLibRedTest.cs (99%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPHInheritanceQueryLibRedFixture.cs (78%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPHInheritanceQueryLibRedTest.cs (98%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTFiltersInheritanceQueryLibRedFixture.cs (64%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTFiltersInheritanceQueryLibRedTest.cs (96%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTGearsOfWarQueryLibRedFixture.cs (96%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTGearsOfWarQueryLibRedTest.cs (99%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTInheritanceQueryLibRedFixture.cs (84%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTInheritanceQueryLibRedTest.cs (98%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyNoTrackingQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyQueryLibRedFixture.cs (79%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.Extended.FunctionalTests/Query/{ => Inheritance}/TPTRelationshipsQueryLibRedTest.cs (99%) delete mode 100644 test/EFCore.LibRed.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs delete mode 100644 test/EFCore.LibRed.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCFiltersInheritanceQueryLibRedFixture.cs (56%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCFiltersInheritanceQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCGearsOfWarQueryLibRedFixture.cs (95%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCGearsOfWarQueryLibRedTest.cs (99%) create mode 100644 test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedFixtureBase.cs (72%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedTest.cs (61%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCInheritanceQueryLibRedTestBase.cs (99%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyNoTrackingQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyQueryLibRedFixture.cs (70%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCManyToManyQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPCRelationshipsQueryLibRedTest.cs (99%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPHInheritanceQueryLibRedFixture.cs (69%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPHInheritanceQueryLibRedTest.cs (97%) create mode 100644 test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTFiltersInheritanceQueryLibRedTest.cs (96%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTGearsOfWarQueryLibRedFixture.cs (95%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTGearsOfWarQueryLibRedTest.cs (99%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTInheritanceQueryLibRedFixture.cs (77%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTInheritanceQueryLibRedTest.cs (98%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyNoTrackingQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyQueryLibRedFixture.cs (70%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTManyToManyQueryLibRedTest.cs (97%) rename test/EFCore.LibRed.FunctionalTests/Query/{ => Inheritance}/TPTRelationshipsQueryLibRedTest.cs (99%) delete mode 100644 test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs delete mode 100644 test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs diff --git a/AGENTS.md b/AGENTS.md index eddc9d01..a639b6fe 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,7 +7,7 @@ It is kept in sync with `CLAUDE.md`; if you change guidance in one, check whethe EntityFrameworkCore.Jet is an EF Core provider for Microsoft Jet/ACE databases (Microsoft Access `.mdb`/`.accdb` files). The **Jet** provider runs **Windows only** and bridges EF Core to the Access database engine via either ODBC or OLE DB. Alongside it, **LibRed** (also in this repo, on `master`) is a from-scratch managed engine that reads/writes the file format directly and is **cross-platform** — see the LibRed section below. -Current version: `11.0.0-alpha.1` (`Version.props`) targeting EF Core 11 and `net11.0`; `global.json` pins an 11.0.100 preview SDK with `rollForward: latestFeature`. The test projects use **xunit v3**. +Current version: `11.0.0-alpha.1` (`Version.props`) targeting EF Core 11 and `net11.0`; `global.json` pins the 11.0.100 RC1 SDK with `rollForward: latestFeature`. The test projects use **xunit v3**. ### Which layer am I touching? @@ -167,7 +167,7 @@ shared type subclassing or branching — see `LibRedConventionSetBuilder`, `LibR `LibRedCodeGenerator`, `LibRedDesignTimeServices`. The types below are named where they live today: - `JetServiceCollectionExtensions.AddEntityFrameworkJet()` registers all provider services. - `JetQuerySqlGenerator` extends `QuerySqlGenerator` to produce Jet-compatible SQL — converts `CAST` to Jet VBA functions (`CBOOL`, `CINT`, `CLNG`, etc.), handles boolean/numeric null semantics. -- `JetQueryTranslationPostprocessor` applies Jet-specific query rewrites in this order: skip/take transformation → base postprocessing → **append the query's last identifier column to `ORDER BY`** (deterministic tie-breaking, only when the query already orders) → optional millisecond support → ORDER BY lifting. `JetSkipTakePostprocessor` emulates `SKIP`/`OFFSET` since Jet only supports `SELECT TOP n`. Note it reaches `SelectExpression._identifier` by reflection, so an EF Core update can break it at runtime rather than at compile time. +- `JetQueryTranslationPostprocessor` applies Jet-specific query rewrites in this order: skip/take transformation → base postprocessing → ORDER BY lifting. `JetSkipTakePostprocessor` emulates `SKIP`/`OFFSET` since Jet only supports `SELECT TOP n`. LibRed's copy runs the same two steps but gates both on `LibRedSqlMode.Compatible`. - `JetMigrationsSqlGenerator` generates DDL for Access. It **does** emit `ALTER TABLE … ALTER COLUMN` (Jet's form folds the default value into the `ALTER COLUMN` rather than taking a separate operation); constraint support is still limited. - `JetHistoryRepository` implements migration locking via a `__EFMigrationsLock` table with `LockReleaseBehavior.Explicit`. - `JetRelationalConnection` creates an "empty" (masterless) connection for database creation/drop operations. diff --git a/CLAUDE.md b/CLAUDE.md index 4ccbe089..ae230437 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co EntityFrameworkCore.Jet is an EF Core provider for Microsoft Jet/ACE databases (Microsoft Access `.mdb`/`.accdb` files). The **Jet** provider runs **Windows only** and bridges EF Core to the Access database engine via either ODBC or OLE DB. Alongside it, **LibRed** (also in this repo, on `master`) is a from-scratch managed engine that reads/writes the file format directly and is **cross-platform** — see the LibRed section below. -Current version: `11.0.0-alpha.1` (`Version.props`) targeting EF Core 11 and `net11.0`; `global.json` pins an 11.0.100 preview SDK with `rollForward: latestFeature`. The test projects use **xunit v3**. +Current version: `11.0.0-alpha.1` (`Version.props`) targeting EF Core 11 and `net11.0`; `global.json` pins the 11.0.100 RC1 SDK with `rollForward: latestFeature`. The test projects use **xunit v3**. ### Which layer am I touching? @@ -179,7 +179,7 @@ shared type subclassing or branching — see `LibRedConventionSetBuilder`, `LibR `LibRedCodeGenerator`, `LibRedDesignTimeServices`. The types below are named where they live today: - `JetServiceCollectionExtensions.AddEntityFrameworkJet()` registers all provider services. - `JetQuerySqlGenerator` extends `QuerySqlGenerator` to produce Jet-compatible SQL — converts `CAST` to Jet VBA functions (`CBOOL`, `CINT`, `CLNG`, etc.), handles boolean/numeric null semantics. -- `JetQueryTranslationPostprocessor` applies Jet-specific query rewrites in this order: skip/take transformation → base postprocessing → **append the query's last identifier column to `ORDER BY`** (deterministic tie-breaking, only when the query already orders) → optional millisecond support → ORDER BY lifting. `JetSkipTakePostprocessor` emulates `SKIP`/`OFFSET` since Jet only supports `SELECT TOP n`. Note it reaches `SelectExpression._identifier` by reflection, so an EF Core update can break it at runtime rather than at compile time. +- `JetQueryTranslationPostprocessor` applies Jet-specific query rewrites in this order: skip/take transformation → base postprocessing → ORDER BY lifting. `JetSkipTakePostprocessor` emulates `SKIP`/`OFFSET` since Jet only supports `SELECT TOP n`. LibRed's copy runs the same two steps but gates both on `LibRedSqlMode.Compatible`. - `JetMigrationsSqlGenerator` generates DDL for Access. It **does** emit `ALTER TABLE … ALTER COLUMN` (Jet's form folds the default value into the `ALTER COLUMN` rather than taking a separate operation); constraint support is still limited. - `JetHistoryRepository` implements migration locking via a `__EFMigrationsLock` table with `LockReleaseBehavior.Explicit`. - `JetRelationalConnection` creates an "empty" (masterless) connection for database creation/drop operations. diff --git a/Dependencies.targets b/Dependencies.targets index 079dea98..adf32fed 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ - [11.0.0-preview.7.26381.103] - [11.0.0-preview.7.26381.103] - [11.0.0-preview.7.26381.103] + [11.0.0-rc.1.26425.128] + [11.0.0-rc.1.26425.128] + [11.0.0-rc.1.26425.128] @@ -12,7 +12,7 @@ - + @@ -25,27 +25,27 @@ - + - - - + + + - - - - + + + + - + diff --git a/global.json b/global.json index a3a604c7..0890380e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "11.0.100-preview.7.26381.103", + "version": "11.0.100-rc.1.26425.128", "allowPrerelease": true, "rollForward": "latestFeature" } diff --git a/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs b/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs index c957f013..0b2a1873 100644 --- a/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs +++ b/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs @@ -6,11 +6,6 @@ namespace EntityFrameworkCore.Jet.Query.Internal { public class JetQueryTranslationPostprocessor : RelationalQueryTranslationPostprocessor { - private static readonly FieldInfo SelectExpressionIdentifierField = typeof(SelectExpression).GetField( - "_identifier", - BindingFlags.Instance | BindingFlags.NonPublic) - ?? throw new InvalidOperationException("Could not find SelectExpression._identifier."); - private readonly IRelationalTypeMappingSource _relationalTypeMappingSource; private readonly JetLiftOrderByPostprocessor _liftOrderByPostprocessor; private readonly JetSkipTakePostprocessor _skipTakePostprocessor; @@ -34,30 +29,9 @@ public override Expression Process(Expression query) query = base.Process(query); - var identifiers = GetIdentifiers(query); - - if (identifiers.Count > 0 - && query is ShapedQueryExpression { QueryExpression: SelectExpression selectExpression } - && !selectExpression.Orderings.Any( - ordering => ordering.Expression.Equals(identifiers[^1].Column)) && selectExpression.Orderings.Any()) - { - selectExpression.AppendOrdering( - new OrderingExpression(identifiers[^1].Column, ascending: true)); - } - query = _liftOrderByPostprocessor.Process(query); return query; } - - private static IReadOnlyList<(ColumnExpression Column, ValueComparer Comparer)> GetIdentifiers(Expression query) - { - if (query is not ShapedQueryExpression { QueryExpression: SelectExpression selectExpression }) - { - return []; - } - - return (IReadOnlyList<(ColumnExpression Column, ValueComparer Comparer)>)SelectExpressionIdentifierField.GetValue(selectExpression)!; - } } } diff --git a/src/LibRed/LibRed.EFCore/Query/Internal/LibRedQueryTranslationPostprocessor.cs b/src/LibRed/LibRed.EFCore/Query/Internal/LibRedQueryTranslationPostprocessor.cs index b4db3727..659d6def 100644 --- a/src/LibRed/LibRed.EFCore/Query/Internal/LibRedQueryTranslationPostprocessor.cs +++ b/src/LibRed/LibRed.EFCore/Query/Internal/LibRedQueryTranslationPostprocessor.cs @@ -8,11 +8,6 @@ namespace EntityFrameworkCore.LibRed.Query.Internal { public class LibRedQueryTranslationPostprocessor : RelationalQueryTranslationPostprocessor { - private static readonly FieldInfo SelectExpressionIdentifierField = typeof(SelectExpression).GetField( - "_identifier", - BindingFlags.Instance | BindingFlags.NonPublic) - ?? throw new InvalidOperationException("Could not find SelectExpression._identifier."); - private readonly IRelationalTypeMappingSource _relationalTypeMappingSource; private readonly JetLiftOrderByPostprocessor _liftOrderByPostprocessor; private readonly JetSkipTakePostprocessor _skipTakePostprocessor; @@ -42,17 +37,6 @@ public override Expression Process(Expression query) query = base.Process(query); - var identifiers = GetIdentifiers(query); - - if (identifiers.Count > 0 - && query is ShapedQueryExpression { QueryExpression: SelectExpression selectExpression } - && !selectExpression.Orderings.Any( - ordering => ordering.Expression.Equals(identifiers[^1].Column)) && selectExpression.Orderings.Any()) - { - selectExpression.AppendOrdering( - new OrderingExpression(identifiers[^1].Column, ascending: true)); - } - if (_sqlMode == LibRedSqlMode.Compatible) { query = _liftOrderByPostprocessor.Process(query); @@ -60,15 +44,5 @@ public override Expression Process(Expression query) return query; } - - private static IReadOnlyList<(ColumnExpression Column, ValueComparer Comparer)> GetIdentifiers(Expression query) - { - if (query is not ShapedQueryExpression { QueryExpression: SelectExpression selectExpression }) - { - return []; - } - - return (IReadOnlyList<(ColumnExpression Column, ValueComparer Comparer)>)SelectExpressionIdentifierField.GetValue(selectExpression)!; - } } } diff --git a/test/EFCore.Jet.FunctionalTests/AssemblyInfo.cs b/test/EFCore.Jet.FunctionalTests/AssemblyInfo.cs index 398ae649..8ecb885b 100644 --- a/test/EFCore.Jet.FunctionalTests/AssemblyInfo.cs +++ b/test/EFCore.Jet.FunctionalTests/AssemblyInfo.cs @@ -1,5 +1,6 @@ -using Xunit; +using Xunit.Sdk; +using Xunit.v3; -[assembly: CollectionBehavior( - DisableTestParallelization = false, - MaxParallelThreads = 1)] \ No newline at end of file +[assembly: Parallelization( + Mode = ParallelMode.Collections, + MaxThreads = 1)] \ No newline at end of file diff --git a/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs b/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs index 19701478..b357e0b2 100644 --- a/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs @@ -15,78 +15,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests { - public class F1JetFixture : F1JetFixtureBase - { - protected override void BuildModelExternal(ModelBuilder modelBuilder) - { - base.BuildModelExternal(modelBuilder); - - var converter = new BinaryVersionConverter(); - var comparer = new BinaryVersionComparer(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - } - - private class BinaryVersionConverter() : ValueConverter, byte[]>( - v => v == null ? null : v.ToArray(), - v => v == null ? null : v.ToList()); - - private class BinaryVersionComparer() : ValueComparer>( - (l, r) => (l == null && r == null) || (l != null && r != null && l.SequenceEqual(r)), - v => CalculateHashCode(v), - v => v == null ? null : v.ToList()) - { - private static int CalculateHashCode(List source) - { - if (source == null) - { - return 0; - } - - var hash = new HashCode(); - foreach (var el in source) - { - hash.Add(el); - } - - return hash.ToHashCode(); - } - } - } + public class F1JetFixture : F1JetFixtureBase; public abstract class F1JetFixtureBase : F1RelationalFixture { diff --git a/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs b/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs index ad16f35d..4552c6f5 100644 --- a/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetComplianceTest.cs @@ -28,8 +28,6 @@ public class JetComplianceTest : RelationalComplianceTestBase typeof(JsonQueryTestBase<>), typeof(JsonQueryRelationalTestBase<>), typeof(JsonUpdateTestBase<>), - typeof(AdHocJsonQueryRelationalTestBase), - typeof(AdHocJsonQueryTestBase), typeof(OwnedJsonBulkUpdateRelationalTestBase<>), typeof(OwnedJsonCollectionRelationalTestBase<>), typeof(OwnedJsonMiscellaneousRelationalTestBase<>), diff --git a/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs b/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs index 97d50d3a..e5ba7554 100644 --- a/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs @@ -48,7 +48,7 @@ LEFT JOIN ( WHERE `e1`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId` """); } @@ -75,7 +75,7 @@ LEFT JOIN ( WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId` """); } @@ -139,7 +139,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } @@ -172,7 +172,7 @@ LEFT JOIN ( WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs b/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs index 9b233fa1..1a45441d 100644 --- a/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs @@ -27,47 +27,26 @@ public override async Task Load_collection(EntityState state, QueryTrackingBehav await base.Load_collection(state, queryTrackingBehavior, async); AssertSql( - state == EntityState.Detached - ? """ - @p='3' - @p='3' - - SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` - FROM (`EntityOnes` AS `e` - INNER JOIN ( - SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` - FROM `JoinOneToTwo` AS `j` - INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - ) AS `s` ON `e`.`Id` = `s`.`OneId`) - LEFT JOIN ( - SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` - FROM `JoinOneToTwo` AS `j0` - INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = @p - ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` - WHERE `e`.`Id` = @p - ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` - """ - : """ - @p='3' - @p='3' - - SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId`, `s0`.`JoinOneToTwoExtraId`, `s0`.`Id`, `s0`.`Name` - FROM (`EntityOnes` AS `e` - INNER JOIN ( - SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` - FROM `JoinOneToTwo` AS `j` - INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - ) AS `s` ON `e`.`Id` = `s`.`OneId`) - LEFT JOIN ( - SELECT `j0`.`OneId`, `j0`.`TwoId`, `j0`.`JoinOneToTwoExtraId`, `e1`.`Id`, `e1`.`Name` - FROM `JoinOneToTwo` AS `j0` - INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = @p - ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` - WHERE `e`.`Id` = @p - ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` - """); + """ +@p='3' +@p='3' + +SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` +FROM (`EntityOnes` AS `e` +INNER JOIN ( + SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` + FROM `JoinOneToTwo` AS `j` + INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` +) AS `s` ON `e`.`Id` = `s`.`OneId`) +LEFT JOIN ( + SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` + FROM `JoinOneToTwo` AS `j0` + INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` + WHERE `e1`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`TwoId` +WHERE `e`.`Id` = @p +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId` +"""); } public override async Task Load_collection_using_Query_with_Include_for_inverse(bool async) @@ -93,7 +72,7 @@ LEFT JOIN ( WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId` """); } @@ -157,7 +136,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } @@ -190,7 +169,7 @@ LEFT JOIN ( WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs index ab9c42f5..a1738cfb 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs @@ -42,7 +42,7 @@ LEFT JOIN ( FROM `Posts` AS `p` WHERE `p`.`Name` LIKE '%2%' ) AS `p0` ON `b`.`Id` = `p0`.`BlogId` -ORDER BY `b`.`Id`, `p0`.`Id` +ORDER BY `b`.`Id` """, // """ diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs deleted file mode 100644 index b777e5f7..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -public class AdHocComplexTypeQueryJetTest(NonSharedFixture fixture) : AdHocComplexTypeQueryRelationalTestBase(fixture) -{ - public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() - { - await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); - - AssertSql( - """ -@entity_equality_container_Id='1' (Nullable = true) -@entity_equality_container_Containee1_Id='2' (Nullable = true) -@entity_equality_container_Containee2_Id='3' (Nullable = true) - -SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` -FROM `EntityType` AS `e` -WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id -"""); - } - - public override async Task Projecting_complex_property_does_not_auto_include_owned_types() - { - await base.Projecting_complex_property_does_not_auto_include_owned_types(); - - AssertSql( - """ -SELECT `e`.`Complex_Name`, `e`.`Complex_Number` -FROM `EntityType` AS `e` -"""); - } - - - protected new TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; - - protected new void AssertSql(params string[] expected) - => TestSqlLoggerFactory.AssertBaseline(expected); - - protected override ITestStoreFactory NonSharedTestStoreFactory - => JetTestStoreFactory.Instance; -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs deleted file mode 100644 index 087a6dab..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs +++ /dev/null @@ -1,109 +0,0 @@ -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -#nullable disable - -public class AdHocManyToManyQueryJetTest(NonSharedFixture fixture) : AdHocManyToManyQueryRelationalTestBase(fixture) -{ - protected override ITestStoreFactory NonSharedTestStoreFactory - => JetTestStoreFactory.Instance; - - public override async Task SelectMany_with_collection_selector_having_subquery() - { - await base.SelectMany_with_collection_selector_having_subquery(); - - AssertSql( - """ -SELECT [u].[Id] AS [UserId], [s].[Id] AS [OrgId] -FROM [Users] AS [u] -CROSS JOIN ( - SELECT [o1].[Id] - FROM ( - SELECT 1 AS empty - ) AS [e] - LEFT JOIN ( - SELECT [o].[Id] - FROM [Organisations] AS [o] - WHERE EXISTS ( - SELECT 1 - FROM [OrganisationUser] AS [o0] - WHERE [o].[Id] = [o0].[OrganisationId]) - ) AS [o1] ON 1 = 1 -) AS [s] -"""); - } - - public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) - { - await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); - - AssertSql( - """ -@p='1' - -SELECT TOP 1 `m`.`Id` -FROM `ManyM_DB` AS `m` -WHERE `m`.`Id` = @p -""", - // - """ -@p='1' -@p='1' - -SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` -FROM (`ManyM_DB` AS `m` -INNER JOIN ( - SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` - FROM `ManyMN_DB` AS `m0` - LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` -) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) -LEFT JOIN ( - SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` - FROM `ManyMN_DB` AS `m2` - INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @p -) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` -WHERE `m`.`Id` = @p -ORDER BY `m`.`Id`, `s`.`Id0`, `s0`.`Id` -""", - // - """ -@p='1' - -SELECT TOP 1 `m`.`Id` -FROM `ManyN_DB` AS `m` -WHERE `m`.`Id` = @p -""", - // - """ -@p='1' -@p='1' - -SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` -FROM (`ManyN_DB` AS `m` -INNER JOIN ( - SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` - FROM `ManyMN_DB` AS `m0` - INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` -) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) -LEFT JOIN ( - SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` - FROM `ManyMN_DB` AS `m2` - INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @p -) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` -WHERE `m`.`Id` = @p -ORDER BY `m`.`Id`, `s`.`Id0`, `s0`.`Id` -"""); - } - - [Fact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs index 605f947e..434eaf93 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs @@ -1987,7 +1987,7 @@ SELECT DISTINCT `i`.`Parcel` HAVING COUNT(*) = 1 ) AS `i0` ON `t`.`ParcelNumber` = `i0`.`Parcel` WHERE `t`.`TableId` = 123 -ORDER BY `t`.`ParcelNumber`, `i0`.`Parcel` +ORDER BY `t`.`ParcelNumber` """); } @@ -2128,7 +2128,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2145,7 +2145,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2162,7 +2162,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2179,7 +2179,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2213,7 +2213,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2230,7 +2230,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2263,7 +2263,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2280,7 +2280,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2297,7 +2297,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2314,7 +2314,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2331,7 +2331,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2348,7 +2348,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2365,7 +2365,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2382,7 +2382,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2426,7 +2426,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2463,7 +2463,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2484,7 +2484,7 @@ GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s1` INNER JOIN `Statuses` AS `s0` ON `s1`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `s1`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2508,7 +2508,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2525,7 +2525,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2549,7 +2549,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2566,7 +2566,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2584,7 +2584,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId`) INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2597,7 +2597,7 @@ public override async Task Plain_inner_no_aggregate_LeftJoin_whole_object() SELECT `s`.`PickupStatusId`, `r`.`PickupStatusId`, 1 AS `Count` FROM `Statuses` AS `s` LEFT JOIN `Requests` AS `r` ON `s`.`PickupStatusId` = `r`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r`.`Id` +ORDER BY `s`.`PickupStatusId` """); } @@ -2642,7 +2642,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2819,7 +2819,7 @@ LEFT JOIN ( FROM `Requests` AS `r1` GROUP BY `r1`.`PickupStatusId` ) AS `r2` ON `s`.`PickupStatusId` = `r2`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r2`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2839,7 +2839,7 @@ GROUP BY `r`.`PickupStatusId` INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId`) LEFT JOIN `Statuses` AS `s1` ON `s0`.`PickupStatusId` = `s1`.`PickupStatusId` WHERE `s0`.`PickupStatusId` IS NOT NULL AND `s1`.`PickupStatusId` IS NOT NULL -ORDER BY `s1`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s1`.`PickupStatusId` """); } @@ -2857,7 +2857,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId`) INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2895,7 +2895,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs index a3889ffb..e851b9ee 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs @@ -44,35 +44,35 @@ public virtual async Task Nested_include_queries_do_not_populate_navigation_twic SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -131,7 +131,7 @@ LEFT JOIN ( FROM `Children` AS `c` LEFT JOIN `Children` AS `c0` ON `c`.`Id` = `c0`.`SelfReferenceBackNavigationId` ) AS `s` ON `p`.`Id` = `s`.`ParentBackNavigationId` -ORDER BY `p`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `p`.`Id`, `s`.`Id` """, // """ @@ -165,28 +165,28 @@ public override async Task Customer_collections_materialize_properly() SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId1` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId2` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId3` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId4` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """); } @@ -219,7 +219,7 @@ LEFT JOIN ( WHERE `p0`.`Discriminator` = 'PersonKid9038' ) AS `s` ON `p`.`Id` = `s`.`TeacherId` WHERE `p`.`Discriminator` = 'PersonTeacher9038' -ORDER BY `p`.`Id`, `s`.`Id`, `s`.`Id1` +ORDER BY `p`.`Id`, `s`.`Id` """, // """ @@ -233,7 +233,7 @@ LEFT JOIN ( WHERE `p1`.`Discriminator` = 'PersonKid9038' ) AS `p2` ON `p`.`Id` = `p2`.`TeacherId` WHERE `p`.`Discriminator` = 'PersonTeacher9038' -ORDER BY `p`.`Id`, `p0`.`Id`, `p2`.`Id` +ORDER BY `p`.`Id`, `p0`.`Id` """); } @@ -246,14 +246,14 @@ public override async Task Include_with_order_by_on_interface_key() SELECT `p`.`Id`, `p`.`Name`, `c`.`Id`, `c`.`Name`, `c`.`Parent10635Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Children` AS `c` ON `p`.`Id` = `c`.`Parent10635Id` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ SELECT `p`.`Id`, `c`.`Id`, `c`.`Name`, `c`.`Parent10635Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Children` AS `c` ON `p`.`Id` = `c`.`Parent10635Id` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """); } @@ -268,7 +268,7 @@ public override async Task Collection_without_setter_materialized_correctly() LEFT JOIN `Posts` AS `p` ON `b`.`Id` = `p`.`BlogId1`) LEFT JOIN `Posts` AS `p0` ON `b`.`Id` = `p0`.`BlogId2`) LEFT JOIN `Posts` AS `p1` ON `b`.`Id` = `p1`.`BlogId3` -ORDER BY `b`.`Id`, `p`.`Id`, `p0`.`Id`, `p1`.`Id` +ORDER BY `b`.`Id`, `p`.`Id`, `p0`.`Id` """, // """ @@ -307,14 +307,14 @@ public override async Task Include_collection_works_when_defined_on_intermediate SELECT `s`.`Id`, `s`.`Discriminator`, `s0`.`Id`, `s0`.`SchoolId` FROM `Schools` AS `s` LEFT JOIN `Students` AS `s0` ON `s`.`Id` = `s0`.`SchoolId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """, // """ SELECT `s`.`Id`, `s0`.`Id`, `s0`.`SchoolId` FROM `Schools` AS `s` LEFT JOIN `Students` AS `s0` ON `s`.`Id` = `s0`.`SchoolId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """); } @@ -368,7 +368,7 @@ public override async Task Include_collection_with_OfType_base() SELECT `e`.`Id`, `e`.`Name`, `d`.`Id`, `d`.`Device`, `d`.`EmployeeId` FROM `Employees` AS `e` LEFT JOIN `Devices` AS `d` ON `e`.`Id` = `d`.`EmployeeId` -ORDER BY `e`.`Id`, `d`.`Id` +ORDER BY `e`.`Id` """, // """ @@ -379,7 +379,7 @@ LEFT JOIN ( FROM `Devices` AS `d` WHERE `d`.`Device` <> 'foo' OR `d`.`Device` IS NULL ) AS `d0` ON `e`.`Id` = `d0`.`EmployeeId` -ORDER BY `e`.`Id`, `d0`.`Id` +ORDER BY `e`.`Id` """); } @@ -392,7 +392,7 @@ public override async Task Correlated_collection_correctly_associates_entities_w SELECT `b`.`Name`, `c`.`Id` FROM `Blogs` AS `b` LEFT JOIN `Comments` AS `c` ON `b`.`Name` = `c`.`BlogName` -ORDER BY `b`.`Name`, `c`.`Id` +ORDER BY `b`.`Name` """); } @@ -533,7 +533,7 @@ ORDER BY `e`.`Id` SELECT `e`.`Id`, `o`.`Id`, `o`.`AppEntityId` FROM `Entities` AS `e` LEFT JOIN `OtherEntity` AS `o` ON `e`.`Id` = `o`.`AppEntityId` -ORDER BY `e`.`Id`, `o`.`Id` +ORDER BY `e`.`Id` """); } } @@ -559,7 +559,7 @@ public override async Task Cycles_in_auto_include() SELECT `p`.`Id`, `d`.`Id`, `d`.`PrincipalId` FROM `PrincipalOneToMany` AS `p` LEFT JOIN `DependentOneToMany` AS `d` ON `p`.`Id` = `d`.`PrincipalId` -ORDER BY `p`.`Id`, `d`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -567,7 +567,7 @@ public override async Task Cycles_in_auto_include() FROM (`DependentOneToMany` AS `d` INNER JOIN `PrincipalOneToMany` AS `p` ON `d`.`PrincipalId` = `p`.`Id`) LEFT JOIN `DependentOneToMany` AS `d0` ON `p`.`Id` = `d0`.`PrincipalId` -ORDER BY `d`.`Id`, `d0`.`Id` +ORDER BY `d`.`Id` """, // """ @@ -624,7 +624,7 @@ LEFT JOIN ( FROM `ManyDependent` AS `m0` LEFT JOIN `SingleDependent` AS `s` ON `m0`.`Id` = `s`.`ManyDependentId` ) AS `s0` ON `p`.`Id` = `s0`.`PrincipalId` -ORDER BY `m`.`Id`, `s0`.`Id` +ORDER BY `m`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs index 8f0cfd2a..9fb1b4fb 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs @@ -67,7 +67,7 @@ public override async Task Can_configure_SingleQuery_at_context_level() SELECT `p`.`Id`, `c`.`Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -88,7 +88,7 @@ ORDER BY `p`.`Id` FROM (`Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId`) LEFT JOIN `AnotherChild` AS `a` ON `p`.`Id` = `a`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id`, `a`.`Id` +ORDER BY `p`.`Id`, `c`.`Id` """); } @@ -114,7 +114,7 @@ ORDER BY `p`.`Id` SELECT `p`.`Id`, `c`.`Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -174,7 +174,7 @@ public override async Task Using_AsSingleQuery_without_context_configuration_doe FROM (`Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId`) LEFT JOIN `AnotherChild` AS `a` ON `p`.`Id` = `a`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id`, `a`.`Id` +ORDER BY `p`.`Id`, `c`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs index dd9b87b2..9f76e4a2 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId`) = 2) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -67,7 +67,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Int` <> 8) = 2) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -250,7 +250,7 @@ SELECT IIF(SUM(`a`.`Int`) IS NULL, 0, SUM(`a`.`Int`)) WHERE `r`.`Id` = `a`.`CollectionRootId` GROUP BY `a`.`String` )) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs index c8c8c5c4..7407cc7f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs @@ -32,7 +32,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -60,7 +60,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -88,7 +88,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -116,7 +116,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -144,7 +144,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -172,7 +172,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -200,7 +200,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -228,7 +228,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -256,7 +256,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs index 4689090b..75e310b1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Int` = 8) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -64,7 +64,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Int` = 8) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -92,7 +92,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Int` = 8) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -124,7 +124,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `m`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `m`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs index 6015bde7..9102a1cf 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs @@ -34,7 +34,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -105,7 +105,7 @@ public override async Task Select_associate(QueryTrackingBehavior queryTrackingB LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -121,7 +121,7 @@ public override async Task Select_optional_associate(QueryTrackingBehavior query LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -191,7 +191,7 @@ public override async Task Select_required_associate_via_optional_navigation(Que LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -208,7 +208,7 @@ public override async Task Select_unmapped_associate_scalar_property(QueryTracki LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -243,7 +243,7 @@ LEFT JOIN ( INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `r`.`Id`, `s`.`Id` """); } @@ -257,7 +257,7 @@ public override async Task Select_nested_collection_on_required_associate(QueryT FROM (`RootEntity` AS `r` INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`Id` = `n`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n`.`Id` +ORDER BY `r`.`Id` """); } @@ -271,7 +271,7 @@ public override async Task Select_nested_collection_on_optional_associate(QueryT FROM (`RootEntity` AS `r` LEFT JOIN `AssociateType` AS `a` ON `r`.`OptionalAssociateId` = `a`.`Id`) LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`Id` = `n`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n`.`Id` +ORDER BY `r`.`Id` """); } @@ -288,7 +288,7 @@ public override async Task SelectMany_associate_collection(QueryTrackingBehavior LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `a`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id`, `a`.`Id` """); } @@ -357,7 +357,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n11` ON `a`.`Id` = `n11`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n12` ON `a0`.`Id` = `n12`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `n11`.`Id`, `n12`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `n11`.`Id` """); } @@ -375,7 +375,7 @@ public override async Task Select_required_associate_duplicated(QueryTrackingBeh LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n2` ON `a`.`Id` = `n2`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id`, `n2`.`Id` +ORDER BY `r`.`Id`, `n1`.`Id` """); } @@ -396,7 +396,7 @@ public override async Task Select_required_associate_and_optional_associate(Quer LEFT JOIN `NestedAssociateType` AS `n3` ON `a`.`Id` = `n3`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n4` ON `a0`.`Id` = `n4`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n3`.`Id`, `n4`.`Id` +ORDER BY `r`.`Id`, `n3`.`Id` """); } @@ -413,7 +413,7 @@ public override async Task Select_optional_associate_and_ints(QueryTrackingBehav LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -430,7 +430,7 @@ public override async Task Select_associate_and_target_to_index_based_binding_vi LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs index b795df66..edbc2799 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs @@ -34,7 +34,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` = `a0`.`Id`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -62,7 +62,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` = `n0`.`Id`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -90,7 +90,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` <> `a0`.`Id` OR `a0`.`Id` IS NULL) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -118,7 +118,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` IS NULL) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -146,7 +146,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` IS NULL) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -174,7 +174,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` IS NULL) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -202,7 +202,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` = 1000) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -232,7 +232,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` = @entity_equality_nested_Id) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -260,7 +260,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` = `a0`.`Id`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -307,7 +307,7 @@ LEFT JOIN ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = 1002)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -340,7 +340,7 @@ LEFT JOIN ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = @entity_equality_nested_Id)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -374,7 +374,7 @@ LEFT JOIN ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Int` > @get_Item_Int AND `n`.`Id` = @entity_equality_get_Item_Id)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -408,7 +408,7 @@ LEFT JOIN ( SELECT 1 FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Id` > @get_Item_Id AND `a`.`Id` = @entity_equality_get_Item_Id)) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs index 75e142c4..ba4288ee 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs @@ -37,7 +37,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -61,7 +61,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id1` +ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0` """); } @@ -80,7 +80,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -99,7 +99,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l2` LEFT JOIN `LevelOne` AS `l3` ON `l2`.`OneToOne_Optional_Self1Id` = `l3`.`Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Self_Inverse1Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -113,7 +113,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -127,7 +127,7 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -144,7 +144,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -157,7 +157,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY IIF(`l`.`Name` LIKE '%03', 1, 2), `l`.`Id`, `l0`.`Id` +ORDER BY IIF(`l`.`Name` LIKE '%03', 1, 2), `l`.`Id` """); } @@ -176,7 +176,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -195,7 +195,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Required_Inverse3Id` WHERE `l0`.`Name` <> 'L2 09' OR `l0`.`Name` IS NULL -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -218,7 +218,7 @@ ORDER BY `l4`.`Name` DESC LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id`) LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Required_Inverse3Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l2`.`Id`, `l3`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id`, `l2`.`Id` """); } @@ -242,7 +242,7 @@ ORDER BY `l5`.`Name` DESC LEFT JOIN `LevelTwo` AS `l2` ON `l1`.`Id` = `l2`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id`) LEFT JOIN `LevelThree` AS `l4` ON `l2`.`Id` = `l4`.`OneToMany_Required_Inverse3Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id`, `l4`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id` """); } @@ -265,7 +265,7 @@ ORDER BY `l4`.`Name` DESC LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`Level2_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id` """); } @@ -284,7 +284,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b LEFT JOIN `LevelThree` AS `l4` ON `l3`.`Id` = `l4`.`Level2_Optional_Id`) LEFT JOIN `LevelThree` AS `l5` ON `l0`.`Id` = `l5`.`OneToMany_Optional_Inverse3Id` WHERE `l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL -ORDER BY `l`.`Id`, `l5`.`Id` +ORDER BY `l`.`Id` """); } @@ -298,7 +298,7 @@ public override async Task SelectMany_with_Include1(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -312,7 +312,7 @@ public override async Task Orderby_SelectMany_with_Include1(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -340,7 +340,7 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -357,7 +357,7 @@ public override async Task Multiple_SelectMany_with_Include(bool async) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l1`.`Id` = `l3`.`OneToMany_Optional_Inverse4Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`OneToMany_Optional_Inverse3Id` IS NOT NULL -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -404,7 +404,7 @@ LEFT JOIN ( FROM `LevelThree` AS `l1` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -418,7 +418,7 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id` """); } @@ -432,7 +432,7 @@ public override async Task Optional_navigation_with_Include_and_order(bool async FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id` """); } @@ -446,7 +446,7 @@ public override async Task SelectMany_with_order_by_and_Include(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -460,7 +460,7 @@ public override async Task SelectMany_with_Include_and_order_by(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -477,7 +477,7 @@ INNER JOIN ( FROM `LevelTwo` AS `l0` ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -494,7 +494,7 @@ INNER JOIN ( FROM `LevelTwo` AS `l0` ) AS `l1` ON `l`.`Id` = `l1`.`FK`) LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -549,7 +549,7 @@ public override async Task Project_collection_navigation(bool async) SELECT `l`.`Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -563,7 +563,7 @@ public override async Task Project_collection_navigation_nested(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -577,7 +577,7 @@ public override async Task Project_collection_navigation_using_ef_property(bool FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -591,7 +591,7 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -609,7 +609,7 @@ LEFT JOIN ( WHERE `l0`.`Name` <> 'Foo' OR `l0`.`Name` IS NULL ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` WHERE `l`.`Id` < 3 -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -622,7 +622,7 @@ public override async Task Project_collection_and_root_entity(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -636,7 +636,7 @@ public override async Task Project_collection_and_include(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -650,7 +650,7 @@ public override async Task Project_navigation_and_collection(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -682,7 +682,7 @@ public override async Task Include_collection_with_multiple_orderbys_member(bool SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Level1_Required_Id`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Name`, `l`.`Level1_Required_Id`, `l`.`Id` """); } @@ -695,7 +695,7 @@ public override async Task Include_collection_with_multiple_orderbys_property(bo SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -708,7 +708,7 @@ public override async Task Include_collection_with_multiple_orderbys_methodcall( SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY ABS(`l`.`Level1_Required_Id`), `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY ABS(`l`.`Level1_Required_Id`), `l`.`Name`, `l`.`Id` """); } @@ -721,7 +721,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex(boo SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY ABS(`l`.`Level1_Required_Id`) + 7, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY ABS(`l`.`Level1_Required_Id`) + 7, `l`.`Name`, `l`.`Id` """); } @@ -734,7 +734,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex_rep SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -826,7 +826,7 @@ public override async Task Include_reference_collection_order_by_reference_navig FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Id`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Id`, `l`.`Id` """); } @@ -840,7 +840,7 @@ public override async Task Include_after_SelectMany(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Required_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -857,7 +857,7 @@ public override async Task Include_after_multiple_SelectMany_and_reference_navig LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Required_Self_Inverse4Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`OneToMany_Optional_Inverse3Id` IS NOT NULL -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -873,7 +873,7 @@ public override async Task Include_after_SelectMany_and_multiple_reference_navig LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Self_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -890,7 +890,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -907,7 +907,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -921,7 +921,7 @@ public override async Task SelectMany_navigation_property_followed_by_select_col FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -937,7 +937,7 @@ public override async Task Multiple_SelectMany_navigation_property_followed_by_s LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`OneToMany_Optional_Inverse3Id` IS NOT NULL -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -952,7 +952,7 @@ public override async Task SelectMany_navigation_property_with_include_and_follo INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Required_Inverse3Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -965,7 +965,7 @@ public override async Task Include_collection(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -982,7 +982,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -996,7 +996,7 @@ public override async Task Include_reference_followed_by_include_collection(bool FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1009,7 +1009,7 @@ public override async Task Include_collection_followed_by_projecting_the_include SELECT `l`.`Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -1026,7 +1026,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1044,7 +1044,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1062,7 +1062,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1082,7 +1082,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`Level2_Optional_Id`) LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id3` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1102,7 +1102,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`Level2_Optional_Id`) LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id3` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1120,7 +1120,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id1` +ORDER BY `l`.`Id` """); } @@ -1142,7 +1142,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s0`.`Id` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1165,7 +1165,7 @@ SELECT COUNT(*) FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` WHERE `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` AND (`l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL)) > 0 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1206,7 +1206,7 @@ public override async Task Including_reference_navigation_and_projecting_collect LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id`) LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -1224,7 +1224,7 @@ SELECT IIF(`l0`.`Id` IS NULL, 0, `l0`.`Id`), `l`.`Id`, `l1`.`Id`, `l1`.`Level2_O LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Required_Inverse3Id` WHERE `l`.`Name` IN (@validIds1, @validIds2) -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1287,7 +1287,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` WHERE `l0`.`Id` > 5 ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1300,7 +1300,7 @@ public override async Task Filtered_include_OrderBy(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Name`, `l0`.`Id` +ORDER BY `l`.`Id`, `l0`.`Name` """); } @@ -1317,7 +1317,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Name0`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Name0` """); } @@ -1334,7 +1334,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`Name0` DESC, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`Name0` DESC """); } @@ -1975,7 +1975,7 @@ SELECT TOP 1 `l`.`Id` WHERE `l`.`Id` = 1 ) AS `l1` LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l1`.`Id`, `l0`.`Id` +ORDER BY `l1`.`Id` """); } @@ -2345,7 +2345,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l0` WHERE `l0`.`Name` IN (@validIds1, @validIds2) ) AS `l2` ON `l1`.`Date` = `l2`.`Date` -ORDER BY `l1`.`Date`, `l2`.`Id` +ORDER BY `l1`.`Date` """); } @@ -2365,7 +2365,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`Level3_Optional_Id` ) AS `s` ON `l1`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` WHERE `l0`.`Id` < 3 OR `l1`.`Id` > 8 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -2607,7 +2607,7 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool SELECT `l`.`Id`, `l0`.`Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -2643,7 +2643,7 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2681,7 +2681,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex_rep SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -2696,7 +2696,7 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2753,7 +2753,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2772,7 +2772,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l2` LEFT JOIN `LevelOne` AS `l3` ON `l2`.`OneToOne_Optional_Self1Id` = `l3`.`Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Self_Inverse1Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2795,7 +2795,7 @@ SELECT COUNT(*) FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` WHERE `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` AND (`l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL)) > 0 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -2812,7 +2812,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` WHERE `l0`.`Id` > 5 ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -2825,7 +2825,7 @@ public override async Task Filtered_include_OrderBy_EF_Property(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Name`, `l0`.`Id` +ORDER BY `l`.`Id`, `l0`.`Name` """); } @@ -2880,7 +2880,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2897,7 +2897,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id` """); } @@ -2914,7 +2914,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2928,7 +2928,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_mult FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -2942,7 +2942,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2955,7 +2955,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -2969,7 +2969,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference_multi FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Required_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs index e5425cb1..49904ec9 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs @@ -4404,7 +4404,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -4418,7 +4418,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference_multi FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Required_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs index fdb6a0d4..a31effdd 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs @@ -258,7 +258,7 @@ LEFT JOIN ( FROM `Globalizations` AS `g0` LEFT JOIN `Languages` AS `l0` ON `g0`.`LanguageName` = `l0`.`Name` ) AS `s0` ON `m0`.`DefaultText` = `s0`.`ComplexNavigationStringDefaultText` -ORDER BY `f`.`Name`, `s`.`Text`, `s0`.`Text` +ORDER BY `f`.`Name`, `s`.`Text` """); } @@ -1370,7 +1370,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l1` LEFT JOIN `LevelThree` AS `l2` ON `l1`.`Id` = `l2`.`Level2_Optional_Id` ) AS `s` ON `m`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `m`.`Id`, `l0`.`Id`, `s`.`Id` +ORDER BY `m`.`Id`, `l0`.`Id` """); } @@ -1513,11 +1513,11 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim AssertSql( """ - SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` - FROM `LevelThree` AS `l` - INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` - ORDER BY `l0`.`Id`, `l`.`Id` - """); +SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` +FROM `LevelThree` AS `l` +INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` +ORDER BY `l0`.`Id` +"""); } public override async Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access2(bool isAsync) @@ -1526,11 +1526,11 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim AssertSql( """ - SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` - FROM `LevelThree` AS `l` - INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` - ORDER BY `l0`.`Id`, `l`.`Id` - """); +SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` +FROM `LevelThree` AS `l` +INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` +ORDER BY `l0`.`Id` +"""); } public override async Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access3(bool isAsync) @@ -1542,7 +1542,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1551,13 +1551,13 @@ public override async Task Order_by_key_of_navigation_similar_to_projected_gets_ await base.Order_by_key_of_navigation_similar_to_projected_gets_optimized_into_FK_access(isAsync); AssertSql( - """ + """ SELECT `l1`.`Id`, `l1`.`Date`, `l1`.`Name`, `l1`.`OneToMany_Optional_Self_Inverse1Id`, `l1`.`OneToMany_Required_Self_Inverse1Id`, `l1`.`OneToOne_Optional_Self1Id` FROM (`LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelOne` AS `l1` ON `l0`.`Level1_Required_Id` = `l1`.`Id` WHERE `l0`.`Level1_Required_Id` IS NOT NULL AND `l1`.`Id` IS NOT NULL -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1585,11 +1585,11 @@ public override async Task Order_by_key_of_anonymous_type_projected_navigation_d await base.Order_by_key_of_anonymous_type_projected_navigation_doesnt_get_optimized_into_FK_access_subquery(isAsync); AssertSql( - """ + """ SELECT TOP @p `l0`.`Name` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1636,7 +1636,7 @@ SELECT TOP @p `l`.`Name` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`Level2_Required_Id` IS NOT NULL -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1646,13 +1646,13 @@ public override async Task Projection_select_correct_table_in_subquery_when_mate await base.Projection_select_correct_table_in_subquery_when_materialization_is_not_required_in_multiple_joins(isAsync); AssertSql( - """ + """ SELECT TOP @p `l0`.`Name` FROM (`LevelTwo` AS `l` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`Level2_Required_Id` IS NOT NULL -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -3016,7 +3016,7 @@ await base LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`DifferentTypeReference_InheritanceDerived1Id`) LEFT JOIN `InheritanceLeafTwo` AS `i1` ON `i`.`Id` = `i1`.`DifferentTypeReference_InheritanceDerived2Id`) LEFT JOIN `InheritanceTwo` AS `i2` ON `i1`.`Id` = `i2`.`InheritanceLeaf2Id` -ORDER BY `i`.`Id`, `i2`.`Id` +ORDER BY `i`.`Id` """); } @@ -3030,7 +3030,7 @@ public override async Task String_include_multiple_derived_collection_navigation FROM (`InheritanceOne` AS `i` LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`InheritanceDerived1Id1`) LEFT JOIN `InheritanceLeafOne` AS `i1` ON `i`.`Id` = `i1`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `i1`.`Id` +ORDER BY `i`.`Id`, `i0`.`Id` """); } @@ -3044,7 +3044,7 @@ public override async Task String_include_multiple_derived_collection_navigation FROM (`InheritanceOne` AS `i` LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`InheritanceDerived1Id`) LEFT JOIN `InheritanceLeafTwo` AS `i1` ON `i`.`Id` = `i1`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `i1`.`Id` +ORDER BY `i`.`Id`, `i0`.`Id` """); } @@ -3066,7 +3066,7 @@ LEFT JOIN ( FROM `InheritanceLeafTwo` AS `i1` LEFT JOIN `InheritanceTwo` AS `i2` ON `i1`.`Id` = `i2`.`InheritanceLeaf2Id` ) AS `s` ON `i`.`Id` = `s`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `i`.`Id`, `i0`.`Id`, `s`.`Id` """); } @@ -3087,7 +3087,7 @@ LEFT JOIN ( LEFT JOIN `InheritanceLeafOne` AS `i4` ON `i3`.`Id` = `i4`.`SameTypeReference_InheritanceDerived1Id`) LEFT JOIN `InheritanceLeafOne` AS `i5` ON `i3`.`Id` = `i5`.`SameTypeReference_InheritanceDerived2Id` ) AS `s` ON `i`.`Id` = `s`.`InheritanceBase2Id1` -ORDER BY `i`.`Id`, `i1`.`Id`, `i2`.`Id`, `s`.`Id` +ORDER BY `i`.`Id`, `i1`.`Id`, `i2`.`Id` """); } @@ -3527,7 +3527,7 @@ public override async Task Join_with_navigations_in_the_result_selector2(bool is INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -4306,7 +4306,7 @@ public override async Task Include_multiple_collections_on_same_level(bool async FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -4709,7 +4709,7 @@ public override async Task Null_check_removal_applied_recursively_complex(bool a LEFT JOIN `LevelOne` AS `l1` ON `l0`.`OneToMany_Required_Inverse2Id` = `l1`.`Id`) LEFT JOIN `LevelFour` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` WHERE (`l1`.`Name` = 'L1 01') AND (`l0`.`OneToMany_Required_Inverse2Id` IS NOT NULL AND `l1`.`Id` IS NOT NULL) -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -4767,7 +4767,7 @@ SELECT MAX(`l3`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` ) AS `s` ON `l4`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l4`.`Id`, `s`.`Id` +ORDER BY `l4`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs index 1bbb8a23..d88dcc84 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; @@ -1046,7 +1047,7 @@ public override async Task Union_of_same_nested_complex_type_projected_twice_wit FROM `Customer` AS `c1`, `Customer` AS `c2` ) AS `u` -ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_FullName0` +ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0` """); } @@ -1073,7 +1074,7 @@ public override async Task Union_of_same_nested_complex_type_projected_twice_wit ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0` ) AS `u0` ) AS `u1` -ORDER BY `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_FullName0` +ORDER BY `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_ZipCode0` """); } @@ -1225,6 +1226,359 @@ ORDER BY `c1`.`Id` DESC """); } + #region Non-shared test resources + + public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() + { + await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); + + AssertSql( + """ +@entity_equality_container_Id='1' (Nullable = true) +@entity_equality_container_Containee1_Id='2' (Nullable = true) +@entity_equality_container_Containee2_Id='3' (Nullable = true) + +SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` +FROM `EntityType` AS `e` +WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id +"""); + } + + public override async Task Projecting_complex_property_does_not_auto_include_owned_types() + { + await base.Projecting_complex_property_does_not_auto_include_owned_types(); + + AssertSql( + """ +SELECT `e`.`Complex_Name`, `e`.`Complex_Number` +FROM `EntityType` AS `e` +"""); + } + + #region 36837 + + #region 35025 + + public override async Task Select_TPC_base_with_ComplexType() + { + await base.Select_TPC_base_with_ComplexType(); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`ChildProperty`, NULL AS `ChildProperty1`, `t`.`PropertyInsideComplexThing`, `t`.`ChildComplexProperty_PropertyInsideComplexThing`, NULL AS `ChildComplexProperty_PropertyInsideComplexThing1`, 'TpcChild1' AS `Discriminator` +FROM `TpcChild1` AS `t` +UNION ALL +SELECT `t0`.`Id`, CVar(NULL) AS `ChildProperty`, `t0`.`ChildProperty` AS `ChildProperty1`, `t0`.`PropertyInsideComplexThing`, CVar(NULL) AS `ChildComplexProperty_PropertyInsideComplexThing`, `t0`.`ChildComplexProperty_PropertyInsideComplexThing` AS `ChildComplexProperty_PropertyInsideComplexThing1`, 'TpcChild2' AS `Discriminator` +FROM `TpcChild2` AS `t0` +"""); + } + + #endregion 35025 + + #region 34706 + + public override async Task Complex_type_on_an_entity_mapped_to_view_and_table() + { + await base.Complex_type_on_an_entity_mapped_to_view_and_table(); + + AssertSql( + """ +SELECT TOP 2 `b`.`Id`, `b`.`ComplexThing_Prop1`, `b`.`ComplexThing_Prop2` +FROM `BlogsView` AS `b` +"""); + } + + #endregion 34706 + + #region 38077 + + public override async Task Complex_property_on_split_entity() + { + await base.Complex_property_on_split_entity(); + + AssertSql( + """ +SELECT `h`.`Id`, `h`.`CreatedOn`, `h0`.`IsTestHook`, `h0`.`Weight`, `h`.`Number_Parsed`, `h`.`Number_Raw` +FROM `Hook` AS `h` +INNER JOIN `HookMetadata` AS `h0` ON `h`.`Id` = `h0`.`HookId` +"""); + } + + #endregion 38077 + + [Fact] + public virtual async Task Complex_type_equality_with_non_default_type_mapping() + { + var contextFactory = await InitializeNonSharedTest( + seed: context => + { + context.AddRange( + new Context36837.EntityType { ComplexThing = new Context36837.ComplexThing { DateTime = new DateTime(2020, 1, 1) } }); + return context.SaveChangesAsync(); + }); + + await using var context = contextFactory.CreateDbContext(); + + var count = await context.Set() + .CountAsync(b => b.ComplexThing == new Context36837.ComplexThing { DateTime = new DateTime(2020, 1, 1, 1, 1, 1, 999, 999) }); + Assert.Equal(0, count); + + AssertSql( + """ +SELECT COUNT(*) +FROM `EntityType` AS `e` +WHERE `e`.`ComplexThing_DateTime` = #2020-01-01 01:01:01# +"""); + } + + private class Context36837(DbContextOptions options) : DbContext(options) + { + protected override void OnModelCreating(ModelBuilder modelBuilder) + => modelBuilder.Entity().ComplexProperty(b => b.ComplexThing); + + public class EntityType + { + public int Id { get; set; } + public ComplexThing ComplexThing { get; set; } = null!; + } + + public class ComplexThing + { + [Column(TypeName = "datetime")] // Non-default type mapping + public DateTime DateTime { get; set; } + } + } + + #endregion 36837 + + + public override async Task Optional_complex_type_with_discriminator() + { + await base.Optional_complex_type_with_discriminator(); + + AssertSql( + """ +SELECT TOP 2 `e`.`Id`, `e`.`AllOptionalsComplexType_Discriminator`, `e`.`AllOptionalsComplexType_OptionalProperty` +FROM `EntityType` AS `e` +WHERE `e`.`AllOptionalsComplexType_Discriminator` IS NULL +""", + // + """ +@p0='AllOptionalsComplexType' (Size = 255) +@p1='New thing' (Size = 255) +@p2='3' + +UPDATE `EntityType` SET `AllOptionalsComplexType_Discriminator` = @p0, `AllOptionalsComplexType_OptionalProperty` = @p1 +WHERE `Id` = @p2; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT `e`.`Id`, `e`.`AllOptionalsComplexType_Discriminator`, `e`.`AllOptionalsComplexType_OptionalProperty` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Non_optional_complex_type_with_all_nullable_properties() + { + await base.Non_optional_complex_type_with_all_nullable_properties(); + + AssertSql( + """ +SELECT TOP 2 `e`.`Id`, `e`.`NonOptionalComplexType_NullableDateTime`, `e`.`NonOptionalComplexType_NullableString` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Non_optional_complex_type_with_all_nullable_properties_via_left_join() + { + await base.Non_optional_complex_type_with_all_nullable_properties_via_left_join(); + + AssertSql( + """ +SELECT `p0`.`Id`, `c`.`Id`, `c`.`ParentId`, `c`.`ComplexType_NullableDateTime`, `c`.`ComplexType_NullableString` +FROM ( + SELECT TOP 2 `p`.`Id` + FROM `Parent` AS `p` +) AS `p0` +LEFT JOIN `Child` AS `c` ON `p0`.`Id` = `c`.`ParentId` +ORDER BY `p0`.`Id` +"""); + } + + public override async Task Nullable_complex_type_with_discriminator_and_shadow_property() + { + await base.Nullable_complex_type_with_discriminator_and_shadow_property(); + + AssertSql( + """ +SELECT `e`.`Id`, `e`.`CreatedBy`, `e`.`Prop_Discriminator`, `e`.`Prop_OptionalValue` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_set_to_different_value() + { + await base.Nullable_complex_type_with_discriminator_set_to_different_value(); + } + + public override async Task Nullable_complex_type_with_discriminator_set_to_null() + { + await base.Nullable_complex_type_with_discriminator_set_to_null(); + } + + public override async Task Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip() + { + await base.Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip(); + } + + public override async Task Update_entity_with_nullable_complex_type_and_discriminator_does_not_throw() + { + await base.Update_entity_with_nullable_complex_type_and_discriminator_does_not_throw(); + } + + public override async Task Can_query_by_complex_type_property_with_index() + { + await base.Can_query_by_complex_type_property_with_index(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +WHERE `p`.`Address_City` = 'Seattle' +"""); + } + + public override async Task Can_update_entity_with_index_on_complex_type_property() + { + await base.Can_update_entity_with_index_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +""", + // + """ +@p0='98102' (Nullable = false) (Size = 255) +@p1='1' + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +"""); + } + + public override async Task Can_delete_entity_with_index_on_complex_type_property() + { + await base.Can_delete_entity_with_index_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +""", + // + """ +@p0='1' + +DELETE FROM `Person` +WHERE `Id_Id` = @p0; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT COUNT(*) +FROM `Person` AS `p` +"""); + } + + public override async Task Can_query_by_alternate_key_on_complex_type_property() + { + await base.Can_query_by_alternate_key_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +WHERE `p`.`Address_City` = 'Redmond' +"""); + } + + public override async Task Can_save_batch_swapping_alternate_key_values_on_complex_type_property() + { + await base.Can_save_batch_swapping_alternate_key_values_on_complex_type_property(); + + AssertSql( + """ +SELECT `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +ORDER BY `p`.`Id_Id` +""", + // + """ +@p0='98103' (Nullable = false) (Size = 255) +@p1='1' + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +@p0='98054' (Nullable = false) (Size = 255) +@p1='2' + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +ORDER BY `p`.`Id_Id` +"""); + } + + public override async Task Complex_json_collection_inside_left_join_subquery() + { + await base.Complex_json_collection_inside_left_join_subquery(); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`ChildId`, `c0`.`Id`, `c0`.`IsPublic`, `c0`.`c` +FROM `Parent` AS `p` +LEFT JOIN ( + SELECT `c`.`Id`, `c`.`IsPublic`, `c`.`CareNeeds` AS `c` + FROM `Child` AS `c` + WHERE `c`.`IsPublic` +) AS `c0` ON `p`.`ChildId` = `c0`.`Id` +"""); + } + + #endregion Non-shared test resources + [Fact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.Jet.FunctionalTests/Query/CompositeKeysQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/CompositeKeysQueryJetTest.cs index 3a6687f1..675f2c22 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/CompositeKeysQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/CompositeKeysQueryJetTest.cs @@ -28,7 +28,7 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1` """); } @@ -42,7 +42,7 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1` DESC, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1` DESC, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1` """); } @@ -56,7 +56,7 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id1`, `c`.`Id2`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id1`, `c`.`Id2`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1` """); } @@ -70,7 +70,7 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1` """); } @@ -131,7 +131,7 @@ LEFT JOIN ( LEFT JOIN `CompositeFours` AS `c13` ON `c11`.`Id1` = `c13`.`OneToMany_Required_Inverse4Id1` AND `c11`.`Id2` = `c13`.`OneToMany_Required_Inverse4Id2` ) AS `s3` ON `c7`.`Id1` = `s3`.`OneToMany_Optional_Inverse3Id1` AND `c7`.`Id2` = `s3`.`OneToMany_Optional_Inverse3Id2` ) AS `s4` ON `c`.`Id1` = `s4`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `s4`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id10`, `s1`.`Id20`, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`Id110`, `s4`.`Id210` +ORDER BY `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id10`, `s1`.`Id20`, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`Id110` """); } @@ -175,7 +175,7 @@ LEFT JOIN ( LEFT JOIN `CompositeFours` AS `c13` ON `c11`.`Id1` = `c13`.`OneToMany_Required_Inverse4Id1` AND `c11`.`Id2` = `c13`.`OneToMany_Required_Inverse4Id2` ) AS `s3` ON `c7`.`Id1` = `s3`.`OneToMany_Optional_Inverse3Id1` AND `c7`.`Id2` = `s3`.`OneToMany_Optional_Inverse3Id2` ) AS `s4` ON `c`.`Id1` = `s4`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `s4`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Name`, `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id20` DESC, `s1`.`Id10` DESC, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`c`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`c0` DESC, `s4`.`Id110`, `s4`.`Id210` +ORDER BY `c`.`Name`, `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id20` DESC, `s1`.`Id10` DESC, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`c`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`c0` DESC, `s4`.`Id110` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs index a6d171f3..f9d4d821 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs @@ -490,7 +490,7 @@ LEFT JOIN ( FROM `OrderForLinq` AS `o` LEFT JOIN `CustomerForLinq` AS `c0` ON `o`.`CustomerId` = `c0`.`Id` ) AS `s` ON `c`.`Id` = `s`.`Id0` -ORDER BY `c`.`Id`, `s`.`Id` +ORDER BY `c`.`Id` """); } @@ -523,7 +523,7 @@ public override async Task Whats_new_2021_sample_5(bool async) AssertSql( """ -SELECT `p2`.`c`, `p2`.`FirstName` +SELECT `p2`.`c` FROM ( SELECT ( SELECT TOP 1 `p0`.`LastName` @@ -532,7 +532,7 @@ SELECT TOP 1 `p0`.`LastName` FROM `Person` AS `p` GROUP BY `p`.`FirstName` ) AS `p2` -ORDER BY `p2`.`c`, `p2`.`FirstName` +ORDER BY `p2`.`c` """); } @@ -542,7 +542,7 @@ public override async Task Whats_new_2021_sample_6(bool async) AssertSql( """ -SELECT `p2`.`c`, `p2`.`Id` +SELECT `p2`.`c` FROM ( SELECT ( SELECT TOP 1 `p0`.`MiddleInitial` @@ -552,7 +552,7 @@ SELECT TOP 1 `p0`.`MiddleInitial` WHERE `p`.`Age` = 20 GROUP BY `p`.`Id` ) AS `p2` -ORDER BY `p2`.`c`, `p2`.`Id` +ORDER BY `p2`.`c` """); } @@ -652,7 +652,7 @@ LEFT JOIN ( FROM `Person` AS `p0` LEFT JOIN `Shoes` AS `s` ON `p0`.`Id` = `s`.`PersonId` ) AS `s0` ON `p1`.`FirstName` = `s0`.`FirstName` -ORDER BY `p1`.`FirstName`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `p1`.`FirstName`, `s0`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs index 7e80a010..fe27c365 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs @@ -125,7 +125,7 @@ LEFT JOIN ( INNER JOIN `SplitEntityOnePart3` AS `s` ON `e0`.`Id` = `s`.`Id`) INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e0`.`Id` = `s0`.`Id` ) AS `s1` ON `e`.`Id` = `s1`.`EntityThreeId` -ORDER BY `e`.`Id`, `s1`.`Id` +ORDER BY `e`.`Id` """); } @@ -162,7 +162,7 @@ LEFT JOIN ( INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e0`.`Id` = `s0`.`Id`) LEFT JOIN `EntityTwo` AS `e1` ON `e0`.`Id` = `e1`.`EntityOneId` ) AS `s1` ON `e`.`Id` = `s1`.`EntityThreeId` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`Id` """); } @@ -191,7 +191,7 @@ public override async Task Include_collection_on_split_entity(bool async) INNER JOIN `SplitEntityOnePart3` AS `s` ON `e`.`Id` = `s`.`Id`) INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e`.`Id` = `s0`.`Id`) LEFT JOIN `EntityTwo` AS `e0` ON `e`.`Id` = `e0`.`EntityOneId` -ORDER BY `e`.`Id`, `e0`.`Id` +ORDER BY `e`.`Id` """); } @@ -709,7 +709,7 @@ LEFT JOIN ( INNER JOIN `OwnedReferencePart4` AS `o0` ON `o`.`BaseEntityId` = `o0`.`BaseEntityId` AND `o`.`Id` = `o0`.`Id`) INNER JOIN `OwnedReferencePart3` AS `o1` ON `o`.`BaseEntityId` = `o1`.`BaseEntityId` AND `o`.`Id` = `o1`.`Id` ) AS `s0` ON `u`.`Id` = `s0`.`BaseEntityId` -ORDER BY `u`.`Id`, `s0`.`BaseEntityId` +ORDER BY `u`.`Id`, `s0`.`BaseEntityId`, `s0`.`Id` """); } @@ -755,7 +755,7 @@ LEFT JOIN ( INNER JOIN `OwnedReferencePart4` AS `o0` ON `o`.`MiddleEntityId` = `o0`.`MiddleEntityId` AND `o`.`Id` = `o0`.`Id`) INNER JOIN `OwnedReferencePart3` AS `o1` ON `o`.`MiddleEntityId` = `o1`.`MiddleEntityId` AND `o`.`Id` = `o1`.`Id` ) AS `s0` ON `u`.`Id` = `s0`.`MiddleEntityId` -ORDER BY `u`.`Id`, `s0`.`MiddleEntityId` +ORDER BY `u`.`Id`, `s0`.`MiddleEntityId`, `s0`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs index e5ae19c6..b19eccd2 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs @@ -540,7 +540,7 @@ public override async Task FromSqlRaw_queryable_simple_include(bool async) SELECT * FROM `Customers` ) AS `m` LEFT JOIN `Orders` AS `o` ON `m`.`CustomerID` = `o`.`CustomerID` -ORDER BY `m`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID` """); } @@ -556,7 +556,7 @@ public override async Task FromSqlRaw_queryable_simple_composed_include(bool asy ) AS `m` LEFT JOIN `Orders` AS `o` ON `m`.`CustomerID` = `o`.`CustomerID` WHERE `m`.`City` = 'London' -ORDER BY `m`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index 11056274..4e2e95c7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -51,7 +51,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool isAs FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -78,7 +78,7 @@ public override async Task Include_multiple_circular(bool isAsync) FROM (`Gears` AS `g` INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -93,7 +93,7 @@ public override async Task Include_multiple_circular_with_filter(bool isAsync) INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -107,7 +107,7 @@ public override async Task Include_using_alternate_key(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -121,7 +121,7 @@ public override async Task Include_navigation_on_derived_type(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -135,7 +135,7 @@ public override async Task String_based_Include_navigation_on_derived_type(bool FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -189,7 +189,7 @@ public override async Task Include_with_join_collection1(bool isAsync) FROM (`Gears` AS `g` INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -203,7 +203,7 @@ public override async Task Include_with_join_collection2(bool isAsync) FROM (`Tags` AS `t` INNER JOIN `Gears` AS `g` ON `t`.`GearSquadId` = `g`.`SquadId` AND `t`.`GearNickName` = `g`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -306,7 +306,7 @@ public override async Task Include_with_join_multi_level(bool isAsync) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `g0`.`Nickname` """); } @@ -342,7 +342,7 @@ INNER JOIN ( WHERE `g`.`Discriminator` = 'Officer' ) AS `g0` ON `t`.`GearSquadId` = `g0`.`SquadId` AND `t`.`GearNickName` = `g0`.`Nickname`) LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` -ORDER BY NOT (`g0`.`HasSoulPatch`), `g0`.`Nickname` DESC, `t`.`Id`, `g0`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY NOT (`g0`.`HasSoulPatch`), `g0`.`Nickname` DESC, `t`.`Id`, `g0`.`SquadId`, `g1`.`Nickname` """); } @@ -357,7 +357,7 @@ public override async Task Include_with_join_and_inheritance2(bool isAsync) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -375,7 +375,7 @@ INNER JOIN ( WHERE `g`.`Discriminator` = 'Officer' ) AS `g0` ON `t`.`GearSquadId` = `g0`.`SquadId` AND `t`.`GearNickName` = `g0`.`Nickname`) LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` -ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g1`.`Nickname` """); } @@ -833,7 +833,7 @@ public override async Task Select_conditional_with_anonymous_type_and_null_const """ SELECT `g`.`LeaderNickname` IS NOT NULL, `g`.`HasSoulPatch` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -845,7 +845,7 @@ public override async Task Select_conditional_with_anonymous_types(bool isAsync) """ SELECT `g`.`LeaderNickname` IS NOT NULL, `g`.`Nickname`, `g`.`FullName` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -858,7 +858,7 @@ public override async Task Where_conditional_equality_1(bool async) SELECT `g`.`Nickname` FROM `Gears` AS `g` WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -871,7 +871,7 @@ public override async Task Where_conditional_equality_2(bool async) SELECT `g`.`Nickname` FROM `Gears` AS `g` WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -883,7 +883,7 @@ public override async Task Where_conditional_equality_3(bool async) """ SELECT `g`.`Nickname` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -895,7 +895,7 @@ public override async Task Select_coalesce_with_anonymous_types(bool isAsync) """ SELECT `g`.`LeaderNickname`, `g`.`FullName` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1213,7 +1213,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool await base.Where_subquery_distinct_singleordefault_boolean2(isAsync); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` AND IIF(( @@ -1223,7 +1223,7 @@ SELECT TOP 1 `w`.`IsAutomatic` SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1808,7 +1808,7 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -1822,7 +1822,7 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -1831,13 +1831,13 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result3(isAsync); AssertSql( - """ + """ SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM ((`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -1854,7 +1854,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Weapons` AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `g0`.`FullName` = `w1`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } @@ -1873,7 +1873,7 @@ LEFT JOIN ( ) AS `g1` ON `g`.`LeaderNickname` = `g1`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g1`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId`, `w`.`Id` """); } @@ -1882,13 +1882,13 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(isAsync); AssertSql( - """ + """ SELECT `g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM ((`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -1897,7 +1897,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(isAsync); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId`, `g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `w3`.`Id`, `w3`.`AmmunitionType`, `w3`.`IsAutomatic`, `w3`.`Name`, `w3`.`OwnerFullName`, `w3`.`SynergyWithId`, `w4`.`Id`, `w4`.`AmmunitionType`, `w4`.`IsAutomatic`, `w4`.`Name`, `w4`.`OwnerFullName`, `w4`.`SynergyWithId` FROM ((((((`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) @@ -1907,7 +1907,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w3` ON `g0`.`FullName` = `w3`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w4` ON `g`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id`, `w4`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } @@ -2101,7 +2101,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -2128,7 +2128,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `g`.`SquadId`, `t`.`Id` +ORDER BY `g`.`SquadId` """); } @@ -2205,7 +2205,7 @@ LEFT JOIN ( WHERE `w`.`Name` <> 'Lancer' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `c`.`Name` IN ('Ephyra', 'Hanover') -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -2223,7 +2223,7 @@ LEFT JOIN ( WHERE `g0`.`Nickname` <> 'Dom' ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -2447,7 +2447,7 @@ public override async Task Unnecessary_include_doesnt_get_added_complex_when_pro SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`Rank`, `g`.`SquadId` +ORDER BY `g`.`Rank` """); } @@ -2460,7 +2460,7 @@ public override async Task Multiple_order_bys_are_properly_lifted_from_subquery_ SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2473,7 +2473,7 @@ public override async Task Order_by_is_properly_lifted_from_subquery_with_same_o SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2487,7 +2487,7 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE `g`.`FullName` <> 'Augustus Cole' AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2501,7 +2501,7 @@ public override async Task Subquery_is_lifted_from_main_from_clause_of_SelectMan FROM `Gears` AS `g`, `Gears` AS `g0` WHERE `g`.`HasSoulPatch` AND NOT (`g0`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g0`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2514,7 +2514,7 @@ public override async Task Subquery_containing_SelectMany_projecting_main_from_c FROM `Gears` AS `g`, `Tags` AS `t` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`FullName`, `t`.`Id` +ORDER BY `g`.`FullName` """); } @@ -2526,7 +2526,7 @@ public override async Task Subquery_containing_join_projecting_main_from_clause_ SELECT `g`.`Nickname` FROM `Gears` AS `g` INNER JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` -ORDER BY `g`.`Nickname`, `t`.`Id` +ORDER BY `g`.`Nickname` """); } @@ -2538,7 +2538,7 @@ public override async Task Subquery_containing_left_join_projecting_main_from_cl SELECT `g`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` -ORDER BY `g`.`Nickname`, `t`.`Id` +ORDER BY `g`.`Nickname` """); } @@ -2569,7 +2569,7 @@ WHERE EXISTS ( SELECT 1 FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName`) AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -2583,7 +2583,7 @@ public override async Task Subquery_is_lifted_from_additional_from_clause(bool i FROM `Gears` AS `g`, `Gears` AS `g0` WHERE `g`.`HasSoulPatch` AND NOT (`g0`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g0`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2700,7 +2700,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool isAsy """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2712,7 +2712,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca """ SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2724,7 +2724,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2736,7 +2736,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool isA """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2819,7 +2819,7 @@ SELECT COUNT(*) FROM `LocustLeaders` AS `l` WHERE `f`.`Id` = `l`.`LocustHordeId`) AS `LeadersCount` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2850,7 +2850,7 @@ LEFT JOIN ( WHERE `l`.`Discriminator` = 'LocustCommander' ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name`) LEFT JOIN `LocustLeaders` AS `l1` ON `f`.`Id` = `l1`.`LocustHordeId` -ORDER BY `f`.`Name`, `f`.`Id`, `l1`.`Name` +ORDER BY `f`.`Name`, `f`.`Id` """); } @@ -2986,7 +2986,7 @@ public override async Task Comparing_two_collection_navigations_composite_key(bo FROM `Gears` AS `g`, `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`Nickname` AND `g`.`SquadId` = `g0`.`SquadId` -ORDER BY `g`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3183,7 +3183,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` INNER JOIN `Cities` AS `c` ON `g0`.`CityOfBirthName` = `c`.`Name` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `l`.`Name`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `l`.`Name`, `s`.`Nickname` """); } @@ -3232,7 +3232,7 @@ public override async Task Include_collection_on_derived_type_using_string(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3245,7 +3245,7 @@ public override async Task Include_collection_on_derived_type_using_lambda(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3258,7 +3258,7 @@ public override async Task Include_collection_on_derived_type_using_lambda_with_ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3272,7 +3272,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool isAsyn FROM (`Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3286,7 +3286,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -3305,7 +3305,7 @@ LEFT JOIN ( ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name`) LEFT JOIN `Gears` AS `g` ON `l0`.`DefeatedByNickname` = `g`.`Nickname` AND `l0`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `f`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `f`.`Id`, `g0`.`Nickname` """); } @@ -3322,7 +3322,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -3339,7 +3339,7 @@ LEFT JOIN ( FROM `LocustLeaders` AS `l` LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId` ) AS `s` ON `f`.`Id` = `s`.`LocustHordeId` -ORDER BY `f`.`Id`, `s`.`Name` +ORDER BY `f`.`Id` """); } @@ -3358,7 +3358,7 @@ LEFT JOIN ( ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name`) LEFT JOIN `Gears` AS `g` ON `l0`.`DefeatedByNickname` = `g`.`Nickname` AND `l0`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `f`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `f`.`Id`, `g0`.`Nickname` """); } @@ -3492,7 +3492,7 @@ public override async Task Correlated_collections_naked_navigation_with_ToList(b FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3508,7 +3508,7 @@ SELECT COUNT(*) WHERE `g`.`FullName` = `w`.`OwnerFullName`) FROM `Gears` AS `g` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3522,7 +3522,7 @@ public override async Task Correlated_collections_naked_navigation_with_ToArray( FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3540,7 +3540,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3558,7 +3558,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3576,7 +3576,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3594,7 +3594,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` DESC, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` DESC """); } @@ -3603,7 +3603,7 @@ public override async Task Correlated_collections_basic_projection_composite_key await base.Correlated_collections_basic_projection_composite_key(isAsync); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`FullName`, `g1`.`SquadId` FROM `Gears` AS `g` LEFT JOIN ( @@ -3612,7 +3612,7 @@ LEFT JOIN ( WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' AND `g`.`Nickname` <> 'Foo' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -3630,7 +3630,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3648,7 +3648,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3657,7 +3657,7 @@ public override async Task Correlated_collections_basic_projecting_constant_bool await base.Correlated_collections_basic_projecting_constant_bool(isAsync); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `w0`.`c`, `w0`.`Id` FROM `Gears` AS `g` LEFT JOIN ( @@ -3666,7 +3666,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3699,7 +3699,7 @@ public override async Task Correlated_collections_project_anonymous_collection_r FROM `Squads` AS `s` LEFT JOIN `Gears` AS `g` ON `s`.`Id` = `g`.`SquadId` WHERE `s`.`Id` < 20 -ORDER BY `s`.`Id`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `s`.`Id`, `g`.`Nickname` """); } @@ -3722,7 +3722,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3745,7 +3745,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3768,7 +3768,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3777,7 +3777,7 @@ public override async Task Correlated_collections_nested_with_custom_ordering(bo await base.Correlated_collections_nested_with_custom_ordering(isAsync); AssertSql( - """ + """ SELECT `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s`.`FullName`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id`, `s`.`AmmunitionType`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`OwnerFullName`, `s`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN ( @@ -3791,7 +3791,7 @@ LEFT JOIN ( WHERE `g0`.`FullName` <> 'Foo' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `g`.`Nickname`, `g`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `g`.`Nickname`, `g`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`) """); } @@ -3800,7 +3800,7 @@ public override async Task Correlated_collections_same_collection_projected_mult await base.Correlated_collections_same_collection_projected_multiple_times(isAsync); AssertSql( - """ + """ SELECT `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` FROM (`Gears` AS `g` LEFT JOIN ( @@ -3813,7 +3813,7 @@ LEFT JOIN ( FROM `Weapons` AS `w0` WHERE `w0`.`IsAutomatic` ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id` """); } @@ -3835,7 +3835,7 @@ LEFT JOIN ( FROM `Weapons` AS `w0` WHERE NOT (`w0`.`IsAutomatic`) ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`), `w2`.`Id` +ORDER BY `g`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`) """); } @@ -3854,7 +3854,7 @@ LEFT JOIN ( ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `g0`.`FullName`, `g0`.`Nickname` """); } @@ -3871,7 +3871,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`SquadId` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note` """); } @@ -3894,7 +3894,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC """); } @@ -3918,7 +3918,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC """); } @@ -3982,7 +3982,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Id0`, `s1`.`Nickname0`, `s1`.`SquadId0`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC, `s2`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Id0`, `s1`.`Nickname0`, `s1`.`SquadId0`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC """); } @@ -4183,7 +4183,7 @@ SELECT TOP 1 `g`.`FullName` WHERE `s`.`Id` = `g`.`SquadId` ORDER BY `g`.`Nickname`) FROM `Squads` AS `s` -ORDER BY `s`.`Name`, `s`.`Id` +ORDER BY `s`.`Name` """); } @@ -4198,7 +4198,7 @@ public override async Task Correlated_collections_on_left_join_with_predicate(bo LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -4213,7 +4213,7 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo RIGHT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -4222,12 +4222,12 @@ public override async Task Correlated_collections_on_left_join_with_null_value(b await base.Correlated_collections_on_left_join_with_null_value(isAsync); AssertSql( - """ + """ SELECT `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Note`, `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -4269,7 +4269,7 @@ LEFT JOIN ( ) AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName` WHERE `g0`.`HasSoulPatch` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `t`.`Note`, `g`.`Nickname` DESC, `t`.`Id`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `t`.`Note`, `g`.`Nickname` DESC, `t`.`Id`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -4311,7 +4311,7 @@ LEFT JOIN ( LEFT JOIN `Squads` AS `s` ON `g0`.`SquadId` = `s`.`Id`) LEFT JOIN `Gears` AS `g1` ON `s`.`Id` = `g1`.`SquadId` ) AS `s0` ON `g`.`FullName` = `s0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname` """); } @@ -4335,7 +4335,7 @@ LEFT JOIN ( ) AS `s0` ON `g0`.`FullName` = `s0`.`OwnerFullName` ) AS `s1` ON `g`.`Nickname` = `s1`.`LeaderNickname` AND `g`.`SquadId` = `s1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`Id`, `s1`.`Nickname0` """); } @@ -4344,7 +4344,7 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce await base.Correlated_collections_with_funky_orderby_complex_scenario1(isAsync); AssertSql( - """ + """ SELECT `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`HasSoulPatch`, `s0`.`SquadId` FROM `Gears` AS `g` LEFT JOIN ( @@ -4354,7 +4354,7 @@ LEFT JOIN ( LEFT JOIN `Squads` AS `s` ON `g0`.`SquadId` = `s`.`Id`) LEFT JOIN `Gears` AS `g1` ON `s`.`Id` = `g1`.`SquadId` ) AS `s0` ON `g`.`FullName` = `s0`.`OwnerFullName` -ORDER BY `g`.`FullName`, `g`.`Nickname` DESC, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname` DESC, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname` """); } @@ -4378,7 +4378,7 @@ LEFT JOIN ( ) AS `s0` ON `g0`.`FullName` = `s0`.`OwnerFullName` ) AS `s1` ON `g`.`Nickname` = `s1`.`LeaderNickname` AND `g`.`SquadId` = `s1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY NOT (`g`.`HasSoulPatch`), `g`.`LeaderNickname`, `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0` +ORDER BY NOT (`g`.`HasSoulPatch`), `g`.`LeaderNickname`, `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0` """); } @@ -4395,7 +4395,7 @@ public override async Task Correlated_collection_with_top_level_FirstOrDefault(b ORDER BY `g`.`Nickname` ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -4423,7 +4423,7 @@ public override async Task Correlated_collection_with_top_level_Last_with_orderb ORDER BY `g`.`FullName` ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -4440,7 +4440,7 @@ public override async Task Correlated_collection_with_top_level_Last_with_order_ ORDER BY `g`.`FullName` DESC ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`FullName` DESC, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Name`, `w`.`Id` +ORDER BY `g0`.`FullName` DESC, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Name` """); } @@ -4493,7 +4493,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool ORDER BY `t`.`Note` ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Note`, `s`.`Name`, `w`.`Id` +ORDER BY `s`.`Note`, `s`.`Name` """); } @@ -4620,7 +4620,7 @@ public override async Task Order_by_entity_qsre(bool isAsync) SELECT `g`.`FullName` FROM `Gears` AS `g` LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name` -ORDER BY `c`.`Name`, `g`.`Nickname` DESC, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` DESC """); } @@ -4661,7 +4661,7 @@ public override async Task Order_by_entity_qsre_with_other_orderbys(bool isAsync FROM (`Weapons` AS `w` LEFT JOIN `Gears` AS `g` ON `w`.`OwnerFullName` = `g`.`FullName`) LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w`.`IsAutomatic`), `g`.`Nickname` DESC, `g`.`SquadId` DESC, `w0`.`Id`, `w`.`Name`, `w`.`Id` +ORDER BY NOT (`w`.`IsAutomatic`), `g`.`Nickname` DESC, `g`.`SquadId` DESC, `w0`.`Id`, `w`.`Name` """); } @@ -4972,7 +4972,7 @@ public override async Task Include_with_order_by_constant(bool isAsync) SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Squads` AS `s` LEFT JOIN `Gears` AS `g` ON `s`.`Id` = `g`.`SquadId` -ORDER BY `s`.`Id`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `s`.`Id`, `g`.`Nickname` """); } @@ -4985,7 +4985,7 @@ public override async Task Correlated_collection_order_by_constant(bool isAsync) SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5045,7 +5045,7 @@ SELECT COUNT(*) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5066,7 +5066,7 @@ SELECT TOP 1 `w`.`IsAutomatic` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5091,7 +5091,7 @@ SELECT TOP 1 `w`.`IsAutomatic` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5115,7 +5115,7 @@ WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5145,7 +5145,7 @@ WHERE NOT (`g1`.`HasSoulPatch`) ) AS `g2` ON `g`.`Nickname` = `g2`.`LeaderNickname` AND `g`.`SquadId` = `g2`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5422,7 +5422,7 @@ public override async Task Cast_subquery_to_base_type_using_typed_ToList(bool is FROM `Cities` AS `c` LEFT JOIN `Gears` AS `g` ON `c`.`Name` = `g`.`AssignedCityName` WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` """); } @@ -5436,7 +5436,7 @@ public override async Task Cast_ordered_subquery_to_base_type_using_typed_ToArra FROM `Cities` AS `c` LEFT JOIN `Gears` AS `g` ON `c`.`Name` = `g`.`AssignedCityName` WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `g`.`Nickname` DESC, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` DESC """); } @@ -5449,7 +5449,7 @@ public override async Task Correlated_collection_with_complex_order_by_funcletiz SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5462,7 +5462,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -5475,7 +5475,7 @@ public override async Task Double_order_by_on_Like(bool isAsync) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -5488,7 +5488,7 @@ public override async Task Double_order_by_on_is_null(bool isAsync) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -5510,12 +5510,12 @@ public override async Task Double_order_by_binary_expression(bool isAsync) AssertSql( """ -SELECT `w0`.`Binary`, `w0`.`Id` +SELECT `w0`.`Binary` FROM ( - SELECT `w`.`Id` + 2 AS `Binary`, `w`.`Id` + SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` ) AS `w0` -ORDER BY `w0`.`Binary`, `w0`.`Id` +ORDER BY `w0`.`Binary` """); } @@ -5528,7 +5528,7 @@ public override async Task String_compare_with_null_conditional_argument(bool is SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -5541,7 +5541,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool i SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -5554,7 +5554,7 @@ public override async Task String_concat_with_null_conditional_argument(bool isA SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & ''), `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } @@ -5567,7 +5567,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool is SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer', `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } @@ -5707,7 +5707,7 @@ public override async Task Include_collection_with_Cast_to_base(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5732,7 +5732,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5750,7 +5750,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -5762,7 +5762,7 @@ public override async Task OrderBy_same_expression_containing_IsNull_correctly_d """ SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, LEN(`g`.`Nickname`) = 5, NULL) FROM `Gears` AS `g` -ORDER BY NOT (IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)), `g`.`SquadId` +ORDER BY NOT (IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)) """); } @@ -6043,7 +6043,7 @@ SELECT TOP 1 `w`.`Name` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -6167,7 +6167,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `t`.`Id`, `g0`.`Nickname` """); } @@ -6473,7 +6473,7 @@ LEFT JOIN ( FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` ) AS `s` ON `g`.`FullName` = `s`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6487,7 +6487,7 @@ public override async Task Reference_include_chain_loads_correctly_when_middle_i FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id` -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -6505,7 +6505,7 @@ LEFT JOIN ( FROM `Weapons` AS `w` LEFT JOIN `Gears` AS `g0` ON `w`.`OwnerFullName` = `g0`.`FullName` ) AS `s` ON `g`.`FullName` = `s`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `s`.`Id` +ORDER BY `t`.`Note`, `t`.`Id` """); } @@ -6538,7 +6538,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para FROM `Gears` AS `g` WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `g0` -ORDER BY `g0`.`FullName`, `g0`.`SquadId` +ORDER BY `g0`.`FullName` """); } @@ -6611,7 +6611,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -6794,7 +6794,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -6803,10 +6803,9 @@ public override async Task OrderBy_Contains_empty_list(bool async) await base.OrderBy_Contains_empty_list(async); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -ORDER BY `g`.`SquadId` """); } @@ -6892,7 +6891,7 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n @ranks='134' @ranks='134' -SELECT (`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`g`.`Rank` BOR `g`.`Rank`) BOR @ranks) BOR `g`.`Rank`) BOR @ranks) = @ranks FROM `Gears` AS `g` """); } @@ -7117,7 +7116,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -7411,7 +7410,7 @@ public override async Task Constant_enum_with_same_underlying_value_as_previousl """ SELECT TOP @p `g`.`Rank` BAND 1 FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -7563,7 +7562,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` < `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7576,7 +7575,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` <= `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7585,11 +7584,11 @@ public override async Task Filtered_collection_projection_with_order_comparison_ await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join3(async); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` >= `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7928,12 +7927,12 @@ public override async Task Projecting_property_converted_to_nullable_into_elemen await base.Projecting_property_converted_to_nullable_into_element_init(async); AssertSql( - """ + """ SELECT IIF(`t`.`GearNickName` IS NOT NULL, LEN(`g`.`Nickname`), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL) + 1 FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7947,7 +7946,7 @@ SELECT IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL) AS `Id` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7961,7 +7960,7 @@ SELECT IIF(`t`.`GearNickName` IS NOT NULL, LEN(`g`.`Nickname`), NULL), IIF(`t`.` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7975,7 +7974,7 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL AND NOT (IIF(`t`.`GearNickName` IS NOT NULL, `g`.`HasSoulPatch`, NULL)) -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7989,7 +7988,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE DATEPART('m', `t`.`IssueDate`) <> 5 -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -8003,7 +8002,7 @@ public override async Task Projecting_property_converted_to_nullable_and_use_it_ FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), `t`.`Note`, `t`.`Id` +ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), `t`.`Note` """); } @@ -8036,7 +8035,7 @@ LEFT JOIN ( SELECT DISTINCT `w`.`Id`, `w`.`Name`, `w`.`OwnerFullName` FROM `Weapons` AS `w` ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8052,7 +8051,7 @@ LEFT JOIN ( SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` ) AS `g0` ON `s`.`Id` = `g0`.`SquadId` -ORDER BY `s`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `s`.`Id`, `g0`.`Nickname` """); } @@ -8329,7 +8328,7 @@ ORDER BY `g`.`Nickname` ORDER BY `s`.`Nickname` DESC ) AS `s0` LEFT JOIN `Weapons` AS `w` ON `s0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s0`.`Nickname`, `s0`.`SquadId`, NOT (`s0`.`HasSoulPatch0`), `w`.`Id` +ORDER BY `s0`.`Nickname`, `s0`.`SquadId`, NOT (`s0`.`HasSoulPatch0`) """); } @@ -8387,7 +8386,7 @@ public override async Task Enum_matching_take_value_gets_different_type_mapping( SELECT TOP @p `g`.`Rank` BAND @value FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -8495,7 +8494,7 @@ public override async Task Cast_to_derived_followed_by_multiple_includes(bool as LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `l`.`Name` LIKE '%Queen%' -ORDER BY `l`.`Name`, `w`.`Id` +ORDER BY `l`.`Name` """); } @@ -8901,7 +8900,7 @@ public override async Task Include_collection_on_derived_type_using_EF_Property( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -8915,7 +8914,7 @@ public override async Task EF_Property_based_Include_navigation_on_derived_type( FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -8935,7 +8934,7 @@ ORDER BY `g`.`FullName` ) AS `g0` ORDER BY `g0`.`FullName` DESC ) AS `g1` -ORDER BY `g1`.`FullName`, `g1`.`SquadId` +ORDER BY `g1`.`FullName` """); } @@ -8955,7 +8954,7 @@ ORDER BY `g`.`FullName` ) AS `g0` ORDER BY `g0`.`FullName` DESC ) AS `g1` -ORDER BY `g1`.`FullName`, `g1`.`SquadId` +ORDER BY `g1`.`FullName` """); } @@ -8975,7 +8974,7 @@ ORDER BY `g`.`FullName` ) AS `g0` ORDER BY `g0`.`FullName` DESC ) AS `g1` -ORDER BY `g1`.`FullName`, `g1`.`SquadId` +ORDER BY `g1`.`FullName` """); } @@ -9144,11 +9143,11 @@ public override async Task Include_one_to_many_on_composite_key_then_orderby_key await base.Include_one_to_many_on_composite_key_then_orderby_key_properties(async); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`SquadId`, `g`.`Nickname`, `w`.`Id` +ORDER BY `g`.`SquadId`, `g`.`Nickname` """); } @@ -9178,7 +9177,7 @@ public override async Task Join_include_coalesce_simple(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9186,7 +9185,7 @@ public override async Task Join_include_coalesce_simple(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9195,7 +9194,7 @@ public override async Task Join_include_coalesce_simple(bool async) LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -9204,22 +9203,22 @@ public override async Task Join_include_coalesce_nested(bool async) await base.Join_include_coalesce_nested(async); AssertSql( - """ + """ SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`Nickname` = 'Marcus' FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, - // - """ + // + """ SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId` FROM (((`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `g0`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` """); } @@ -9233,7 +9232,7 @@ public override async Task Join_include_conditional(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryJetFixture.cs similarity index 55% rename from test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryJetFixture.cs index 1e00e2b1..ed3fe05f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryJetFixture.cs @@ -1,9 +1,6 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore.Query; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCFiltersInheritanceQueryJetFixture : TPCInheritanceQueryJetFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryJetTest.cs similarity index 97% rename from test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryJetTest.cs index 86761c2a..f8069754 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCFiltersInheritanceQueryJetTest : TPCFiltersInheritanceQueryTestBase { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryJetFixture.cs similarity index 95% rename from test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryJetFixture.cs index 79f4834e..4c2eb01d 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryJetFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCGearsOfWarQueryJetFixture : TPCGearsOfWarQueryRelationalFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryJetTest.cs similarity index 99% rename from test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryJetTest.cs index 416e0d8f..913e0c6a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel; @@ -13,7 +10,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCGearsOfWarQueryJetTest : TPCGearsOfWarQueryRelationalTestBase { @@ -3108,7 +3105,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` -ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname` +ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } @@ -3758,7 +3755,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool async """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3770,7 +3767,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca """ SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3782,7 +3779,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3794,7 +3791,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool asy """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3807,7 +3804,7 @@ public override async Task Navigation_access_on_derived_entity_using_cast(bool a SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3820,7 +3817,7 @@ public override async Task Navigation_access_on_derived_materialized_entity_usin SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3833,7 +3830,7 @@ public override async Task Navigation_access_via_EFProperty_on_derived_entity_us SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3846,7 +3843,7 @@ public override async Task Navigation_access_fk_on_derived_entity_using_cast(boo SELECT `l`.`Name`, `l0`.`Name` AS `CommanderName` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -4521,7 +4518,7 @@ UNION ALL FROM `Officers` AS `o` ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` ) AS `s` ON `l`.`Id` = `s`.`LocustHordeId` -ORDER BY `l`.`Id`, `s`.`Name` +ORDER BY `l`.`Id` """); } @@ -4578,7 +4575,7 @@ UNION ALL INNER JOIN `Squads` AS `s` ON `u0`.`SquadId` = `s`.`Id`) LEFT JOIN `SquadMissions` AS `s0` ON `s`.`Id` = `s0`.`SquadId` ) AS `s1` ON `u`.`Nickname` = `s1`.`LeaderNickname` AND `u`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`SquadId0` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`SquadId0`, `s1`.`MissionId` """); } @@ -4930,7 +4927,7 @@ LEFT JOIN ( WHERE `s0`.`MissionId` <> 17 ) AS `s1` ON `s`.`Id` = `s1`.`SquadId` WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`SquadId` +ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`SquadId`, `s1`.`MissionId` """); } @@ -4973,7 +4970,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4996,7 +4993,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -5019,7 +5016,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -6102,7 +6099,7 @@ UNION ALL ORDER BY `t`.`Note` ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Note`, `s`.`Name`, `w`.`Id` +ORDER BY `s`.`Note`, `s`.`Name` """); } @@ -7444,7 +7441,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -7457,7 +7454,7 @@ public override async Task Double_order_by_on_Like(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -7470,7 +7467,7 @@ public override async Task Double_order_by_on_is_null(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -7492,12 +7489,12 @@ public override async Task Double_order_by_binary_expression(bool async) AssertSql( """ -SELECT `w0`.`Binary`, `w0`.`Id` +SELECT `w0`.`Binary` FROM ( - SELECT `w`.`Id` + 2 AS `Binary`, `w`.`Id` + SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` ) AS `w0` -ORDER BY `w0`.`Binary`, `w0`.`Id` +ORDER BY `w0`.`Binary` """); } @@ -7510,7 +7507,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -7523,7 +7520,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -7536,7 +7533,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & ''), `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } @@ -7549,7 +7546,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer', `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } @@ -7845,7 +7842,7 @@ UNION ALL LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -8787,7 +8784,7 @@ UNION ALL ) AS `u` WHERE `u`.`Nickname` <> @prm_Inner_Nickname ) AS `u0` -ORDER BY `u0`.`FullName`, `u0`.`SquadId` +ORDER BY `u0`.`FullName` """); } @@ -8884,7 +8881,7 @@ UNION ALL ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -9309,7 +9306,7 @@ UNION ALL @ranks='134' @ranks='134' -SELECT (`u`.`Rank` BOR (`u`.`Rank` BOR (@ranks BOR (`u`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`u`.`Rank` BOR `u`.`Rank`) BOR @ranks) BOR `u`.`Rank`) BOR @ranks) = @ranks FROM ( SELECT `g`.`Rank` FROM `Gears` AS `g` @@ -9569,7 +9566,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -12060,7 +12057,7 @@ public override async Task ElementAt_basic_with_OrderBy(bool async) await base.ElementAt_basic_with_OrderBy(async); AssertSql( - """ + """ SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` FROM ( SELECT TOP 1 `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` @@ -12077,7 +12074,7 @@ ORDER BY `u`.`FullName` ) AS `u0` ORDER BY `u0`.`FullName` DESC ) AS `u1` -ORDER BY `u1`.`FullName`, `u1`.`SquadId` +ORDER BY `u1`.`FullName` """); } @@ -12103,7 +12100,7 @@ ORDER BY `u`.`FullName` ) AS `u0` ORDER BY `u0`.`FullName` DESC ) AS `u1` -ORDER BY `u1`.`FullName`, `u1`.`SquadId` +ORDER BY `u1`.`FullName` """); } @@ -12112,7 +12109,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool await base.ElementAtOrDefault_basic_with_OrderBy_parameter(async); AssertSql( - """ + """ SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` FROM ( SELECT TOP 1 `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` @@ -12129,7 +12126,7 @@ ORDER BY `u`.`FullName` ) AS `u0` ORDER BY `u0`.`FullName` DESC ) AS `u1` -ORDER BY `u1`.`FullName`, `u1`.`SquadId` +ORDER BY `u1`.`FullName` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixture.cs new file mode 100644 index 00000000..6d4846d7 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixture.cs @@ -0,0 +1,5 @@ +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; + +public class TPCInheritanceQueryJetFixture : TPCInheritanceQueryJetFixtureBase +{ +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixtureBase.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixtureBase.cs similarity index 72% rename from test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixtureBase.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixtureBase.cs index d8427c99..4fe0e257 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixtureBase.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetFixtureBase.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public abstract class TPCInheritanceQueryJetFixtureBase : TPCInheritanceQueryFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetTest.cs similarity index 61% rename from test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetTest.cs index d9d9169e..fb9c6247 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetTest.cs @@ -1,12 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - // ReSharper disable InconsistentNaming using Microsoft.EntityFrameworkCore.Query; using Xunit; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCInheritanceQueryJetTest(TPCInheritanceQueryJetFixture fixture, ITestOutputHelper testOutputHelper) : TPCInheritanceQueryJetTestBase(fixture, testOutputHelper); diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetTestBase.cs similarity index 99% rename from test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetTestBase.cs index 3e6e1a8a..42cf7811 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCInheritanceQueryJetTestBase.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -8,7 +5,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public abstract class TPCInheritanceQueryJetTestBase(TFixture fixture, ITestOutputHelper testOutputHelper) : TPCInheritanceQueryTestBase(fixture, testOutputHelper) @@ -445,7 +442,7 @@ public override async Task Member_access_on_intermediate_type_works() """ SELECT `k`.`Name` FROM `Kiwi` AS `k` -ORDER BY `k`.`Name`, `k`.`Id` +ORDER BY `k`.`Name` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryJetTest.cs similarity index 97% rename from test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryJetTest.cs index b83d2967..8ea7e299 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCManyToManyNoTrackingQueryJetTest : TPCManyToManyNoTrackingQueryRelationalTestBase { @@ -411,7 +408,7 @@ LEFT JOIN ( FROM `JoinCompositeKeyToLeaf` AS `j` INNER JOIN `Leaves` AS `l` ON `j`.`LeafId` = `l`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -653,7 +650,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -680,7 +677,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -730,7 +727,7 @@ UNION ALL FROM `Leaf2s` AS `l0` ) AS `u` ON `e0`.`RootSkipSharedId` = `u`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -748,7 +745,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -811,7 +808,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -829,7 +826,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -1005,7 +1002,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `l`.`Id` = `s0`.`LeafId` -ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1081,7 +1078,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1143,7 +1140,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1166,7 +1163,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2282,7 +2279,7 @@ UNION ALL ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` WHERE `u1`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2442,7 +2439,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2468,7 +2465,7 @@ UNION ALL FROM `UnidirectionalLeaves` AS `u4` ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2486,7 +2483,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2567,7 +2564,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2669,7 +2666,7 @@ LEFT JOIN ( ) AS `s` ON `u1`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u1`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u1`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u1`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2689,7 +2686,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2805,6 +2802,95 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT [u].[Id] AS [UserId], [s].[Id] AS [OrgId] +FROM [Users] AS [u] +CROSS JOIN ( + SELECT [o1].[Id] + FROM ( + SELECT 1 AS empty + ) AS [e] + LEFT JOIN ( + SELECT [o].[Id] + FROM [Organisations] AS [o] + WHERE EXISTS ( + SELECT 1 + FROM [OrganisationUser] AS [o0] + WHERE [o].[Id] = [o0].[OrganisationId]) + ) AS [o1] ON 1 = 1 +) AS [s] +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyQueryJetFixture.cs similarity index 70% rename from test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyQueryJetFixture.cs index ce0c846b..3b43397b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyQueryJetFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCManyToManyQueryJetFixture : TPCManyToManyQueryRelationalFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyQueryJetTest.cs similarity index 97% rename from test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyQueryJetTest.cs index 65f7490a..a732776f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCManyToManyQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCManyToManyQueryJetTest : TPCManyToManyQueryRelationalTestBase { @@ -411,7 +408,7 @@ LEFT JOIN ( FROM `JoinCompositeKeyToLeaf` AS `j` INNER JOIN `Leaves` AS `l` ON `j`.`LeafId` = `l`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -653,7 +650,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -680,7 +677,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -730,7 +727,7 @@ UNION ALL FROM `Leaf2s` AS `l0` ) AS `u` ON `e0`.`RootSkipSharedId` = `u`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -748,7 +745,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -811,7 +808,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -829,7 +826,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -1005,7 +1002,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `l`.`Id` = `s0`.`LeafId` -ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1081,7 +1078,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1143,7 +1140,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1166,7 +1163,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2283,7 +2280,7 @@ UNION ALL ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` WHERE `u1`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2442,7 +2439,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2468,7 +2465,7 @@ UNION ALL FROM `UnidirectionalLeaves` AS `u4` ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2486,7 +2483,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2589,7 +2586,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2692,7 +2689,7 @@ LEFT JOIN ( ) AS `s` ON `u1`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u1`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u1`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u1`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2712,7 +2709,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2829,6 +2826,95 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT [u].[Id] AS [UserId], [s].[Id] AS [OrgId] +FROM [Users] AS [u] +CROSS JOIN ( + SELECT [o1].[Id] + FROM ( + SELECT 1 AS empty + ) AS [e] + LEFT JOIN ( + SELECT [o].[Id] + FROM [Organisations] AS [o] + WHERE EXISTS ( + SELECT 1 + FROM [OrganisationUser] AS [o0] + WHERE [o].[Id] = [o0].[OrganisationId]) + ) AS [o1] ON 1 = 1 +) AS [s] +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCRelationshipsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryJetTest.cs similarity index 99% rename from test/EFCore.Jet.FunctionalTests/Query/TPCRelationshipsQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryJetTest.cs index a9f41de8..e1c252b1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCRelationshipsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPCRelationshipsQueryJetTest : TPCRelationshipsQueryTestBase @@ -102,7 +99,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -150,7 +147,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `c`.`Name` <> 'Bar' OR `c`.`Name` IS NULL -ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -239,7 +236,7 @@ public override async Task Include_collection_with_inheritance_on_derived3(bool LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `d`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `DerivedCollectionsOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `d1`.`Id` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -261,7 +258,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d0`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -290,7 +287,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u0`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -350,7 +347,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -373,7 +370,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -444,7 +441,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -468,7 +465,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -492,7 +489,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `r`.`Name` <> 'Bar' OR `r`.`Name` IS NULL -ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -521,7 +518,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -543,7 +540,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -565,7 +562,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -603,7 +600,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d0`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -626,7 +623,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `d`.`Name` <> 'Bar' OR `d`.`Name` IS NULL -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -649,7 +646,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `d`.`Name` <> 'Bar' OR `d`.`Name` IS NULL -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -689,7 +686,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -718,7 +715,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u0`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -748,7 +745,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -778,7 +775,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -804,7 +801,7 @@ UNION ALL LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o2` ON `d0`.`Id` = `o2`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d3` ON `d0`.`Id` = `d3`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId`, `d3`.`Id` """); } @@ -830,7 +827,7 @@ UNION ALL LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `d`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o2` ON `u`.`Id` = `o2`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d3` ON `u`.`Id` = `d3`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId`, `d3`.`Id` """); } @@ -847,7 +844,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -922,7 +919,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -997,7 +994,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1098,7 +1095,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1134,7 +1131,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1163,7 +1160,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -1199,7 +1196,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPHInheritanceQueryJetFixture.cs similarity index 69% rename from test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPHInheritanceQueryJetFixture.cs index c87c9e98..476103c1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPHInheritanceQueryJetFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPHInheritanceQueryJetFixture : TPHInheritanceQueryFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPHInheritanceQueryJetTest.cs similarity index 97% rename from test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPHInheritanceQueryJetTest.cs index f9b13527..a5e8ecd4 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPHInheritanceQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; @@ -12,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Query.Inheritance; #nullable disable // ReSharper disable InconsistentNaming -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPHInheritanceQueryJetTest(TPHInheritanceQueryJetFixture fixture, ITestOutputHelper testOutputHelper) : TPHInheritanceQueryTestBase(fixture, testOutputHelper) @@ -107,7 +104,7 @@ public override async Task Can_use_of_type_animal(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -165,7 +162,7 @@ public override async Task Can_use_of_type_bird(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -178,7 +175,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` WHERE `a`.`CountryId` = 1 -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -240,7 +237,7 @@ public override async Task Can_query_all_animals(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -279,7 +276,7 @@ public override async Task Can_filter_all_animals(bool async) SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` WHERE `a`.`Name` = 'Great spotted kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -291,7 +288,7 @@ public override async Task Can_query_all_birds(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -332,7 +329,7 @@ public override async Task Can_include_prey(bool async) WHERE `a`.`Discriminator` = 'Eagle' ) AS `a1` LEFT JOIN `Animals` AS `a0` ON `a1`.`Id` = `a0`.`EagleId` -ORDER BY `a1`.`Id`, `a0`.`Id` +ORDER BY `a1`.`Id` """); } @@ -345,7 +342,7 @@ public override async Task Can_include_animals(bool async) SELECT `c`.`Id`, `c`.`Name`, `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Countries` AS `c` LEFT JOIN `Animals` AS `a` ON `c`.`Id` = `a`.`CountryId` -ORDER BY `c`.`Name`, `c`.`Id`, `a`.`Id` +ORDER BY `c`.`Name`, `c`.`Id` """); } @@ -512,7 +509,7 @@ public override async Task Member_access_on_intermediate_type_works() SELECT `a`.`Name` FROM `Animals` AS `a` WHERE `a`.`Discriminator` = 'Kiwi' -ORDER BY `a`.`Name`, `a`.`Id` +ORDER BY `a`.`Name` """); } @@ -543,7 +540,7 @@ public override async Task Is_operator_on_result_of_FirstOrDefault(bool async) SELECT TOP 1 `a0`.`Discriminator` FROM `Animals` AS `a0` WHERE `a0`.`Name` = 'Great spotted kiwi') = 'Kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetFixture.cs new file mode 100644 index 00000000..62cd36ab --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetFixture.cs @@ -0,0 +1,9 @@ +using Microsoft.EntityFrameworkCore.Query; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; + +public class TPTFiltersInheritanceQueryJetFixture : TPTInheritanceQueryJetFixture +{ + public override bool EnableFilters + => true; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetTest.cs similarity index 96% rename from test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetTest.cs index ce9348ea..b34b9497 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTFiltersInheritanceQueryJetTest : TPTFiltersInheritanceQueryTestBase { @@ -38,7 +35,7 @@ public override async Task Can_use_of_type_animal(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -97,7 +94,7 @@ public override async Task Can_use_of_type_bird(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -113,7 +110,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryJetFixture.cs similarity index 95% rename from test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryJetFixture.cs index 79e24c00..b42574c7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryJetFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTGearsOfWarQueryJetFixture : TPTGearsOfWarQueryRelationalFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryJetTest.cs similarity index 99% rename from test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryJetTest.cs index 0863c0d6..663d50e8 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -13,7 +10,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTGearsOfWarQueryJetTest : TPTGearsOfWarQueryRelationalTestBase { @@ -68,7 +65,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -104,7 +101,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -124,7 +121,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -139,7 +136,7 @@ public override async Task Include_using_alternate_key(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -158,7 +155,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -177,7 +174,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -241,7 +238,7 @@ public override async Task Include_with_join_collection1(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -259,7 +256,7 @@ INNER JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearSquadId` = `s`.`SquadId` AND `t`.`GearNickName` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -370,7 +367,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `s`.`Nickname` """); } @@ -412,7 +409,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY NOT (`s`.`HasSoulPatch`), `s`.`Nickname` DESC, `t`.`Id`, `s`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY NOT (`s`.`HasSoulPatch`), `s`.`Nickname` DESC, `t`.`Id`, `s`.`SquadId`, `s0`.`Nickname` """); } @@ -428,7 +425,7 @@ public override async Task Include_with_join_and_inheritance2(bool async) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -451,7 +448,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `s0`.`Nickname` """); } @@ -1372,7 +1369,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool await base.Where_subquery_distinct_singleordefault_boolean2(async); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` @@ -1383,7 +1380,7 @@ SELECT TOP 1 `w`.`IsAutomatic` SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -2003,7 +2000,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -2023,7 +2020,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -2044,7 +2041,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2067,7 +2064,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w0` ON `s`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `s`.`FullName` = `w1`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } @@ -2089,7 +2086,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2110,7 +2107,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2134,7 +2131,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w3` ON `s`.`FullName` = `w3`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w4` ON `g`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id`, `w4`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } @@ -2508,7 +2505,7 @@ LEFT JOIN ( WHERE `g0`.`Nickname` <> 'Dom' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -2794,7 +2791,7 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE `g`.`FullName` <> 'Augustus Cole' AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2884,7 +2881,7 @@ WHERE EXISTS ( SELECT 1 FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName`) AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3015,12 +3012,12 @@ public override async Task Member_access_on_derived_entity_using_cast(bool async await base.Member_access_on_derived_entity_using_cast(async); AssertSql( - """ + """ SELECT `f`.`Name`, `l`.`Eradicated` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3029,12 +3026,12 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca await base.Member_access_on_derived_materialized_entity_using_cast(async); AssertSql( - """ + """ SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3048,7 +3045,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3057,12 +3054,12 @@ public override async Task Property_access_on_derived_entity_using_cast(bool asy await base.Property_access_on_derived_entity_using_cast(async); AssertSql( - """ + """ SELECT `f`.`Name`, `l`.`Eradicated` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3195,7 +3192,7 @@ LEFT JOIN ( LEFT JOIN `LocustCommanders` AS `l3` ON `l2`.`Name` = `l3`.`Name` ) AS `s0` ON `f`.`Id` = `s0`.`LocustHordeId` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id`, `s0`.`Name` +ORDER BY `f`.`Name`, `f`.`Id` """); } @@ -3489,7 +3486,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId`) INNER JOIN `Cities` AS `c` ON `g0`.`CityOfBirthName` = `c`.`Name` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `l`.`Name`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `l`.`Name`, `s0`.`Nickname` """); } @@ -3549,7 +3546,7 @@ public override async Task Include_collection_on_derived_type_using_string(bool await base.Include_collection_on_derived_type_using_string(async); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) @@ -3558,7 +3555,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3576,7 +3573,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3594,7 +3591,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3609,7 +3606,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3627,7 +3624,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -3655,7 +3652,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s1` ON `s0`.`Nickname` = `s1`.`LeaderNickname` AND `s0`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `f`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `f`.`Id`, `s1`.`Nickname` """); } @@ -3678,7 +3675,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o1` ON `g1`.`Nickname` = `o1`.`Nickname` AND `g1`.`SquadId` = `o1`.`SquadId` ) AS `s` ON `g0`.`Nickname` = `s`.`LeaderNickname` AND `g0`.`SquadId` = `s`.`LeaderSquadId` ) AS `s0` ON `g`.`Nickname` = `s0`.`LeaderNickname` AND `g`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -3701,7 +3698,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `l1`.`DefeatedByNickname` = `s`.`Nickname` AND `l1`.`DefeatedBySquadId` = `s`.`SquadId` ) AS `s0` ON `f`.`Id` = `s0`.`LocustHordeId` -ORDER BY `f`.`Id`, `s0`.`Name` +ORDER BY `f`.`Id` """); } @@ -3729,7 +3726,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s1` ON `s0`.`Nickname` = `s1`.`LeaderNickname` AND `s0`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `f`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `f`.`Id`, `s1`.`Nickname` """); } @@ -4018,7 +4015,7 @@ LEFT JOIN ( WHERE `s0`.`MissionId` <> 17 ) AS `s1` ON `s`.`Id` = `s1`.`SquadId` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`SquadId`, `s1`.`MissionId` """); } @@ -4044,7 +4041,7 @@ public override async Task Correlated_collections_nested(bool async) await base.Correlated_collections_nested(async); AssertSql( - """ + """ SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` FROM `Squads` AS `s` LEFT JOIN ( @@ -4058,7 +4055,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4067,7 +4064,7 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu await base.Correlated_collections_nested_mixed_streaming_with_buffer1(async); AssertSql( - """ + """ SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` FROM `Squads` AS `s` LEFT JOIN ( @@ -4081,7 +4078,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4090,7 +4087,7 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu await base.Correlated_collections_nested_mixed_streaming_with_buffer2(async); AssertSql( - """ + """ SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` FROM `Squads` AS `s` LEFT JOIN ( @@ -4104,7 +4101,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4917,7 +4914,7 @@ LEFT JOIN ( ORDER BY `t`.`Note` ) AS `s0` LEFT JOIN `Weapons` AS `w` ON `s0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s0`.`Note`, `s0`.`Name`, `w`.`Id` +ORDER BY `s0`.`Note`, `s0`.`Name` """); } @@ -5428,7 +5425,7 @@ LEFT JOIN ( FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `s`.`Id`, `s0`.`Nickname` """); } @@ -5506,7 +5503,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5532,7 +5529,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5562,7 +5559,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5588,7 +5585,7 @@ WHERE NOT (`g0`.`HasSoulPatch`) ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5949,7 +5946,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -5958,11 +5955,11 @@ public override async Task Double_order_by_on_Like(bool async) await base.Double_order_by_on_Like(async); AssertSql( - """ + """ SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -5975,7 +5972,7 @@ public override async Task Double_order_by_on_is_null(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -5997,12 +5994,12 @@ public override async Task Double_order_by_binary_expression(bool async) AssertSql( """ -SELECT `w0`.`Binary`, `w0`.`Id` +SELECT `w0`.`Binary` FROM ( - SELECT `w`.`Id` + 2 AS `Binary`, `w`.`Id` + SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` ) AS `w0` -ORDER BY `w0`.`Binary`, `w0`.`Id` +ORDER BY `w0`.`Binary` """); } @@ -6015,7 +6012,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -6028,7 +6025,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -6041,7 +6038,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & ''), `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } @@ -6054,7 +6051,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer', `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } @@ -6223,7 +6220,7 @@ public override async Task Include_collection_with_Cast_to_base(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6250,7 +6247,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6269,7 +6266,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -6577,7 +6574,7 @@ SELECT TOP 1 `w`.`Name` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -7074,7 +7071,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Squads` AS `s0` ON `s`.`SquadId` = `s0`.`Id` -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7133,7 +7130,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `s` -ORDER BY `s`.`FullName`, `s`.`SquadId` +ORDER BY `s`.`FullName` """); } @@ -7209,7 +7206,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -7399,7 +7396,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -7412,7 +7409,6 @@ public override async Task OrderBy_Contains_empty_list(bool async) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -ORDER BY `g`.`SquadId` """); } @@ -7504,7 +7500,7 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n @ranks='134' @ranks='134' -SELECT (`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`g`.`Rank` BOR `g`.`Rank`) BOR @ranks) BOR `g`.`Rank`) BOR @ranks) = @ranks FROM `Gears` AS `g` """); } @@ -7702,7 +7698,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -9030,7 +9026,7 @@ LEFT JOIN ( ) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` WHERE `l`.`Name` LIKE '%Queen%' -ORDER BY `l`.`Name`, `w`.`Id` +ORDER BY `l`.`Name` """); } @@ -9651,7 +9647,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -9670,7 +9666,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -9679,7 +9675,7 @@ public override async Task ElementAt_basic_with_OrderBy(bool async) await base.ElementAt_basic_with_OrderBy(async); AssertSql( - """ + """ SELECT `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator` FROM ( SELECT TOP 1 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` @@ -9691,7 +9687,7 @@ ORDER BY `g`.`FullName` ) AS `s` ORDER BY `s`.`FullName` DESC ) AS `s0` -ORDER BY `s0`.`FullName`, `s0`.`SquadId` +ORDER BY `s0`.`FullName` """); } @@ -9700,7 +9696,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy(bool async) await base.ElementAtOrDefault_basic_with_OrderBy(async); AssertSql( - """ + """ SELECT `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator` FROM ( SELECT TOP 1 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` @@ -9712,7 +9708,7 @@ ORDER BY `g`.`FullName` ) AS `s` ORDER BY `s`.`FullName` DESC ) AS `s0` -ORDER BY `s0`.`FullName`, `s0`.`SquadId` +ORDER BY `s0`.`FullName` """); } @@ -9721,7 +9717,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool await base.ElementAtOrDefault_basic_with_OrderBy_parameter(async); AssertSql( - """ + """ SELECT `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator` FROM ( SELECT TOP 1 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` @@ -9733,7 +9729,7 @@ ORDER BY `g`.`FullName` ) AS `s` ORDER BY `s`.`FullName` DESC ) AS `s0` -ORDER BY `s0`.`FullName`, `s0`.`SquadId` +ORDER BY `s0`.`FullName` """); } @@ -9906,12 +9902,12 @@ public override async Task Include_one_to_many_on_composite_key_then_orderby_key await base.Include_one_to_many_on_composite_key_then_orderby_key_properties(async); AssertSql( - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`SquadId`, `g`.`Nickname`, `w`.`Id` +ORDER BY `g`.`SquadId`, `g`.`Nickname` """); } @@ -9937,7 +9933,7 @@ public override async Task Join_include_coalesce_simple(bool async) await base.Join_include_coalesce_simple(async); AssertSql( - """ + """ SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`Nickname` = 'Marcus' FROM ((`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) @@ -9947,10 +9943,10 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, - // - """ + // + """ SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM ((`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) @@ -9960,10 +9956,10 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, - // - """ + // + """ SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM (((`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) @@ -9974,7 +9970,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -9993,7 +9989,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -10008,7 +10004,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `s`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `s`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` """); } @@ -10017,7 +10013,7 @@ public override async Task Join_include_conditional(bool async) await base.Join_include_conditional(async); AssertSql( - """ + """ SELECT `s`.`Nickname` IS NOT NULL AND `s`.`SquadId` IS NOT NULL, `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `g`.`Nickname` = 'Marcus' FROM ((`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) @@ -10027,7 +10023,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTInheritanceQueryJetFixture.cs similarity index 77% rename from test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTInheritanceQueryJetFixture.cs index d6d7162b..9a6b84ae 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTInheritanceQueryJetFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; @@ -8,7 +5,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTInheritanceQueryJetFixture : TPTInheritanceQueryFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTInheritanceQueryJetTest.cs similarity index 98% rename from test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTInheritanceQueryJetTest.cs index 6e02f400..2b2ed104 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTInheritanceQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - // ReSharper disable InconsistentNaming using System.Threading.Tasks; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTInheritanceQueryJetTest(TPTInheritanceQueryJetFixture fixture, ITestOutputHelper testOutputHelper) : TPTInheritanceQueryTestBase(fixture, testOutputHelper) @@ -45,7 +42,7 @@ public override async Task Can_filter_all_animals(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`Name` = 'Great spotted kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -64,7 +61,7 @@ LEFT JOIN ( LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` ) AS `s` ON `c`.`Id` = `s`.`CountryId` -ORDER BY `c`.`Name`, `c`.`Id`, `s`.`Id` +ORDER BY `c`.`Name`, `c`.`Id` """); } @@ -88,7 +85,7 @@ LEFT JOIN ( LEFT JOIN `Eagle` AS `e0` ON `a0`.`Id` = `e0`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a0`.`Id` = `k`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`EagleId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """); } @@ -106,7 +103,7 @@ public override async Task Can_query_all_animals(bool async) LEFT JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -121,7 +118,7 @@ public override async Task Can_query_all_birds(bool async) INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -295,7 +292,7 @@ public override async Task Can_use_of_type_animal(bool async) LEFT JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -311,7 +308,7 @@ public override async Task Can_use_of_type_bird(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -343,7 +340,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -427,7 +424,7 @@ public override async Task Member_access_on_intermediate_type_works() FROM (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Name`, `a`.`Id` +ORDER BY `a`.`Name` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryJetTest.cs similarity index 97% rename from test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryJetTest.cs index 591e6bb6..ff652e89 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTManyToManyNoTrackingQueryJetTest : TPTManyToManyNoTrackingQueryRelationalTestBase< TPTManyToManyQueryJetFixture> @@ -391,7 +388,7 @@ INNER JOIN ( INNER JOIN `Leaves` AS `l` ON `r`.`Id` = `l`.`Id` ) AS `s` ON `j`.`LeafId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2` """); } @@ -608,7 +605,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -635,7 +632,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -680,7 +677,7 @@ INNER JOIN ( LEFT JOIN `Leaf2s` AS `l0` ON `r`.`Id` = `l0`.`Id` ) AS `s` ON `e0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -698,7 +695,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -766,7 +763,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -784,7 +781,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -891,7 +888,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s` ON `e0`.`Id` = `s`.`ThreeId` ) AS `s0` ON `r`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -950,7 +947,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `r`.`Id` = `s0`.`LeafId` -ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1026,7 +1023,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1089,7 +1086,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1112,7 +1109,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2219,7 +2216,7 @@ INNER JOIN ( ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` WHERE `s`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2369,7 +2366,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2391,7 +2388,7 @@ INNER JOIN ( LEFT JOIN `UnidirectionalLeaves` AS `u3` ON `u1`.`Id` = `u3`.`Id` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2409,7 +2406,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2495,7 +2492,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2598,7 +2595,7 @@ LEFT JOIN ( ) AS `s` ON `u3`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u3`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u3`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u3`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2618,7 +2615,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2726,6 +2723,95 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT [u].[Id] AS [UserId], [s].[Id] AS [OrgId] +FROM [Users] AS [u] +CROSS JOIN ( + SELECT [o1].[Id] + FROM ( + SELECT 1 AS empty + ) AS [e] + LEFT JOIN ( + SELECT [o].[Id] + FROM [Organisations] AS [o] + WHERE EXISTS ( + SELECT 1 + FROM [OrganisationUser] AS [o0] + WHERE [o].[Id] = [o0].[OrganisationId]) + ) AS [o1] ON 1 = 1 +) AS [s] +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyQueryJetFixture.cs similarity index 70% rename from test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetFixture.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyQueryJetFixture.cs index 3f084524..b9ac81d2 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyQueryJetFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTManyToManyQueryJetFixture : TPTManyToManyQueryRelationalFixture { diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyQueryJetTest.cs similarity index 97% rename from test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyQueryJetTest.cs index 523874fc..f722bad8 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTManyToManyQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTManyToManyQueryJetTest : TPTManyToManyQueryRelationalTestBase { @@ -389,7 +386,7 @@ INNER JOIN ( INNER JOIN `Leaves` AS `l` ON `r`.`Id` = `l`.`Id` ) AS `s` ON `j`.`LeafId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2` """); } @@ -606,7 +603,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -633,7 +630,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -678,7 +675,7 @@ INNER JOIN ( LEFT JOIN `Leaf2s` AS `l0` ON `r`.`Id` = `l0`.`Id` ) AS `s` ON `e0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -696,7 +693,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -764,7 +761,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -782,7 +779,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -889,7 +886,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s` ON `e0`.`Id` = `s`.`ThreeId` ) AS `s0` ON `r`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -948,7 +945,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `r`.`Id` = `s0`.`LeafId` -ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1024,7 +1021,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1087,7 +1084,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1110,7 +1107,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2218,7 +2215,7 @@ INNER JOIN ( ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` WHERE `s`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2368,7 +2365,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2390,7 +2387,7 @@ INNER JOIN ( LEFT JOIN `UnidirectionalLeaves` AS `u3` ON `u1`.`Id` = `u3`.`Id` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2408,7 +2405,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2516,7 +2513,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2621,7 +2618,7 @@ LEFT JOIN ( ) AS `s` ON `u3`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u3`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u3`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u3`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2641,7 +2638,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2748,6 +2745,95 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT [u].[Id] AS [UserId], [s].[Id] AS [OrgId] +FROM [Users] AS [u] +CROSS JOIN ( + SELECT [o1].[Id] + FROM ( + SELECT 1 AS empty + ) AS [e] + LEFT JOIN ( + SELECT [o].[Id] + FROM [Organisations] AS [o] + WHERE EXISTS ( + SELECT 1 + FROM [OrganisationUser] AS [o0] + WHERE [o].[Id] = [o0].[OrganisationId]) + ) AS [o1] ON 1 = 1 +) AS [s] +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTRelationshipsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryJetTest.cs similarity index 99% rename from test/EFCore.Jet.FunctionalTests/Query/TPTRelationshipsQueryJetTest.cs rename to test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryJetTest.cs index a330d3ca..0e5167ca 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTRelationshipsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryJetTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Inheritance; public class TPTRelationshipsQueryJetTest : TPTRelationshipsQueryTestBase @@ -47,7 +44,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`BaseParentId` -ORDER BY `s`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -63,7 +60,7 @@ public override async Task Include_collection_without_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `b`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -99,7 +96,7 @@ public override async Task Include_collection_without_inheritance_with_filter(bo LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `b`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -139,7 +136,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -159,7 +156,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -179,7 +176,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnDerived` AS `b1` LEFT JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -199,7 +196,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnDerived` AS `b1` INNER JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -260,7 +257,7 @@ LEFT JOIN ( LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -711,7 +708,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -736,7 +733,7 @@ LEFT JOIN ( LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s` ON `b1`.`Id` = `s`.`ParentCollectionId` ) AS `s0` ON `b`.`Id` = `s0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` """); } @@ -786,7 +783,7 @@ LEFT JOIN ( LEFT JOIN `NestedReferencesDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s` ON `b1`.`Id` = `s`.`ParentCollectionId` ) AS `s0` ON `b`.`Id` = `s0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -836,7 +833,7 @@ LEFT JOIN ( FROM `NestedCollections` AS `n` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -861,7 +858,7 @@ LEFT JOIN ( FROM `NestedCollections` AS `n` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -999,7 +996,7 @@ LEFT JOIN ( INNER JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Id` >= 4 -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/InheritanceRelationshipsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/InheritanceRelationshipsQueryJetTest.cs index 5e47af4d..525d069a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/InheritanceRelationshipsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/InheritanceRelationshipsQueryJetTest.cs @@ -196,7 +196,7 @@ public override async Task Include_collection_with_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -227,7 +227,7 @@ public override async Task Include_collection_with_inheritance_with_filter(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -258,7 +258,7 @@ public override async Task Include_collection_without_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -289,7 +289,7 @@ public override async Task Include_collection_without_inheritance_with_filter(bo LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -515,7 +515,7 @@ public override async Task Include_collection_with_inheritance_on_derived1(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -531,7 +531,7 @@ public override async Task Include_collection_with_inheritance_on_derived2(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnDerived` AS `b2` ON `b`.`Id` = `b2`.`ParentId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -551,7 +551,7 @@ LEFT JOIN ( WHERE `b2`.`Discriminator` = 'DerivedCollectionOnDerived' ) AS `b3` ON `b`.`Id` = `b3`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b3`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -635,7 +635,7 @@ public override async Task Nested_include_with_inheritance_reference_collection( LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b1` ON `b`.`Id` = `b1`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b2` ON `b`.`Id` = `b2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `NestedCollections` AS `n` ON `b0`.`Id` = `n`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id`, `n`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id` """); } @@ -652,7 +652,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b2` ON `b`.`Id` = `b2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `NestedCollections` AS `n` ON `b0`.`Id` = `n`.`ParentReferenceId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id`, `n`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id` """); } @@ -687,7 +687,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b2` LEFT JOIN `NestedReferences` AS `n` ON `b2`.`Id` = `n`.`ParentCollectionId` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -722,7 +722,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b2` LEFT JOIN `NestedCollections` AS `n` ON `b2`.`Id` = `n`.`ParentCollectionId` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id` """); } @@ -755,7 +755,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -768,7 +768,7 @@ public override async Task Collection_projection_on_base_type(bool async) SELECT `b`.`Id`, `b0`.`Id`, `b0`.`BaseParentId`, `b0`.`Discriminator`, `b0`.`Name`, `b0`.`DerivedProperty` FROM `BaseEntities` AS `b` LEFT JOIN `BaseCollectionsOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`Id` +ORDER BY `b`.`Id` """); } @@ -788,7 +788,7 @@ LEFT JOIN ( WHERE `b2`.`Discriminator` = 'DerivedCollectionOnDerived' ) AS `b3` ON `b`.`Id` = `b3`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Id` >= 4 -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b3`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -1570,7 +1570,7 @@ public override void Changes_in_derived_related_entities_are_detected() LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b3`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b3`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b3`.`Id` = `b2`.`BaseParentId` -ORDER BY `b3`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b3`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs index 9cc6f2bb..6ac66b4c 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs @@ -378,7 +378,7 @@ INNER JOIN ( WHERE `e0`.`Discriminator` = 'EntityLeaf' ) AS `e1` ON `j`.`LeafId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -396,7 +396,7 @@ LEFT JOIN ( INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` WHERE `e1`.`Discriminator` = 'EntityLeaf' ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -582,7 +582,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -609,7 +609,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -647,7 +647,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityRoot` AS `e0` INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -665,7 +665,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -732,7 +732,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -750,7 +750,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -853,7 +853,7 @@ LEFT JOIN ( WHERE `e2`.`Id` < 10 ) AS `s` ON `e1`.`Id` = `s`.`ThreeId` ) AS `s0` ON `e`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -903,7 +903,7 @@ LEFT JOIN ( WHERE `e0`.`Key1` < 5 ) AS `s0` ON `e`.`Id` = `s0`.`LeafId` WHERE `e`.`Discriminator` = 'EntityLeaf' -ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -979,7 +979,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1039,7 +1039,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1062,7 +1062,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs index 2fdc5c4e..b6e497b4 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs @@ -378,7 +378,7 @@ INNER JOIN ( WHERE `e0`.`Discriminator` = 'EntityLeaf' ) AS `e1` ON `j`.`LeafId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -396,7 +396,7 @@ LEFT JOIN ( INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` WHERE `e1`.`Discriminator` = 'EntityLeaf' ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -582,7 +582,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -609,7 +609,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -647,7 +647,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityRoot` AS `e0` INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -665,7 +665,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -732,7 +732,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -750,7 +750,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -853,7 +853,7 @@ LEFT JOIN ( WHERE `e2`.`Id` < 10 ) AS `s` ON `e1`.`Id` = `s`.`ThreeId` ) AS `s0` ON `e`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -903,7 +903,7 @@ LEFT JOIN ( WHERE `e0`.`Key1` < 5 ) AS `s0` ON `e`.`Id` = `s0`.`LeafId` WHERE `e`.`Discriminator` = 'EntityLeaf' -ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -979,7 +979,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1039,7 +1039,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1062,7 +1062,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -1812,6 +1812,99 @@ SELECT 1 """); } + #region Non-shared tests + + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT [u].[Id] AS [UserId], [s].[Id] AS [OrgId] +FROM [Users] AS [u] +CROSS JOIN ( + SELECT [o1].[Id] + FROM ( + SELECT 1 AS empty + ) AS [e] + LEFT JOIN ( + SELECT [o].[Id] + FROM [Organisations] AS [o] + WHERE EXISTS ( + SELECT 1 + FROM [OrganisationUser] AS [o0] + WHERE [o].[Id] = [o0].[OrganisationId]) + ) AS [o1] ON 1 = 1 +) AS [s] +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + + #endregion Non-shared tests + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs index 250e71f4..3852449e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs @@ -887,7 +887,7 @@ public override async Task OrderBy_client_Take(bool async) """ SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -ORDER BY 1, `e`.`EmployeeID` +ORDER BY 1 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs index 4014ee50..c743415a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs @@ -58,14 +58,14 @@ public override void Query_ending_with_include() SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -275,7 +275,7 @@ public override async Task Compiled_query_with_max_parameters() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -343,7 +343,7 @@ SELECT COUNT(*) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -746,7 +746,7 @@ public override void Query_with_single_parameter_with_include() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @customerID -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -756,7 +756,7 @@ public override void Query_with_single_parameter_with_include() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @customerID -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs index a6ef32cb..03195712 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs @@ -45,7 +45,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -62,7 +62,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -77,7 +77,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -91,7 +91,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -130,7 +130,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -228,7 +228,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -243,7 +243,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -294,7 +294,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -311,7 +311,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -348,7 +348,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -371,7 +371,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -464,7 +464,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -499,7 +499,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -514,7 +514,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -554,7 +554,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -632,7 +632,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -732,7 +732,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -780,7 +780,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -823,7 +823,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -841,7 +841,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -855,7 +855,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -892,7 +892,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -915,7 +915,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1035,7 +1035,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1209,7 +1209,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1225,7 +1225,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1309,7 +1309,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1498,7 +1498,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1570,7 +1570,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1586,7 +1586,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1684,7 +1684,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1727,7 +1727,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1773,7 +1773,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1819,7 +1819,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1865,7 +1865,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1997,7 +1997,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2079,7 +2079,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2096,7 +2096,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2135,7 +2135,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -2167,7 +2167,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -2196,7 +2196,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2210,7 +2210,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs index bcf38e1a..d62fffcd 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs @@ -136,7 +136,7 @@ public override async Task Order_by_length_twice_followed_by_projection_of_naked SELECT `c`.`CustomerID`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY LEN(`c`.`CustomerID`), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY LEN(`c`.`CustomerID`), `c`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs index a750dbaa..b01c6648 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs @@ -2505,7 +2505,7 @@ public override async Task GroupBy_select_grouping_list(bool async) GROUP BY `c`.`City` ) AS `c1` LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -2522,7 +2522,7 @@ public override async Task GroupBy_select_grouping_array(bool async) GROUP BY `c`.`City` ) AS `c1` LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -2543,7 +2543,7 @@ LEFT JOIN ( FROM `Customers` AS `c0` WHERE `c0`.`CustomerID` LIKE 'A%' ) AS `c2` ON `c1`.`City` = `c2`.`City` -ORDER BY `c1`.`City`, `c2`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -3620,7 +3620,7 @@ public override async Task GroupBy_selecting_grouping_key_list(bool async) GROUP BY `o`.`CustomerID` ) AS `o1` LEFT JOIN `Orders` AS `o0` ON `o1`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o1`.`CustomerID`, `o0`.`OrderID` +ORDER BY `o1`.`CustomerID` """); } @@ -3952,7 +3952,7 @@ GROUP BY `c`.`CustomerID` HAVING `c`.`CustomerID` LIKE 'F%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -3970,7 +3970,7 @@ GROUP BY `o`.`CustomerID` HAVING `o`.`CustomerID` LIKE 'F%' ) AS `o1` LEFT JOIN `Orders` AS `o0` ON `o1`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o1`.`CustomerID`, `o0`.`OrderID` +ORDER BY `o1`.`CustomerID` """); } @@ -4048,7 +4048,7 @@ public override async Task Final_GroupBy_property_entity(bool async) """ SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4062,7 +4062,7 @@ public override async Task Final_GroupBy_entity(bool async) FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` WHERE `o`.`OrderID` < 10500 -ORDER BY `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` """); } @@ -4075,7 +4075,7 @@ public override async Task Final_GroupBy_property_entity_non_nullable(bool async SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` FROM `Order Details` AS `o` WHERE `o`.`OrderID` < 10500 -ORDER BY `o`.`OrderID`, `o`.`ProductID` +ORDER BY `o`.`OrderID` """); } @@ -4087,7 +4087,7 @@ public override async Task Final_GroupBy_property_anonymous_type(bool async) """ SELECT `c`.`City`, `c`.`ContactName`, `c`.`ContactTitle` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4099,7 +4099,7 @@ public override async Task Final_GroupBy_multiple_properties_entity(bool async) """ SELECT `c`.`City`, `c`.`Region`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`Region`, `c`.`CustomerID` +ORDER BY `c`.`City`, `c`.`Region` """); } @@ -4114,7 +4114,7 @@ public override async Task Final_GroupBy_complex_key_entity(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, 1 AS `Constant` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`City`, `c0`.`Region`, `c0`.`Constant`, `c0`.`CustomerID` +ORDER BY `c0`.`City`, `c0`.`Region`, `c0`.`Constant` """); } @@ -4129,7 +4129,7 @@ public override async Task Final_GroupBy_nominal_type_entity(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, 1 AS `Constant` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`City`, `c0`.`Constant`, `c0`.`CustomerID` +ORDER BY `c0`.`City`, `c0`.`Constant` """); } @@ -4141,7 +4141,7 @@ public override async Task Final_GroupBy_property_anonymous_type_element_selecto """ SELECT `c`.`City`, `c`.`ContactName`, `c`.`ContactTitle` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4155,7 +4155,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection(bool FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4169,7 +4169,7 @@ public override async Task Final_GroupBy_property_entity_projecting_collection(b FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4187,7 +4187,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` < 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4227,7 +4227,7 @@ public override async Task Final_GroupBy_TagWith(bool async) SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs index 5cc5210f..c9aa6460 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs @@ -61,7 +61,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -104,7 +104,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -118,7 +118,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } @@ -422,7 +422,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -439,7 +439,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -513,7 +513,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -697,7 +697,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -758,7 +758,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -930,7 +930,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -947,7 +947,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -970,7 +970,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1076,7 +1076,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1090,7 +1090,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1178,7 +1178,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1218,7 +1218,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1345,7 +1345,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -1359,7 +1359,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1414,7 +1414,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -1437,7 +1437,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1472,7 +1472,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1553,7 +1553,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1598,7 +1598,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1669,7 +1669,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1732,7 +1732,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1775,7 +1775,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1844,7 +1844,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -1859,7 +1859,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -1874,7 +1874,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs index 3f281c27..f07fc971 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs @@ -38,7 +38,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -78,7 +78,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -95,7 +95,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -136,7 +136,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } } @@ -237,7 +237,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -255,7 +255,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -315,7 +315,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -329,7 +329,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -343,7 +343,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -360,7 +360,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -400,7 +400,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -449,7 +449,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -463,7 +463,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -477,7 +477,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -543,7 +543,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -558,7 +558,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -573,7 +573,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -749,7 +749,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -786,7 +786,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -908,7 +908,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } } @@ -944,7 +944,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } } @@ -980,7 +980,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } } @@ -1041,7 +1041,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1108,7 +1108,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -1200,7 +1200,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } @@ -1512,7 +1512,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1831,7 +1831,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1853,7 +1853,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1896,7 +1896,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1914,7 +1914,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -1943,7 +1943,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1959,7 +1959,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2005,7 +2005,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2020,7 +2020,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2037,7 +2037,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2073,7 +2073,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2103,7 +2103,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2120,7 +2120,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2136,7 +2136,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2152,7 +2152,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2170,7 +2170,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2215,7 +2215,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs index bd9bee76..06145479 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs @@ -360,7 +360,7 @@ public override async Task GroupJoin_simple_ordering(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`City`, `o`.`OrderID` +ORDER BY `c`.`City` """); } @@ -390,7 +390,7 @@ public override async Task GroupJoin_as_final_operator(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -404,7 +404,7 @@ public override async Task Unflattened_GroupJoin_composed(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE (`c`.`CustomerID` LIKE 'F%') AND `c`.`City` = 'Lisboa' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -423,7 +423,7 @@ INNER JOIN ( ) AS `c1` ON `c`.`CustomerID` = `c1`.`CustomerID`) LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -510,7 +510,7 @@ public override async Task GroupJoin_Where_OrderBy(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `o`.`CustomerID` = 'ALFKI' OR `c`.`CustomerID` = 'ANATR' -ORDER BY `c`.`City`, `o`.`OrderID` +ORDER BY `c`.`City` """); } @@ -803,7 +803,7 @@ INNER JOIN ( ) AS `o1` ON `o`.`OrderID` = `o1`.`OrderID` ) AS `s` ON `c`.`CustomerID` = `s`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `s`.`OrderID0`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `c`.`CustomerID`, `s`.`OrderID0`, `s`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index f65a675a..a0719cec 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -418,7 +418,7 @@ SELECT TOP 1 `o1`.`ProductID` WHERE `o`.`OrderID` = `o1`.`OrderID`) AS `c0` FROM `Orders` AS `o` ) AS `o4` -ORDER BY `o4`.`c` DESC, `o4`.`c0` DESC, `o4`.`OrderID` +ORDER BY `o4`.`c` DESC, `o4`.`c0` DESC """); } @@ -967,7 +967,7 @@ ORDER BY `e`.`EmployeeID` ORDER BY `o`.`OrderID` ) AS `o0` WHERE `e0`.`EmployeeID` = `o0`.`EmployeeID` -ORDER BY `e0`.`EmployeeID`, `o0`.`OrderID` +ORDER BY `e0`.`EmployeeID` """); } @@ -976,7 +976,7 @@ public override async Task Where_subquery_anon_nested(bool isAsync) await base.Where_subquery_anon_nested(isAsync); AssertSql( - """ + """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` @@ -994,7 +994,7 @@ ORDER BY `o`.`OrderID` ORDER BY `c`.`CustomerID` ) AS `c0` WHERE `e0`.`City` = 'Seattle' -ORDER BY `e0`.`EmployeeID`, `c0`.`CustomerID` +ORDER BY `e0`.`EmployeeID` """); } @@ -1038,10 +1038,10 @@ public override async Task OrderBy_arithmetic(bool isAsync) AssertSql( """ - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - ORDER BY `e`.`EmployeeID` - `e`.`EmployeeID`, `e`.`EmployeeID` - """); +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +ORDER BY `e`.`EmployeeID` - `e`.`EmployeeID` +"""); } public override async Task OrderBy_condition_comparison(bool isAsync) @@ -1138,7 +1138,7 @@ public override async Task Skip_Take(bool isAsync) await base.Skip_Take(isAsync); AssertSql( - """ + """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( SELECT TOP @p1 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` @@ -1149,7 +1149,7 @@ ORDER BY `c`.`ContactName` ) AS `c0` ORDER BY `c0`.`ContactName` DESC ) AS `c1` -ORDER BY `c1`.`ContactName`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactName` """); } @@ -2083,7 +2083,7 @@ public override async Task Where_orderby_join_select(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` <> 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2098,7 +2098,7 @@ public override async Task Where_join_orderby_join_select(bool isAsync) INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` WHERE (`c`.`CustomerID` <> 'ALFKI') AND (`o`.`OrderID` IS NOT NULL AND `o0`.`OrderID` IS NOT NULL) -ORDER BY `c`.`CustomerID`, `o0`.`ProductID` +ORDER BY `c`.`CustomerID` """); } @@ -2125,7 +2125,7 @@ public override async Task Where_orderby_select_many(bool isAsync) FROM `Customers` AS `c`, `Orders` AS `o` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2139,7 +2139,7 @@ public override async Task SelectMany_cartesian_product_with_ordering(bool isAsy FROM `Customers` AS `c`, `Employees` AS `e` WHERE `c`.`City` = `e`.`City` OR (`c`.`City` IS NULL AND `e`.`City` IS NULL) -ORDER BY `e`.`City`, `c`.`CustomerID` DESC, `e`.`EmployeeID` +ORDER BY `e`.`City`, `c`.`CustomerID` DESC """); } @@ -2275,7 +2275,7 @@ ORDER BY `c0`.`ContactName` ) AS `c1` ORDER BY `c1`.`ContactName` DESC ) AS `c2` -ORDER BY `c2`.`ContactName`, `c2`.`CustomerID` +ORDER BY `c2`.`ContactName` """); } @@ -2450,7 +2450,6 @@ public override async Task OrderBy_true(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2462,7 +2461,6 @@ public override async Task OrderBy_integer(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2474,7 +2472,6 @@ public override async Task OrderBy_parameter(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2552,7 +2549,7 @@ public override async Task OrderBy_multiple(bool isAsync) SELECT `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`Country`, `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`Country`, `c`.`City` """); } @@ -2684,7 +2681,7 @@ SELECT DISTINCT `o`.`CustomerID` WHERE `o`.`OrderID` < 10300 ) AS `o0` LEFT JOIN `Orders` AS `o1` ON `o0`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `o0`.`CustomerID`, `o1`.`OrderID` +ORDER BY `o0`.`CustomerID` """); } @@ -2792,7 +2789,7 @@ public override async Task Select_correlated_subquery_filtered(bool isAsync) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2972,7 +2969,7 @@ public override async Task OrderBy_conditional_operator_where_condition_false(bo """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -2984,7 +2981,7 @@ public override async Task OrderBy_comparison_operator(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY NOT (`c`.`Region` = 'ASK' AND `c`.`Region` IS NOT NULL), `c`.`CustomerID` +ORDER BY NOT (`c`.`Region` = 'ASK' AND `c`.`Region` IS NOT NULL) """); } @@ -3119,7 +3116,7 @@ public override async Task Selected_column_can_coalesce(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY IIF(`c`.`Region` IS NULL, 'ZZ', `c`.`Region`), `c`.`CustomerID` +ORDER BY IIF(`c`.`Region` IS NULL, 'ZZ', `c`.`Region`) """); } @@ -3661,7 +3658,7 @@ public override async Task OrderBy_skip_take(bool isAsync) ) AS `c0` ORDER BY `c0`.`ContactTitle` DESC, `c0`.`ContactName` DESC ) AS `c1` -ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName` """); } @@ -3705,7 +3702,7 @@ public override async Task OrderBy_skip_take_take(bool isAsync) ) AS `c1` ORDER BY `c1`.`ContactTitle` DESC, `c1`.`ContactName` DESC ) AS `c0` -ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName`, `c0`.`CustomerID` +ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName` """); } @@ -3733,7 +3730,7 @@ public override async Task OrderBy_skip_take_take_take_take(bool isAsync) ) AS `c1` ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName` ) AS `c2` -ORDER BY `c2`.`ContactTitle`, `c2`.`ContactName`, `c2`.`CustomerID` +ORDER BY `c2`.`ContactTitle`, `c2`.`ContactName` """); } @@ -3881,7 +3878,7 @@ public override async Task OrderBy_skip_take_distinct_orderby_take(bool isAsync) ORDER BY `c3`.`ContactTitle`, `c3`.`ContactName` ) AS `c0` ) AS `c1` -ORDER BY `c1`.`ContactTitle`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactTitle` """); } @@ -4098,12 +4095,12 @@ public override async Task Anonymous_complex_orderby(bool isAsync) AssertSql( """ -SELECT `c0`.`A`, `c0`.`CustomerID` +SELECT `c0`.`A` FROM ( - SELECT `c`.`CustomerID` & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `A`, `c`.`CustomerID` + SELECT `c`.`CustomerID` & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `A` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`A`, `c0`.`CustomerID` +ORDER BY `c0`.`A` """); } @@ -4112,8 +4109,8 @@ public override async Task Anonymous_subquery_orderby(bool isAsync) await base.Anonymous_subquery_orderby(isAsync); AssertSql( - """ -SELECT `c0`.`A`, `c0`.`c`, `c0`.`CustomerID` + """ +SELECT `c0`.`A`, `c0`.`c` FROM ( SELECT ( SELECT TOP 1 `o1`.`OrderDate` @@ -4123,14 +4120,14 @@ SELECT TOP 1 `o1`.`OrderDate` SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` WHERE `c`.`CustomerID` = `o0`.`CustomerID` - ORDER BY `o0`.`OrderID` DESC) AS `c`, `c`.`CustomerID` + ORDER BY `o0`.`OrderID` DESC) AS `c` FROM `Customers` AS `c` WHERE ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID`) > 1 ) AS `c0` -ORDER BY `c0`.`c`, `c0`.`CustomerID` +ORDER BY `c0`.`c` """); } @@ -4235,7 +4232,7 @@ public override async Task DTO_subquery_orderby(bool isAsync) AssertSql( """ -SELECT `c0`.`Property`, `c0`.`c`, `c0`.`CustomerID` +SELECT `c0`.`Property`, `c0`.`c` FROM ( SELECT ( SELECT TOP 1 `o1`.`OrderDate` @@ -4245,14 +4242,14 @@ SELECT TOP 1 `o1`.`OrderDate` SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` WHERE `c`.`CustomerID` = `o0`.`CustomerID` - ORDER BY `o0`.`OrderID` DESC) AS `c`, `c`.`CustomerID` + ORDER BY `o0`.`OrderID` DESC) AS `c` FROM `Customers` AS `c` WHERE ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID`) > 1 ) AS `c0` -ORDER BY `c0`.`c`, `c0`.`CustomerID` +ORDER BY `c0`.`c` """); } @@ -4274,7 +4271,7 @@ public override async Task Include_with_orderby_skip_preserves_ordering(bool isA ORDER BY `c0`.`City` DESC, `c0`.`CustomerID` DESC ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c1`.`City`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c1`.`City`, `c1`.`CustomerID` """); } @@ -4686,7 +4683,7 @@ public override async Task Comparing_entities_using_Equals(bool isAsync) FROM `Customers` AS `c`, `Customers` AS `c0` WHERE (`c`.`CustomerID` LIKE 'ALFKI%') AND `c`.`CustomerID` = `c0`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -4970,7 +4967,6 @@ public override async Task OrderBy_empty_list_contains(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -4982,7 +4978,6 @@ public override async Task OrderBy_empty_list_does_not_contains(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -6051,7 +6046,7 @@ SELECT DISTINCT `o0`.`CustomerID` FROM `Orders` AS `o0` ) AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o1`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -6275,7 +6270,7 @@ public override async Task OrderBy_Join(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -7136,7 +7131,7 @@ SELECT MAX(`o1`.`OrderDate`) WHERE `o`.`OrderID` IN (@ids1, @ids2) GROUP BY `o`.`Quantity` ) AS `o3` -ORDER BY `o3`.`MaxTimestamp`, `o3`.`Key` +ORDER BY `o3`.`MaxTimestamp` """); } @@ -7368,7 +7363,6 @@ public override async Task Cast_to_object_over_parameter_directly_in_lambda(bool """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -ORDER BY `o`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs index 27cc47ac..33c97dff 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs @@ -440,7 +440,7 @@ public override async Task Select_collection_navigation_simple(bool isAsync) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -470,7 +470,7 @@ public override async Task Select_collection_navigation_simple_followed_by_order FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -485,7 +485,7 @@ public override async Task Select_collection_navigation_multi_part(bool isAsync) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` = 'ALFKI' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -501,7 +501,7 @@ public override async Task Select_collection_navigation_multi_part2(bool isAsync LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o0`.`CustomerID` IN ('ALFKI', 'ANTON') -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs index a2975266..c6ede0bc 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs @@ -166,7 +166,7 @@ public override async Task Include_query_opt_out(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs index 1b30f412..345fe5d9 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs @@ -98,7 +98,7 @@ public override void Tag_on_include_query() ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs index f8b4b6aa..84f66f37 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs @@ -65,7 +65,7 @@ ORDER BY `o`.`OrderID` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` -ORDER BY `o0`.`OrderID`, `e0`.`EmployeeID` +ORDER BY `o0`.`OrderID` """); } @@ -89,7 +89,7 @@ public override async Task Projection_when_client_evald_subquery(bool isAsync) SELECT `c`.`CustomerID`, `o`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -166,7 +166,6 @@ public override async Task Select_bool_closure_with_order_parameter_with_cast_to SELECT CBOOL(@boolean) FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -1172,7 +1171,7 @@ public override async Task Anonymous_projection_with_repeated_property_being_ord SELECT `c`.`CustomerID` AS `A`, `o`.`CustomerID` AS `B` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` -ORDER BY `o`.`CustomerID`, `o`.`OrderID` +ORDER BY `o`.`CustomerID` """); } @@ -1508,7 +1507,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` > 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1526,7 +1525,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` > 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1581,7 +1580,7 @@ public override async Task Select_chained_entity_navigation_doesnt_materialize_i FROM (`Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1722,7 +1721,7 @@ public override async Task Collection_projection_AsNoTracking_OrderBy(bool async SELECT `c`.`CustomerID`, `o`.`OrderDate`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1864,7 +1863,7 @@ public override async Task Reverse_in_join_outer(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`City`, `c`.`CustomerID` DESC, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` DESC """); } @@ -1894,7 +1893,7 @@ public override async Task Reverse_in_join_inner(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1927,7 +1926,7 @@ public override async Task Reverse_in_SelectMany(bool async) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID` DESC, `o`.`OrderID` +ORDER BY `c`.`CustomerID` DESC """); } @@ -2020,7 +2019,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` AND `o`.`OrderID` < 11000) > 0 -ORDER BY `c`.`CustomerID`, `o1`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2047,7 +2046,7 @@ public override async Task Projecting_multiple_collection_with_same_constant_wor LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -2118,7 +2117,7 @@ public override async Task Projecting_count_of_navigation_which_is_generic_colle SELECT `c`.`CustomerID`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2500,7 +2499,7 @@ SELECT COUNT(*) WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2529,7 +2528,7 @@ public override async Task MemberInit_in_projection_without_arguments(bool async FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2584,7 +2583,7 @@ ORDER BY `o`.`OrderID` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` -ORDER BY `o0`.`OrderID`, `e0`.`EmployeeID` +ORDER BY `o0`.`OrderID` """); } @@ -2802,7 +2801,7 @@ SELECT TOP 1 `c`.`CustomerID` ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2819,7 +2818,7 @@ SELECT TOP 1 `c`.`CustomerID` ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs index 991021ef..7afe9b23 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs @@ -116,7 +116,7 @@ ORDER BY `u`.`ContactName` ) AS `u0` ORDER BY `u0`.`ContactName` DESC ) AS `u1` -ORDER BY `u1`.`ContactName`, `u1`.`CustomerID` +ORDER BY `u1`.`ContactName` """); } @@ -379,7 +379,7 @@ ORDER BY `u`.`Foo` ORDER BY `u1`.`Foo` DESC ) AS `u0` WHERE `u0`.`Foo` = 'Berlin' -ORDER BY `u0`.`Foo`, `u0`.`CustomerID` +ORDER BY `u0`.`Foo` """); } @@ -400,7 +400,7 @@ public override async Task Union_Include(bool isAsync) WHERE `c0`.`City` = 'London' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -421,7 +421,7 @@ public override async Task Include_Union(bool isAsync) WHERE `c0`.`City` = 'London' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1149,7 +1149,7 @@ public override async Task Collection_projection_after_set_operation(bool async) WHERE `c0`.`CustomerID` LIKE 'F%' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1189,7 +1189,7 @@ public override async Task Union_on_entity_with_correlated_collection(bool async WHERE `o0`.`OrderID` < 10250 ) AS `u` LEFT JOIN `Orders` AS `o1` ON `u`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o1`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1212,7 +1212,7 @@ public override async Task Union_on_entity_plus_other_column_with_correlated_col WHERE `o0`.`OrderID` < 10250 ) AS `u` LEFT JOIN `Orders` AS `o1` ON `u`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `u`.`CustomerID`, `u`.`OrderDate`, `o1`.`OrderID` +ORDER BY `u`.`CustomerID`, `u`.`OrderDate` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs index d8ebee06..cf2eebc6 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs @@ -218,7 +218,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -430,7 +430,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1260,7 +1260,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1318,7 +1318,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs index 1d61f6f3..f3130f61 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs @@ -1128,7 +1128,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -1260,7 +1260,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1293,7 +1293,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1326,7 +1326,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs index 6963baf8..29ccc44a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs @@ -46,7 +46,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -63,7 +63,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -78,7 +78,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -92,7 +92,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -131,7 +131,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -229,7 +229,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -244,7 +244,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -295,7 +295,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -312,7 +312,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -349,7 +349,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -372,7 +372,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -465,7 +465,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -500,7 +500,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -515,7 +515,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -555,7 +555,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -633,7 +633,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -726,7 +726,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -774,7 +774,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -817,7 +817,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -835,7 +835,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -849,7 +849,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -886,7 +886,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -909,7 +909,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1016,7 +1016,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1190,7 +1190,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1206,7 +1206,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1290,7 +1290,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1472,7 +1472,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1544,7 +1544,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1560,7 +1560,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1658,7 +1658,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1701,7 +1701,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1747,7 +1747,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1793,7 +1793,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1839,7 +1839,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1958,7 +1958,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2040,7 +2040,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2057,7 +2057,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2096,7 +2096,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -2128,7 +2128,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -2157,7 +2157,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2171,7 +2171,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs index 4d461da8..66e4d16f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs @@ -1438,20 +1438,20 @@ public override async Task Where_navigation_contains(bool isAsync) WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @entity_equality_customer_Orders_OrderID1='10643' -@entity_equality_customer_Orders_OrderID2='10692' -@entity_equality_customer_Orders_OrderID3='10702' +@entity_equality_customer_Orders_OrderID2='10952' +@entity_equality_customer_Orders_OrderID3='10692' @entity_equality_customer_Orders_OrderID4='10835' -@entity_equality_customer_Orders_OrderID5='10952' -@entity_equality_customer_Orders_OrderID6='11011' -@entity_equality_customer_Orders_OrderID7='11011' -@entity_equality_customer_Orders_OrderID8='11011' -@entity_equality_customer_Orders_OrderID9='11011' -@entity_equality_customer_Orders_OrderID10='11011' +@entity_equality_customer_Orders_OrderID5='11011' +@entity_equality_customer_Orders_OrderID6='10702' +@entity_equality_customer_Orders_OrderID7='10702' +@entity_equality_customer_Orders_OrderID8='10702' +@entity_equality_customer_Orders_OrderID9='10702' +@entity_equality_customer_Orders_OrderID10='10702' SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` FROM `Order Details` AS `o` @@ -1726,7 +1726,7 @@ public override async Task Where_Queryable_ToList_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1744,7 +1744,7 @@ public override async Task Where_Queryable_ToList_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1761,7 +1761,7 @@ public override async Task Where_Queryable_ToArray_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1779,7 +1779,7 @@ public override async Task Where_Queryable_ToArray_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1789,15 +1789,15 @@ public override async Task Where_Queryable_AsEnumerable_Count(bool async) AssertSql( """ - SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Customers` AS `c` - LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` - WHERE ( - SELECT COUNT(*) - FROM `Orders` AS `o` - WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 - ORDER BY `c`.`CustomerID`, `o0`.`OrderID` - """); +SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE ( + SELECT COUNT(*) + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 +ORDER BY `c`.`CustomerID` +"""); } public override async Task Where_Queryable_AsEnumerable_Contains(bool async) @@ -1814,7 +1814,7 @@ public override async Task Where_Queryable_AsEnumerable_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1836,7 +1836,7 @@ WHERE NOT (IIF('ALFKI' IN ( FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ))) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1846,15 +1846,15 @@ public override async Task Where_Queryable_ToList_Count_member(bool async) AssertSql( """ - SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Customers` AS `c` - LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` - WHERE ( - SELECT COUNT(*) - FROM `Orders` AS `o` - WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 - ORDER BY `c`.`CustomerID`, `o0`.`OrderID` - """); +SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE ( + SELECT COUNT(*) + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 +ORDER BY `c`.`CustomerID` +"""); } public override async Task Where_Queryable_ToArray_Length_member(bool async) @@ -1863,15 +1863,15 @@ public override async Task Where_Queryable_ToArray_Length_member(bool async) AssertSql( """ - SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Customers` AS `c` - LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` - WHERE ( - SELECT COUNT(*) - FROM `Orders` AS `o` - WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 - ORDER BY `c`.`CustomerID`, `o0`.`OrderID` - """); +SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE ( + SELECT COUNT(*) + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 +ORDER BY `c`.`CustomerID` +"""); } public override async Task Where_Queryable_conditional_not_null_check_with_Contains(bool async, bool withNull) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs index d1686aec..d63a644c 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs @@ -2675,7 +2675,7 @@ public override async Task Null_comparison_in_order_by_with_relational_nulls(boo """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -ORDER BY NOT (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL), NOT (`e`.`NullableIntB` <> 10 OR `e`.`NullableIntB` IS NULL), `e`.`Id` +ORDER BY NOT (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL), NOT (`e`.`NullableIntB` <> 10 OR `e`.`NullableIntB` IS NULL) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs index efdcd513..7ed066e1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs @@ -129,7 +129,7 @@ public override async Task Owned_reference_mapped_to_different_table_updated_cor LEFT JOIN `CustomerData` AS `c0` ON `c`.`Id` = `c0`.`CompanyId`) LEFT JOIN `SupplierData` AS `s` ON `c`.`Id` = `s`.`CompanyId` WHERE `c0`.`CompanyId` IS NOT NULL -ORDER BY `c`.`Id`, `s`.`CompanyId` +ORDER BY `c`.`Id` """); } @@ -145,7 +145,7 @@ public override async Task Owned_reference_mapped_to_different_table_nested_upda LEFT JOIN `IM_CustomerData` AS `i0` ON `i`.`OwnerId` = `i0`.`IntermediateOwnedEntityOwnerId`) LEFT JOIN `IM_SupplierData` AS `i1` ON `i`.`OwnerId` = `i1`.`IntermediateOwnedEntityOwnerId` WHERE `i0`.`IntermediateOwnedEntityOwnerId` IS NOT NULL -ORDER BY `o`.`Id`, `i1`.`IntermediateOwnedEntityOwnerId` +ORDER BY `o`.`Id` """); } @@ -157,7 +157,7 @@ public override async Task Owned_entity_with_all_null_properties_materializes_wh """ SELECT `r`.`Id`, `r`.`Buyer`, `r`.`Rot_ApartmentNo`, `r`.`Rot_ServiceType`, `r`.`Rut_Value` FROM `RotRutCases` AS `r` -ORDER BY `r`.`Buyer`, `r`.`Id` +ORDER BY `r`.`Buyer` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs index 0db5e47f..7bc27a88 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs @@ -356,7 +356,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg FROM (`OwnedPerson` AS `o` LEFT JOIN `Planet` AS `p` ON `o`.`PersonAddress_Country_PlanetId` = `p`.`Id`) LEFT JOIN `Moon` AS `m` ON `p`.`Id` = `m`.`PlanetId` -ORDER BY `o`.`Id`, `m`.`Id` +ORDER BY `o`.`Id` """); } @@ -400,7 +400,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg LEFT JOIN `Planet` AS `p` ON `o`.`PersonAddress_Country_PlanetId` = `p`.`Id`) LEFT JOIN `Star` AS `s` ON `p`.`StarId` = `s`.`Id`) LEFT JOIN `Element` AS `e` ON `s`.`Id` = `e`.`StarId` -ORDER BY `o`.`Id`, `e`.`Id` +ORDER BY `o`.`Id` """); } @@ -432,7 +432,7 @@ await base.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_ LEFT JOIN `Star` AS `s` ON `p`.`StarId` = `s`.`Id`) LEFT JOIN `Element` AS `e` ON `s`.`Id` = `e`.`StarId` WHERE `s`.`Name` = 'Sol' -ORDER BY `o`.`Id`, `e`.`Id` +ORDER BY `o`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs index c7b20220..82a71877 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs @@ -295,7 +295,7 @@ public override async Task OrderBy() """ SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -337,7 +337,7 @@ public override async Task Take_with_constant() """ SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -349,7 +349,7 @@ public override async Task Take_with_parameter() """ SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -385,7 +385,7 @@ public override async Task Include_single() FROM `Blogs` AS `b` LEFT JOIN `Posts` AS `p` ON `b`.`Id` = `p`.`BlogId` WHERE `b`.`Id` > 8 -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -416,7 +416,7 @@ public override async Task Final_GroupBy() """ SELECT `b`.`Name`, `b`.`Id`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs index b2c463e4..ac11e512 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs @@ -197,7 +197,7 @@ public override async Task Include_single_query() SELECT `b`.`Id`, `b`.`Name`, `p`.`Id`, `p`.`BlogId`, `p`.`Title` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -228,7 +228,7 @@ public override async Task Final_GroupBy() """ SELECT `b`.`Name`, `b`.`Id` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixture.cs deleted file mode 100644 index c94b8705..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetFixture.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -public class TPCInheritanceQueryJetFixture : TPCInheritanceQueryJetFixtureBase -{ -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetFixture.cs deleted file mode 100644 index d6fe0ef6..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetFixture.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.EntityFrameworkCore.Query; - -namespace EntityFrameworkCore.Jet.FunctionalTests.Query; - -public class TPTFiltersInheritanceQueryJetFixture : TPTInheritanceQueryJetFixture -{ - public override bool EnableFilters - => true; -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs index abc3433a..3abb557a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs @@ -293,12 +293,12 @@ public override async Task Truncate_project_and_order_by_it_twice() AssertSql( """ -SELECT `b0`.`A`, `b0`.`Id` +SELECT `b0`.`A` FROM ( - SELECT FIX(`b`.`Double`) AS `A`, `b`.`Id` + SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` ) AS `b0` -ORDER BY `b0`.`A`, `b0`.`Id` +ORDER BY `b0`.`A` """); } @@ -314,12 +314,12 @@ public override async Task Truncate_project_and_order_by_it_twice2() AssertSql( """ -SELECT `b0`.`A`, `b0`.`Id` +SELECT `b0`.`A` FROM ( - SELECT FIX(`b`.`Double`) AS `A`, `b`.`Id` + SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` ) AS `b0` -ORDER BY `b0`.`A` DESC, `b0`.`Id` +ORDER BY `b0`.`A` DESC """); } @@ -335,12 +335,12 @@ public override async Task Truncate_project_and_order_by_it_twice3() AssertSql( """ -SELECT `b0`.`A`, `b0`.`Id` +SELECT `b0`.`A` FROM ( - SELECT FIX(`b`.`Double`) AS `A`, `b`.`Id` + SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` ) AS `b0` -ORDER BY `b0`.`A` DESC, `b0`.`Id` +ORDER BY `b0`.`A` DESC """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs index af8e4eb7..e01685c0 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs @@ -22,9 +22,9 @@ protected override bool IsCaseSensitive #region Equals - public override async Task Equals() + public override async Task Instance_Equals() { - await base.Equals(); + await base.Instance_Equals(); AssertSql( """ @@ -1328,7 +1328,7 @@ public override async Task Join_over_non_nullable_column() GROUP BY `b`.`Int` ) AS `b1` LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` -ORDER BY `b1`.`Int`, `b0`.`Id` +ORDER BY `b1`.`Int` """); } @@ -1360,7 +1360,7 @@ public override async Task Join_with_predicate() await base.Join_with_predicate(); AssertSql( - """ + """ SELECT `b1`.`Int`, `b2`.`String`, `b2`.`Id` FROM ( SELECT `b`.`Int` @@ -1372,7 +1372,7 @@ LEFT JOIN ( FROM `BasicTypesEntities` AS `b0` WHERE LEN(`b0`.`String`) > 6 ) AS `b2` ON `b1`.`Int` = `b2`.`Int` -ORDER BY `b1`.`Int`, `b2`.`Id` +ORDER BY `b1`.`Int` """); } @@ -1428,7 +1428,7 @@ public override async Task Concat_aggregate() await base.Concat_aggregate(); AssertSql( - """ + """ SELECT `b1`.`Int`, `b0`.`String`, `b0`.`Id` FROM ( SELECT `b`.`Int` @@ -1436,7 +1436,7 @@ public override async Task Concat_aggregate() GROUP BY `b`.`Int` ) AS `b1` LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` -ORDER BY `b1`.`Int`, `b0`.`Id` +ORDER BY `b1`.`Int` """); } diff --git a/test/EFCore.Jet.Tests/Properties/AssemblyInfo.cs b/test/EFCore.Jet.Tests/Properties/AssemblyInfo.cs index 7058a4dd..b78b1d83 100644 --- a/test/EFCore.Jet.Tests/Properties/AssemblyInfo.cs +++ b/test/EFCore.Jet.Tests/Properties/AssemblyInfo.cs @@ -2,10 +2,12 @@ using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities.Xunit; using Xunit; +using Xunit.Sdk; +using Xunit.v3; #if FIXED_TEST_ORDER -[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: Parallelization(Mode = ParallelMode.None)] [assembly: TestCollectionOrderer(typeof(AscendingTestCollectionOrderer))] [assembly: TestCaseOrderer(typeof(AscendingTestCaseOrderer))] diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/AssemblyInfo.cs b/test/EFCore.LibRed.Extended.FunctionalTests/AssemblyInfo.cs index 34b3e624..81093f8c 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/AssemblyInfo.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/AssemblyInfo.cs @@ -1,6 +1,7 @@ -using Xunit; +using Xunit.Sdk; +using Xunit.v3; -// Runs in parallel (MaxParallelThreads = 0). Unlike EFCore.Jet.FunctionalTests — which must serialise because +// Runs in parallel (MaxThreads = 0). Unlike EFCore.Jet.FunctionalTests — which must serialise because // the ACE OLE DB provider crashes the host with 0xC0000005 under concurrent connections — LibRed uses no ACE // and isolates concurrent connections itself: a transaction's writes are buffered in a private per-connection // deferred-write overlay and published to the shared page cache only on commit (read-committed isolation), so @@ -12,6 +13,6 @@ // in-process, fully-managed engine — puts its whole working set (page caches, catalogs, query buffers) in the // same managed address space as EF and the test platform, unlike out-of-process/native providers (SQL Server, // ACE). Under this concurrency that overflows 32-bit; on x64 the full ~38k-test suite runs green in parallel. -[assembly: CollectionBehavior( - DisableTestParallelization = false, - MaxParallelThreads = 0)] +[assembly: Parallelization( + Mode = ParallelMode.Collections, + MaxThreads = 0)] diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/F1LibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/F1LibRedFixture.cs index 43483c3a..88208b5f 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/F1LibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/F1LibRedFixture.cs @@ -15,78 +15,7 @@ namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests { - public class F1LibRedFixture : F1LibRedFixtureBase - { - protected override void BuildModelExternal(ModelBuilder modelBuilder) - { - base.BuildModelExternal(modelBuilder); - - var converter = new BinaryVersionConverter(); - var comparer = new BinaryVersionComparer(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - } - - private class BinaryVersionConverter() : ValueConverter, byte[]>( - v => v == null ? null : v.ToArray(), - v => v == null ? null : v.ToList()); - - private class BinaryVersionComparer() : ValueComparer>( - (l, r) => (l == null && r == null) || (l != null && r != null && l.SequenceEqual(r)), - v => CalculateHashCode(v), - v => v == null ? null : v.ToList()) - { - private static int CalculateHashCode(List source) - { - if (source == null) - { - return 0; - } - - var hash = new HashCode(); - foreach (var el in source) - { - hash.Add(el); - } - - return hash.ToHashCode(); - } - } - } + public class F1LibRedFixture : F1LibRedFixtureBase; public abstract class F1LibRedFixtureBase : F1RelationalFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/LibRedComplianceTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/LibRedComplianceTest.cs index fe12e2a6..433eb411 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/LibRedComplianceTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/LibRedComplianceTest.cs @@ -28,8 +28,6 @@ public class LibRedComplianceTest : RelationalComplianceTestBase typeof(JsonQueryTestBase<>), typeof(JsonQueryRelationalTestBase<>), typeof(JsonUpdateTestBase<>), - typeof(AdHocJsonQueryRelationalTestBase), - typeof(AdHocJsonQueryTestBase), typeof(OwnedJsonBulkUpdateRelationalTestBase<>), typeof(OwnedJsonCollectionRelationalTestBase<>), typeof(OwnedJsonMiscellaneousRelationalTestBase<>), diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs index ec434e6c..c4491908 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs @@ -47,7 +47,7 @@ LEFT JOIN ( WHERE `e1`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId` """); } @@ -73,7 +73,7 @@ LEFT JOIN ( WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId` """); } @@ -135,7 +135,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } @@ -167,7 +167,7 @@ LEFT JOIN ( WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyLoadSqlServerTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyLoadSqlServerTest.cs index e3b67e2f..b3b07312 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyLoadSqlServerTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/ManyToManyLoadSqlServerTest.cs @@ -27,45 +27,25 @@ public override async Task Load_collection(EntityState state, QueryTrackingBehav await base.Load_collection(state, queryTrackingBehavior, async); AssertSql( - state == EntityState.Detached - ? """ - @p='3' - - SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` - FROM `EntityOnes` AS `e` - INNER JOIN ( - SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` - FROM `JoinOneToTwo` AS `j` - INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - ) AS `s` ON `e`.`Id` = `s`.`OneId` - LEFT JOIN ( - SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` - FROM `JoinOneToTwo` AS `j0` - INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = @p - ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` - WHERE `e`.`Id` = @p - ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` - """ - : """ - @p='3' - - SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId`, `s0`.`JoinOneToTwoExtraId`, `s0`.`Id`, `s0`.`Name` - FROM `EntityOnes` AS `e` - INNER JOIN ( - SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` - FROM `JoinOneToTwo` AS `j` - INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - ) AS `s` ON `e`.`Id` = `s`.`OneId` - LEFT JOIN ( - SELECT `j0`.`OneId`, `j0`.`TwoId`, `j0`.`JoinOneToTwoExtraId`, `e1`.`Id`, `e1`.`Name` - FROM `JoinOneToTwo` AS `j0` - INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = @p - ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` - WHERE `e`.`Id` = @p - ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` - """); + """ +@p='3' + +SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` +FROM `EntityOnes` AS `e` +INNER JOIN ( + SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` + FROM `JoinOneToTwo` AS `j` + INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` +) AS `s` ON `e`.`Id` = `s`.`OneId` +LEFT JOIN ( + SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` + FROM `JoinOneToTwo` AS `j0` + INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` + WHERE `e1`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`TwoId` +WHERE `e`.`Id` = @p +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId` +"""); } public override async Task Load_collection_using_Query_with_Include_for_inverse(bool async) @@ -90,7 +70,7 @@ LEFT JOIN ( WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId` """); } @@ -152,7 +132,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } @@ -184,7 +164,7 @@ LEFT JOIN ( WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs index d723318e..0437c018 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs @@ -42,7 +42,7 @@ LEFT JOIN ( FROM `Posts` AS `p` WHERE `p`.`Name` LIKE '%2%' ) AS `p0` ON `b`.`Id` = `p0`.`BlogId` -ORDER BY `b`.`Id`, `p0`.`Id` +ORDER BY `b`.`Id` """, // """ diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs deleted file mode 100644 index fe4db319..00000000 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; - -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; - -public class AdHocComplexTypeQueryLibRedTest(NonSharedFixture fixture) : AdHocComplexTypeQueryRelationalTestBase(fixture) -{ - public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() - { - await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); - - AssertSql( - """ -@entity_equality_container_Id='1' (Nullable = true) -@entity_equality_container_Containee1_Id='2' (Nullable = true) -@entity_equality_container_Containee2_Id='3' (Nullable = true) - -SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` -FROM `EntityType` AS `e` -WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id -"""); - } - - public override async Task Projecting_complex_property_does_not_auto_include_owned_types() - { - await base.Projecting_complex_property_does_not_auto_include_owned_types(); - - AssertSql( - """ -SELECT `e`.`Complex_Name`, `e`.`Complex_Number` -FROM `EntityType` AS `e` -"""); - } - - protected new TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; - - protected new void AssertSql(params string[] expected) - => TestSqlLoggerFactory.AssertBaseline(expected); - - protected override ITestStoreFactory NonSharedTestStoreFactory - => LibRedTestStoreFactory.Instance; -} diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs deleted file mode 100644 index 7628f00b..00000000 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs +++ /dev/null @@ -1,107 +0,0 @@ -using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; - -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; - -#nullable disable - -public class AdHocManyToManyQueryLibRedTest(NonSharedFixture fixture) : AdHocManyToManyQueryRelationalTestBase(fixture) -{ - protected override ITestStoreFactory NonSharedTestStoreFactory - => LibRedTestStoreFactory.Instance; - - public override async Task SelectMany_with_collection_selector_having_subquery() - { - await base.SelectMany_with_collection_selector_having_subquery(); - - AssertSql( - """ -SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` -FROM `Users` AS `u` -CROSS JOIN ( - SELECT `o1`.`Id` - FROM ( - SELECT 1 - ) AS `e` - LEFT JOIN ( - SELECT `o`.`Id` - FROM `Organisations` AS `o` - WHERE EXISTS ( - SELECT 1 - FROM `OrganisationUser` AS `o0` - WHERE `o`.`Id` = `o0`.`OrganisationId`) - ) AS `o1` ON TRUE -) AS `s` -"""); - } - - public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) - { - await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); - - AssertSql( - """ -@p='1' - -SELECT TOP 1 `m`.`Id` -FROM `ManyM_DB` AS `m` -WHERE `m`.`Id` = @p -""", - // - """ -@p='1' - -SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` -FROM `ManyM_DB` AS `m` -INNER JOIN ( - SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` - FROM `ManyMN_DB` AS `m0` - LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` -) AS `s` ON `m`.`Id` = `s`.`ManyM_Id` -LEFT JOIN ( - SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` - FROM `ManyMN_DB` AS `m2` - INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @p -) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` -WHERE `m`.`Id` = @p -ORDER BY `m`.`Id`, `s`.`Id0`, `s0`.`Id` -""", - // - """ -@p='1' - -SELECT TOP 1 `m`.`Id` -FROM `ManyN_DB` AS `m` -WHERE `m`.`Id` = @p -""", - // - """ -@p='1' - -SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` -FROM `ManyN_DB` AS `m` -INNER JOIN ( - SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` - FROM `ManyMN_DB` AS `m0` - INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` -) AS `s` ON `m`.`Id` = `s`.`ManyN_Id` -LEFT JOIN ( - SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` - FROM `ManyMN_DB` AS `m2` - INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @p -) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` -WHERE `m`.`Id` = @p -ORDER BY `m`.`Id`, `s`.`Id0`, `s0`.`Id` -"""); - } - - [Fact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs index 7133f39d..46758588 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs @@ -2001,7 +2001,7 @@ SELECT DISTINCT `i`.`Parcel` HAVING COUNT(*) = 1 ) AS `i0` ON `t`.`ParcelNumber` = `i0`.`Parcel` WHERE `t`.`TableId` = 123 -ORDER BY `t`.`ParcelNumber`, `i0`.`Parcel` +ORDER BY `t`.`ParcelNumber` """); } @@ -2133,7 +2133,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2150,7 +2150,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2167,7 +2167,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2184,7 +2184,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2218,7 +2218,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2235,7 +2235,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2270,7 +2270,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2287,7 +2287,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2304,7 +2304,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2321,7 +2321,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2338,7 +2338,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2355,7 +2355,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2372,7 +2372,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2389,7 +2389,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2406,7 +2406,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2476,7 +2476,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2513,7 +2513,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2534,7 +2534,7 @@ GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s1` INNER JOIN `Statuses` AS `s0` ON `s1`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `s1`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2558,7 +2558,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2575,7 +2575,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2599,7 +2599,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2616,7 +2616,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2634,7 +2634,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2647,7 +2647,7 @@ public override async Task Plain_inner_no_aggregate_LeftJoin_whole_object() SELECT `s`.`PickupStatusId`, `r`.`PickupStatusId`, 1 AS `Count` FROM `Statuses` AS `s` LEFT JOIN `Requests` AS `r` ON `s`.`PickupStatusId` = `r`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r`.`Id` +ORDER BY `s`.`PickupStatusId` """); } @@ -2694,7 +2694,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2871,7 +2871,7 @@ LEFT JOIN ( FROM `Requests` AS `r1` GROUP BY `r1`.`PickupStatusId` ) AS `r2` ON `s`.`PickupStatusId` = `r2`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r2`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2890,7 +2890,7 @@ GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` INNER JOIN `Statuses` AS `s1` ON `s0`.`PickupStatusId` = `s1`.`PickupStatusId` -ORDER BY `s1`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s1`.`PickupStatusId` """); } @@ -2908,7 +2908,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2946,7 +2946,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs index 296c13a1..84db8769 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs @@ -44,35 +44,35 @@ public virtual async Task Nested_include_queries_do_not_populate_navigation_twic SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -131,7 +131,7 @@ LEFT JOIN ( FROM `Children` AS `c` LEFT JOIN `Children` AS `c0` ON `c`.`Id` = `c0`.`SelfReferenceBackNavigationId` ) AS `s` ON `p`.`Id` = `s`.`ParentBackNavigationId` -ORDER BY `p`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `p`.`Id`, `s`.`Id` """, // """ @@ -165,28 +165,28 @@ public override async Task Customer_collections_materialize_properly() SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId1` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId2` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId3` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId4` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """); } @@ -219,7 +219,7 @@ LEFT JOIN ( WHERE `p0`.`Discriminator` = 'PersonKid9038' ) AS `s` ON `p`.`Id` = `s`.`TeacherId` WHERE `p`.`Discriminator` = 'PersonTeacher9038' -ORDER BY `p`.`Id`, `s`.`Id`, `s`.`Id1` +ORDER BY `p`.`Id`, `s`.`Id` """, // """ @@ -233,7 +233,7 @@ LEFT JOIN ( WHERE `p1`.`Discriminator` = 'PersonKid9038' ) AS `p2` ON `p`.`Id` = `p2`.`TeacherId` WHERE `p`.`Discriminator` = 'PersonTeacher9038' -ORDER BY `p`.`Id`, `p0`.`Id`, `p2`.`Id` +ORDER BY `p`.`Id`, `p0`.`Id` """); } @@ -246,14 +246,14 @@ public override async Task Include_with_order_by_on_interface_key() SELECT `p`.`Id`, `p`.`Name`, `c`.`Id`, `c`.`Name`, `c`.`Parent10635Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Children` AS `c` ON `p`.`Id` = `c`.`Parent10635Id` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ SELECT `p`.`Id`, `c`.`Id`, `c`.`Name`, `c`.`Parent10635Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Children` AS `c` ON `p`.`Id` = `c`.`Parent10635Id` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """); } @@ -268,7 +268,7 @@ public override async Task Collection_without_setter_materialized_correctly() LEFT JOIN `Posts` AS `p` ON `b`.`Id` = `p`.`BlogId1` LEFT JOIN `Posts` AS `p0` ON `b`.`Id` = `p0`.`BlogId2` LEFT JOIN `Posts` AS `p1` ON `b`.`Id` = `p1`.`BlogId3` -ORDER BY `b`.`Id`, `p`.`Id`, `p0`.`Id`, `p1`.`Id` +ORDER BY `b`.`Id`, `p`.`Id`, `p0`.`Id` """, // """ @@ -307,14 +307,14 @@ public override async Task Include_collection_works_when_defined_on_intermediate SELECT `s`.`Id`, `s`.`Discriminator`, `s0`.`Id`, `s0`.`SchoolId` FROM `Schools` AS `s` LEFT JOIN `Students` AS `s0` ON `s`.`Id` = `s0`.`SchoolId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """, // """ SELECT `s`.`Id`, `s0`.`Id`, `s0`.`SchoolId` FROM `Schools` AS `s` LEFT JOIN `Students` AS `s0` ON `s`.`Id` = `s0`.`SchoolId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """); } @@ -339,7 +339,7 @@ SELECT TOP 1 `c1`.`Id` FROM `CompetitionSeasons` AS `c1` WHERE `c1`.`StartDate` <= `a`.`DateTime` AND `a`.`DateTime` < `c1`.`EndDate`) ) AS `s` -ORDER BY `a`.`Id`, `s`.`Id` +ORDER BY `a`.`Id` """, // """ @@ -368,7 +368,7 @@ public override async Task Include_collection_with_OfType_base() SELECT `e`.`Id`, `e`.`Name`, `d`.`Id`, `d`.`Device`, `d`.`EmployeeId` FROM `Employees` AS `e` LEFT JOIN `Devices` AS `d` ON `e`.`Id` = `d`.`EmployeeId` -ORDER BY `e`.`Id`, `d`.`Id` +ORDER BY `e`.`Id` """, // """ @@ -379,7 +379,7 @@ LEFT JOIN ( FROM `Devices` AS `d` WHERE `d`.`Device` <> 'foo' OR `d`.`Device` IS NULL ) AS `d0` ON `e`.`Id` = `d0`.`EmployeeId` -ORDER BY `e`.`Id`, `d0`.`Id` +ORDER BY `e`.`Id` """); } @@ -392,7 +392,7 @@ public override async Task Correlated_collection_correctly_associates_entities_w SELECT `b`.`Name`, `c`.`Id` FROM `Blogs` AS `b` LEFT JOIN `Comments` AS `c` ON `b`.`Name` = `c`.`BlogName` -ORDER BY `b`.`Name`, `c`.`Id` +ORDER BY `b`.`Name` """); } @@ -434,7 +434,7 @@ OUTER APPLY ( ) AS `s` WHERE `o0`.`Id` = `i`.`OrderId` ) AS `s0` -ORDER BY `o0`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id00` +ORDER BY `o0`.`Id`, `s0`.`Id`, `s0`.`Id0` """); } @@ -533,7 +533,7 @@ ORDER BY `e`.`Id` SELECT `e`.`Id`, `o`.`Id`, `o`.`AppEntityId` FROM `Entities` AS `e` LEFT JOIN `OtherEntity` AS `o` ON `e`.`Id` = `o`.`AppEntityId` -ORDER BY `e`.`Id`, `o`.`Id` +ORDER BY `e`.`Id` """); } } @@ -559,7 +559,7 @@ public override async Task Cycles_in_auto_include() SELECT `p`.`Id`, `d`.`Id`, `d`.`PrincipalId` FROM `PrincipalOneToMany` AS `p` LEFT JOIN `DependentOneToMany` AS `d` ON `p`.`Id` = `d`.`PrincipalId` -ORDER BY `p`.`Id`, `d`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -567,7 +567,7 @@ public override async Task Cycles_in_auto_include() FROM `DependentOneToMany` AS `d` INNER JOIN `PrincipalOneToMany` AS `p` ON `d`.`PrincipalId` = `p`.`Id` LEFT JOIN `DependentOneToMany` AS `d0` ON `p`.`Id` = `d0`.`PrincipalId` -ORDER BY `d`.`Id`, `d0`.`Id` +ORDER BY `d`.`Id` """, // """ @@ -624,7 +624,7 @@ LEFT JOIN ( FROM `ManyDependent` AS `m0` LEFT JOIN `SingleDependent` AS `s` ON `m0`.`Id` = `s`.`ManyDependentId` ) AS `s0` ON `p`.`Id` = `s0`.`PrincipalId` -ORDER BY `m`.`Id`, `s0`.`Id` +ORDER BY `m`.`Id` """); } @@ -663,7 +663,7 @@ OUTER APPLY ( INNER JOIN `MovieEntity` AS `m2` ON `m1`.`MovieId` = `m2`.`Id` WHERE `s`.`Id1` IS NOT NULL AND `s`.`Id1` = `m1`.`DirectorId` ) AS `u` -ORDER BY `s`.`Id`, `p0`.`Id`, `u`.`Id` +ORDER BY `s`.`Id`, `p0`.`Id` """); } @@ -691,7 +691,7 @@ public override async Task Filtered_collection_through_optional_navigation_does_ FROM `People` AS `p` LEFT JOIN `Employers` AS `e` ON `p`.`EmployerId` = `e`.`EmployerId` LEFT JOIN `People` AS `p0` ON `e`.`EmployerId` IS NOT NULL AND `e`.`EmployerId` = `p0`.`EmployerId` AND `p`.`PersonId` <> `p0`.`PersonId` -ORDER BY `p`.`PersonId`, `p0`.`PersonId` +ORDER BY `p`.`PersonId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs index 91daf853..fe4d18a1 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs @@ -67,7 +67,7 @@ public override async Task Can_configure_SingleQuery_at_context_level() SELECT `p`.`Id`, `c`.`Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -88,7 +88,7 @@ ORDER BY `p`.`Id` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` LEFT JOIN `AnotherChild` AS `a` ON `p`.`Id` = `a`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id`, `a`.`Id` +ORDER BY `p`.`Id`, `c`.`Id` """); } @@ -114,7 +114,7 @@ ORDER BY `p`.`Id` SELECT `p`.`Id`, `c`.`Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -174,7 +174,7 @@ public override async Task Using_AsSingleQuery_without_context_configuration_doe FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` LEFT JOIN `AnotherChild` AS `a` ON `p`.`Id` = `a`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id`, `a`.`Id` +ORDER BY `p`.`Id`, `c`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs index 35a2477e..0cc8c494 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId`) = 2 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -67,7 +67,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Int` <> 8) = 2 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -100,7 +100,7 @@ LEFT JOIN ( WHERE `r`.`Id` = `a`.`CollectionRootId` ORDER BY `a`.`Id` OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -136,7 +136,7 @@ SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` ) AS `a0`) = 2 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -159,7 +159,7 @@ OUTER APPLY ( INNER JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`Id` = `n1`.`CollectionAssociateId` ) AS `s` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `r`.`Id`, `s`.`Id` """); } @@ -250,7 +250,7 @@ SELECT COALESCE(SUM(`a`.`Int`), 0) WHERE `r`.`Id` = `a`.`CollectionRootId` GROUP BY `a`.`String` ) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs index 72295d4d..64eff314 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs @@ -31,7 +31,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -58,7 +58,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -85,7 +85,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -112,7 +112,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -139,7 +139,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -166,7 +166,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -193,7 +193,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -220,7 +220,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -247,7 +247,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs index ac28899a..0aee312f 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Int` = 8 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -64,7 +64,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Int` = 8 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -92,7 +92,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `n`.`Int` = 8 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -123,7 +123,7 @@ LEFT JOIN ( ) AS `s` ON `m`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `m`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `m`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs index 4c45d7cf..adc88131 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs @@ -33,7 +33,7 @@ LEFT JOIN ( ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -103,7 +103,7 @@ public override async Task Select_associate(QueryTrackingBehavior queryTrackingB LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -119,7 +119,7 @@ public override async Task Select_optional_associate(QueryTrackingBehavior query LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -188,7 +188,7 @@ public override async Task Select_required_associate_via_optional_navigation(Que LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -204,7 +204,7 @@ public override async Task Select_unmapped_associate_scalar_property(QueryTracki LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -239,7 +239,7 @@ LEFT JOIN ( INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `r`.`Id`, `s`.`Id` """); } @@ -253,7 +253,7 @@ public override async Task Select_nested_collection_on_required_associate(QueryT FROM `RootEntity` AS `r` INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id` LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`Id` = `n`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n`.`Id` +ORDER BY `r`.`Id` """); } @@ -267,7 +267,7 @@ public override async Task Select_nested_collection_on_optional_associate(QueryT FROM `RootEntity` AS `r` LEFT JOIN `AssociateType` AS `a` ON `r`.`OptionalAssociateId` = `a`.`Id` LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`Id` = `n`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n`.`Id` +ORDER BY `r`.`Id` """); } @@ -283,7 +283,7 @@ public override async Task SelectMany_associate_collection(QueryTrackingBehavior LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `a`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id`, `a`.`Id` """); } @@ -349,7 +349,7 @@ LEFT JOIN ( ) AS `s0` ON `r`.`Id` = `s0`.`CollectionRootId` LEFT JOIN `NestedAssociateType` AS `n11` ON `a`.`Id` = `n11`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n12` ON `a0`.`Id` = `n12`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `n11`.`Id`, `n12`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `n11`.`Id` """); } @@ -366,7 +366,7 @@ public override async Task Select_required_associate_duplicated(QueryTrackingBeh INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n2` ON `a`.`Id` = `n2`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id`, `n2`.`Id` +ORDER BY `r`.`Id`, `n1`.`Id` """); } @@ -386,7 +386,7 @@ public override async Task Select_required_associate_and_optional_associate(Quer LEFT JOIN `NestedAssociateType` AS `n2` ON `a0`.`RequiredNestedAssociateId` = `n2`.`Id` LEFT JOIN `NestedAssociateType` AS `n3` ON `a`.`Id` = `n3`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n4` ON `a0`.`Id` = `n4`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n3`.`Id`, `n4`.`Id` +ORDER BY `r`.`Id`, `n3`.`Id` """); } @@ -403,7 +403,7 @@ public override async Task Select_optional_associate_and_ints(QueryTrackingBehav LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -419,7 +419,7 @@ public override async Task Select_associate_and_target_to_index_based_binding_vi LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id` INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -447,7 +447,7 @@ LEFT JOIN ( INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id` LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` ) AS `s` ON `r1`.`Id` = `s`.`CollectionRootId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `r`.`Id`, `s`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs index aee56105..951c384b 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs @@ -34,7 +34,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Id` = `a0`.`Id` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -62,7 +62,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `n`.`Id` = `n0`.`Id` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -90,7 +90,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Id` <> `a0`.`Id` OR `a0`.`Id` IS NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -118,7 +118,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Id` IS NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -146,7 +146,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Id` IS NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -174,7 +174,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `n`.`Id` IS NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -202,7 +202,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `n`.`Id` = 1000 -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -232,7 +232,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `n`.`Id` = @entity_equality_nested_Id -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -260,7 +260,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId` LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE `a`.`Id` = `a0`.`Id` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -307,7 +307,7 @@ WHERE EXISTS ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = 1002) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -340,7 +340,7 @@ WHERE EXISTS ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = @entity_equality_nested_Id) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -374,7 +374,7 @@ WHERE EXISTS ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Int` > @get_Item_Int AND `n`.`Id` = @entity_equality_get_Item_Id) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -408,7 +408,7 @@ WHERE EXISTS ( SELECT 1 FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Id` > @get_Item_Id AND `a`.`Id` = @entity_equality_get_Item_Id) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs index 22917c5b..447af6fd 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs @@ -46,7 +46,7 @@ SELECT 1 FROM `RelatedCollection` AS `r1` WHERE `r`.`Id` = `r1`.`RootEntityId` AND `r1`.`String` = 'foo' ) AS `u`) = 4 -ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`RootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`RootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId`, `r9`.`Id` """); } @@ -111,7 +111,7 @@ SELECT 1 FROM `RequiredRelated_NestedCollection` AS `r2` WHERE `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId` AND `r2`.`String` = 'foo' ) AS `u`) = 4 -ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId`, `r9`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs index 7bd51ecb..689cc89a 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs @@ -37,7 +37,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -61,7 +61,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id1` +ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0` """); } @@ -80,7 +80,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -99,7 +99,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l2` LEFT JOIN `LevelOne` AS `l3` ON `l2`.`OneToOne_Optional_Self1Id` = `l3`.`Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Self_Inverse1Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -113,7 +113,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -127,7 +127,7 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -144,7 +144,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -160,7 +160,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy ORDER BY CASE WHEN `l`.`Name` LIKE '%03' THEN 1 ELSE 2 -END, `l`.`Id`, `l0`.`Id` +END, `l`.`Id` """); } @@ -179,7 +179,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -198,7 +198,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Required_Inverse3Id` WHERE `l0`.`Name` <> 'L2 09' OR `l0`.`Name` IS NULL -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -221,7 +221,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`Level1_Required_Id` LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Required_Inverse3Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l2`.`Id`, `l3`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id`, `l2`.`Id` """); } @@ -245,7 +245,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN `LevelTwo` AS `l2` ON `l1`.`Id` = `l2`.`Level1_Required_Id` LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` LEFT JOIN `LevelThree` AS `l4` ON `l2`.`Id` = `l4`.`OneToMany_Required_Inverse3Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id`, `l4`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id` """); } @@ -268,7 +268,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`Level2_Required_Id` LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id` """); } @@ -287,7 +287,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b LEFT JOIN `LevelThree` AS `l4` ON `l3`.`Id` = `l4`.`Level2_Optional_Id` LEFT JOIN `LevelThree` AS `l5` ON `l0`.`Id` = `l5`.`OneToMany_Optional_Inverse3Id` WHERE `l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL -ORDER BY `l`.`Id`, `l5`.`Id` +ORDER BY `l`.`Id` """); } @@ -301,7 +301,7 @@ public override async Task SelectMany_with_Include1(bool async) FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -315,7 +315,7 @@ public override async Task Orderby_SelectMany_with_Include1(bool async) FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -343,7 +343,7 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -359,7 +359,7 @@ public override async Task Multiple_SelectMany_with_Include(bool async) INNER JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` LEFT JOIN `LevelFour` AS `l3` ON `l1`.`Id` = `l3`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -404,7 +404,7 @@ LEFT JOIN ( FROM `LevelThree` AS `l1` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -418,7 +418,7 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id` """); } @@ -432,7 +432,7 @@ public override async Task Optional_navigation_with_Include_and_order(bool async FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id` """); } @@ -446,7 +446,7 @@ public override async Task SelectMany_with_order_by_and_Include(bool async) FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -460,7 +460,7 @@ public override async Task SelectMany_with_Include_and_order_by(bool async) FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -477,7 +477,7 @@ INNER JOIN ( FROM `LevelTwo` AS `l0` ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -494,7 +494,7 @@ INNER JOIN ( FROM `LevelTwo` AS `l0` ) AS `l1` ON `l`.`Id` = `l1`.`FK` LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -548,7 +548,7 @@ public override async Task Project_collection_navigation(bool async) SELECT `l`.`Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -562,7 +562,7 @@ public override async Task Project_collection_navigation_nested(bool async) FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -576,7 +576,7 @@ public override async Task Project_collection_navigation_using_ef_property(bool FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -590,7 +590,7 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -608,7 +608,7 @@ LEFT JOIN ( WHERE `l0`.`Name` <> 'Foo' OR `l0`.`Name` IS NULL ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` WHERE `l`.`Id` < 3 -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -621,7 +621,7 @@ public override async Task Project_collection_and_root_entity(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -635,7 +635,7 @@ public override async Task Project_collection_and_include(bool async) FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -649,7 +649,7 @@ public override async Task Project_navigation_and_collection(bool async) FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -668,7 +668,7 @@ OUTER APPLY ( WHERE `l0`.`Id` > 0 ) AS `s` WHERE `l`.`Id` < 3 -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -681,7 +681,7 @@ public override async Task Include_collection_with_multiple_orderbys_member(bool SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Level1_Required_Id`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Name`, `l`.`Level1_Required_Id`, `l`.`Id` """); } @@ -694,7 +694,7 @@ public override async Task Include_collection_with_multiple_orderbys_property(bo SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -707,7 +707,7 @@ public override async Task Include_collection_with_multiple_orderbys_methodcall( SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY ABS(`l`.`Level1_Required_Id`), `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY ABS(`l`.`Level1_Required_Id`), `l`.`Name`, `l`.`Id` """); } @@ -720,7 +720,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex(boo SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY ABS(`l`.`Level1_Required_Id`) + 7, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY ABS(`l`.`Level1_Required_Id`) + 7, `l`.`Name`, `l`.`Id` """); } @@ -733,7 +733,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex_rep SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -758,7 +758,7 @@ LEFT JOIN ( WHERE `l3`.`row` <= 1 ) AS `l4` ON `l2`.`Name` = `l4`.`Name` LEFT JOIN `LevelTwo` AS `l1` ON `l4`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l2`.`Name`, `l1`.`Id` +ORDER BY `l2`.`Name` """); } @@ -785,7 +785,7 @@ LEFT JOIN ( WHERE `l3`.`row` <= 1 ) AS `l4` ON `l2`.`Name` = `l4`.`Name` LEFT JOIN `LevelTwo` AS `l1` ON `l4`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l2`.`Name`, `l1`.`Id` +ORDER BY `l2`.`Name` """); } @@ -811,7 +811,7 @@ LEFT JOIN ( WHERE `l3`.`row` <= 1 ) AS `l4` ON `l2`.`Name` = `l4`.`Name` LEFT JOIN `LevelTwo` AS `l1` ON `l4`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l2`.`Name`, `l1`.`Id` +ORDER BY `l2`.`Name` """); } @@ -825,7 +825,7 @@ public override async Task Include_reference_collection_order_by_reference_navig FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Id`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Id`, `l`.`Id` """); } @@ -839,7 +839,7 @@ public override async Task Include_after_SelectMany(bool async) FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Required_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -855,7 +855,7 @@ public override async Task Include_after_multiple_SelectMany_and_reference_navig INNER JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Required_Self_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -871,7 +871,7 @@ public override async Task Include_after_SelectMany_and_multiple_reference_navig LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Self_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -888,7 +888,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -905,7 +905,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -919,7 +919,7 @@ public override async Task SelectMany_navigation_property_followed_by_select_col FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -934,7 +934,7 @@ public override async Task Multiple_SelectMany_navigation_property_followed_by_s INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` INNER JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -949,7 +949,7 @@ public override async Task SelectMany_navigation_property_with_include_and_follo INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Required_Inverse3Id` LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -962,7 +962,7 @@ public override async Task Include_collection(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -979,7 +979,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -993,7 +993,7 @@ public override async Task Include_reference_followed_by_include_collection(bool FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1006,7 +1006,7 @@ public override async Task Include_collection_followed_by_projecting_the_include SELECT `l`.`Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -1023,7 +1023,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1041,7 +1041,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1059,7 +1059,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1079,7 +1079,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`Level2_Optional_Id` LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id3` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1099,7 +1099,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`Level2_Optional_Id` LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id3` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1117,7 +1117,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id1` +ORDER BY `l`.`Id` """); } @@ -1139,7 +1139,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s0`.`Id` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1162,7 +1162,7 @@ SELECT COUNT(*) FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` WHERE `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` AND (`l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL)) > 0 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1188,7 +1188,7 @@ LEFT JOIN ( WHERE `l3`.`row` <= 1 ) AS `l4` ON `l2`.`Id` = `l4`.`OneToMany_Required_Inverse2Id` LEFT JOIN `LevelTwo` AS `l1` ON `l2`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l2`.`Id`, `l1`.`Id` +ORDER BY `l2`.`Id` """); } @@ -1203,7 +1203,7 @@ public override async Task Including_reference_navigation_and_projecting_collect LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -1224,7 +1224,7 @@ SELECT CASE LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Required_Inverse3Id` WHERE `l`.`Name` IN (@validIds1, @validIds2) -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1287,7 +1287,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` WHERE `l0`.`Id` > 5 ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1300,7 +1300,7 @@ public override async Task Filtered_include_OrderBy(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Name`, `l0`.`Id` +ORDER BY `l`.`Id`, `l0`.`Name` """); } @@ -1317,7 +1317,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Name0`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Name0` """); } @@ -1334,7 +1334,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`Name0` DESC, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`Name0` DESC """); } @@ -1354,7 +1354,7 @@ LEFT JOIN ( ) AS `l1` WHERE `l1`.`row` <= 3 ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name`, `l2`.`Id` +ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name` """); } @@ -1374,7 +1374,7 @@ LEFT JOIN ( ) AS `l1` WHERE 1 < `l1`.`row` ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name`, `l2`.`Id` +ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name` """); } @@ -1394,7 +1394,7 @@ LEFT JOIN ( ) AS `l1` WHERE 1 < `l1`.`row` AND `l1`.`row` <= 4 ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name`, `l2`.`Id` +ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name` """); } @@ -1414,7 +1414,7 @@ LEFT JOIN ( ) AS `l1` WHERE 1 < `l1`.`row` ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -1434,7 +1434,7 @@ LEFT JOIN ( ) AS `l1` WHERE `l1`.`row` <= 1 ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -1456,7 +1456,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` AND `l2`.`row` <= 4 ) AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse3Id`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse3Id`, `l3`.`Name` """); } @@ -1478,7 +1478,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` AND `l2`.`row` <= 4 ) AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse3Id`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse3Id`, `l3`.`Name` """); } @@ -1508,7 +1508,7 @@ LEFT JOIN ( ) AS `l4` WHERE 1 < `l4`.`row` ) AS `l5` ON `l`.`Id` = `l5`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse2Id`, `l3`.`Name`, `l3`.`Id`, `l5`.`OneToMany_Required_Inverse2Id`, `l5`.`Name` DESC, `l5`.`Id` +ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse2Id`, `l3`.`Name`, `l3`.`Id`, `l5`.`OneToMany_Required_Inverse2Id`, `l5`.`Name` DESC """); } @@ -1538,7 +1538,7 @@ LEFT JOIN ( WHERE 1 < `l3`.`row` ) AS `l4` ON `l2`.`Id` = `l4`.`OneToMany_Required_Inverse3Id` ) AS `s` -ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`OneToMany_Required_Inverse3Id`, `s`.`Name0` DESC, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`OneToMany_Required_Inverse3Id`, `s`.`Name0` DESC """); } @@ -1582,7 +1582,7 @@ ORDER BY `l0`.`Id` LEFT JOIN `LevelThree` AS `l1` ON `l2`.`Id` = `l1`.`Level2_Required_Id` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` ) AS `s` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1607,7 +1607,7 @@ ORDER BY `l0`.`Id` LEFT JOIN `LevelThree` AS `l1` ON `l2`.`Id` = `l1`.`Level2_Required_Id` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` ) AS `s` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1676,7 +1676,7 @@ LEFT JOIN ( WHERE `l3`.`Id` > 1 ) AS `l4` ON `l1`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id1` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1703,7 +1703,7 @@ ORDER BY `l1`.`Id` LEFT JOIN `LevelFour` AS `l3` ON `l4`.`Id` = `l3`.`OneToMany_Required_Inverse4Id` ) AS `s` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id00`, `s0`.`Id1` +ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id00` """); } @@ -1730,7 +1730,7 @@ ORDER BY `l1`.`Id` LEFT JOIN `LevelFour` AS `l3` ON `l4`.`Id` = `l3`.`OneToMany_Required_Inverse4Id` ) AS `s` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id00`, `s0`.`Id1` +ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id00` """); } @@ -1831,7 +1831,7 @@ LEFT JOIN ( WHERE `l3`.`Id` <> `l`.`Id` ) AS `l4` ON `l2`.`Id` = `l4`.`OneToMany_Optional_Inverse3Id` ) AS `s0` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0`, `s0`.`Id` """); } @@ -1860,7 +1860,7 @@ SELECT 1 FROM `LevelTwo` AS `l2` WHERE `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` AND `l2`.`Id` = `l4`.`Id`) ) AS `l5` -ORDER BY `l`.`Id`, `l5`.`Id` +ORDER BY `l`.`Id` """); } @@ -1974,7 +1974,7 @@ SELECT TOP 1 `l`.`Id` WHERE `l`.`Id` = 1 ) AS `l1` LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l1`.`Id`, `l0`.`Id` +ORDER BY `l1`.`Id` """); } @@ -2002,7 +2002,7 @@ ORDER BY `l0`.`Name` DESC ) AS `l2` LEFT JOIN `LevelThree` AS `l1` ON `l2`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` -ORDER BY `l3`.`Id`, `s`.`Name` DESC, `s`.`Id` +ORDER BY `l3`.`Id`, `s`.`Name` DESC """); } @@ -2033,7 +2033,7 @@ OFFSET 1 ROWS FETCH NEXT 4 ROWS ONLY ) AS `l2` LEFT JOIN `LevelThree` AS `l1` ON `l2`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` -ORDER BY `l3`.`Id` DESC, `s`.`Name` DESC, `s`.`Id` +ORDER BY `l3`.`Id` DESC, `s`.`Name` DESC """); } @@ -2059,7 +2059,7 @@ OUTER APPLY ( ) AS `l2` LEFT JOIN `LevelThree` AS `l1` ON `l2`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` -ORDER BY `l3`.`Id`, `s`.`Id` +ORDER BY `l3`.`Id` """); } @@ -2087,7 +2087,7 @@ OUTER APPLY ( ) AS `l2` LEFT JOIN `LevelThree` AS `l1` ON `l2`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` -ORDER BY `l3`.`Id`, `s`.`Id` +ORDER BY `l3`.`Id` """); } @@ -2111,7 +2111,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` ) AS `l3` ON `l1`.`Date` = `l3`.`Date` -ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name` """); } @@ -2135,7 +2135,7 @@ LEFT JOIN ( ) AS `l2` WHERE `l2`.`row` <= 10 ) AS `l3` ON `l1`.`Date` = `l3`.`Date` -ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name` DESC, `l3`.`Id` +ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name` DESC """); } @@ -2159,7 +2159,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` AND `l2`.`row` <= 6 ) AS `l3` ON `l1`.`Date` = `l3`.`Date` -ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name` """); } @@ -2185,7 +2185,7 @@ ORDER BY `l0`.`Name` OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS `l1` ) AS `l3` -ORDER BY `l2`.`Date`, `l3`.`Id` +ORDER BY `l2`.`Date` """); } @@ -2209,7 +2209,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` AND `l2`.`row` <= 6 ) AS `l3` ON `l1`.`Date` = `l3`.`Date` -ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name` """); } @@ -2233,7 +2233,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` AND `l2`.`row` <= 6 ) AS `l3` ON `l1`.`Date` = `l3`.`Date` -ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l1`.`Date`, `l3`.`Date`, `l3`.`Name` """); } @@ -2260,7 +2260,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS `l3` LEFT JOIN `LevelTwo` AS `l1` ON `l3`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` ) AS `s` -ORDER BY `l2`.`Date`, `s`.`Name`, `s`.`Id`, `s`.`Id0` +ORDER BY `l2`.`Date`, `s`.`Name`, `s`.`Id` """); } @@ -2287,7 +2287,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS `l2` LEFT JOIN `LevelTwo` AS `l1` ON `l2`.`Id` = `l1`.`Level1_Optional_Id` ) AS `s` -ORDER BY `l3`.`Date`, `s`.`Name`, `s`.`Id` +ORDER BY `l3`.`Date`, `s`.`Name` """); } @@ -2317,7 +2317,7 @@ LEFT JOIN ( WHERE 1 < `l3`.`row` AND `l3`.`row` <= 6 ) AS `l4` ON `l2`.`Date` = `l4`.`Date` ) AS `s` -ORDER BY `l`.`Id`, `s`.`Date`, `s`.`Date0`, `s`.`Name`, `s`.`Id` +ORDER BY `l`.`Id`, `s`.`Date`, `s`.`Date0`, `s`.`Name` """); } @@ -2342,7 +2342,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l0` WHERE `l0`.`Name` IN (@validIds1, @validIds2) ) AS `l2` ON `l1`.`Date` = `l2`.`Date` -ORDER BY `l1`.`Date`, `l2`.`Id` +ORDER BY `l1`.`Date` """); } @@ -2362,7 +2362,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`Level3_Optional_Id` ) AS `s` ON `l1`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` WHERE `l0`.`Id` < 3 OR `l1`.`Id` > 8 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -2390,7 +2390,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`Level3_Optional_Id` ) AS `s` ON `l1`.`Id` = `s`.`OneToMany_Required_Inverse3Id` WHERE `l0`.`Id` < 3 OR `l1`.`Id` > 8 -ORDER BY `l`.`Id`, `l6`.`OneToMany_Optional_Inverse3Id`, `l6`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l6`.`OneToMany_Optional_Inverse3Id`, `l6`.`Id` """); } @@ -2410,7 +2410,7 @@ LEFT JOIN ( ) AS `l1` WHERE `l1`.`row` <= 50 ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2448,7 +2448,7 @@ OUTER APPLY ( WHERE `l0`.`Level1_Required_Id` = (`l`.`Id` * 2) OR LEN(`l0`.`Name`) = `l0`.`Id` ) AS `l1` LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2495,7 +2495,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS `l6` LEFT JOIN `LevelTwo` AS `l5` ON `l6`.`Id` = `l5`.`Level1_Optional_Id` ) AS `s0` -ORDER BY `s`.`Name`, `s`.`Id`, `s0`.`Name`, `s0`.`Id` +ORDER BY `s`.`Name`, `s`.`Id`, `s0`.`Name` """); } @@ -2598,7 +2598,7 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool SELECT `l`.`Id`, `l0`.`Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -2619,7 +2619,7 @@ LEFT JOIN ( ) AS `l2` WHERE `l2`.`row` <= 50 ) AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id` """); } @@ -2634,7 +2634,7 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2659,7 +2659,7 @@ SELECT 1 FROM `LevelTwo` AS `l2` WHERE `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` AND `l2`.`Id` = `l3`.`Id`) ) AS `l4` -ORDER BY `l`.`Id`, `l4`.`Id` +ORDER BY `l`.`Id` """); } @@ -2672,7 +2672,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex_rep SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -2687,7 +2687,7 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2705,7 +2705,7 @@ OUTER APPLY ( FROM `LevelThree` AS `l1` WHERE `l0`.`Id` IS NOT NULL AND `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `l2` -ORDER BY `l`.`Id`, `l2`.`ChildId` +ORDER BY `l`.`Id` """); } @@ -2725,7 +2725,7 @@ OUTER APPLY ( WHERE `l0`.`Id` IS NOT NULL AND `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` GROUP BY `l2`.`Name` ) AS `l3` -ORDER BY `l`.`Id`, `l3`.`Key` +ORDER BY `l`.`Id` """); } @@ -2744,7 +2744,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2763,7 +2763,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l2` LEFT JOIN `LevelOne` AS `l3` ON `l2`.`OneToOne_Optional_Self1Id` = `l3`.`Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Self_Inverse1Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2786,7 +2786,7 @@ SELECT COUNT(*) FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` WHERE `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` AND (`l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL)) > 0 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -2803,7 +2803,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` WHERE `l0`.`Id` > 5 ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -2816,7 +2816,7 @@ public override async Task Filtered_include_OrderBy_EF_Property(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Name`, `l0`.`Id` +ORDER BY `l`.`Id`, `l0`.`Name` """); } @@ -2836,7 +2836,7 @@ LEFT JOIN ( ) AS `l1` WHERE 1 < `l1`.`row` AND `l1`.`row` <= 4 ) AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name`, `l2`.`Id` +ORDER BY `l`.`Id`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`Name` """); } @@ -2858,7 +2858,7 @@ LEFT JOIN ( ) AS `l2` WHERE 1 < `l2`.`row` AND `l2`.`row` <= 4 ) AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse3Id`, `l3`.`Name`, `l3`.`Id` +ORDER BY `l`.`Id`, `l3`.`OneToMany_Optional_Inverse3Id`, `l3`.`Name` """); } @@ -2871,7 +2871,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2888,7 +2888,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id` """); } @@ -2905,7 +2905,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2919,7 +2919,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_mult FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -2933,7 +2933,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2946,7 +2946,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -2960,7 +2960,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference_multi FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Required_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs index 492bcf6b..993813f8 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs @@ -4347,7 +4347,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -4361,7 +4361,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference_multi FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Required_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs index 4377d987..8e2dfe99 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs @@ -257,7 +257,7 @@ LEFT JOIN ( FROM `Globalizations` AS `g0` LEFT JOIN `Languages` AS `l0` ON `g0`.`LanguageName` = `l0`.`Name` ) AS `s0` ON `m0`.`DefaultText` = `s0`.`ComplexNavigationStringDefaultText` -ORDER BY `f`.`Name`, `s`.`Text`, `s0`.`Text` +ORDER BY `f`.`Name`, `s`.`Text` """); } @@ -1365,7 +1365,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l1` LEFT JOIN `LevelThree` AS `l2` ON `l1`.`Id` = `l2`.`Level2_Optional_Id` ) AS `s` ON `m`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `m`.`Id`, `l0`.`Id`, `s`.`Id` +ORDER BY `m`.`Id`, `l0`.`Id` """); } @@ -1511,7 +1511,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1524,7 +1524,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1537,7 +1537,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1551,7 +1551,7 @@ public override async Task Order_by_key_of_navigation_similar_to_projected_gets_ FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` INNER JOIN `LevelOne` AS `l1` ON `l0`.`Level1_Required_Id` = `l1`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1587,7 +1587,7 @@ public override async Task Order_by_key_of_anonymous_type_projected_navigation_d SELECT TOP @p `l0`.`Name` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1639,7 +1639,7 @@ SELECT TOP @p `l`.`Name` FROM `LevelTwo` AS `l` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id` INNER JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1656,7 +1656,7 @@ SELECT TOP @p `l0`.`Name` FROM `LevelTwo` AS `l` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id` INNER JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -2642,7 +2642,7 @@ public override async Task Where_on_multilevel_reference_in_subquery_with_outer_ INNER JOIN `LevelTwo` AS `l0` ON `l`.`OneToMany_Required_Inverse3Id` = `l0`.`Id` INNER JOIN `LevelOne` AS `l1` ON `l0`.`Level1_Required_Id` = `l1`.`Id` WHERE `l1`.`Name` IN ('L1 10', 'L1 01') -ORDER BY `l`.`Level2_Required_Id`, `l`.`Id` +ORDER BY `l`.`Level2_Required_Id` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY """); } @@ -2992,7 +2992,7 @@ LEFT JOIN ( WHERE `s`.`row` <= 1 ) AS `s0` ON `l3`.`Name` = `s0`.`Name` LEFT JOIN `LevelThree` AS `l2` ON `s0`.`Id0` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l3`.`Name`, `l2`.`Id` +ORDER BY `l3`.`Name` """); } @@ -3037,7 +3037,7 @@ await base LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`DifferentTypeReference_InheritanceDerived1Id` LEFT JOIN `InheritanceLeafTwo` AS `i1` ON `i`.`Id` = `i1`.`DifferentTypeReference_InheritanceDerived2Id` LEFT JOIN `InheritanceTwo` AS `i2` ON `i1`.`Id` = `i2`.`InheritanceLeaf2Id` -ORDER BY `i`.`Id`, `i2`.`Id` +ORDER BY `i`.`Id` """); } @@ -3051,7 +3051,7 @@ public override async Task String_include_multiple_derived_collection_navigation FROM `InheritanceOne` AS `i` LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`InheritanceDerived1Id1` LEFT JOIN `InheritanceLeafOne` AS `i1` ON `i`.`Id` = `i1`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `i1`.`Id` +ORDER BY `i`.`Id`, `i0`.`Id` """); } @@ -3065,7 +3065,7 @@ public override async Task String_include_multiple_derived_collection_navigation FROM `InheritanceOne` AS `i` LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`InheritanceDerived1Id` LEFT JOIN `InheritanceLeafTwo` AS `i1` ON `i`.`Id` = `i1`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `i1`.`Id` +ORDER BY `i`.`Id`, `i0`.`Id` """); } @@ -3087,7 +3087,7 @@ LEFT JOIN ( FROM `InheritanceLeafTwo` AS `i1` LEFT JOIN `InheritanceTwo` AS `i2` ON `i1`.`Id` = `i2`.`InheritanceLeaf2Id` ) AS `s` ON `i`.`Id` = `s`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `i`.`Id`, `i0`.`Id`, `s`.`Id` """); } @@ -3108,7 +3108,7 @@ LEFT JOIN ( LEFT JOIN `InheritanceLeafOne` AS `i4` ON `i3`.`Id` = `i4`.`SameTypeReference_InheritanceDerived1Id` LEFT JOIN `InheritanceLeafOne` AS `i5` ON `i3`.`Id` = `i5`.`SameTypeReference_InheritanceDerived2Id` ) AS `s` ON `i`.`Id` = `s`.`InheritanceBase2Id1` -ORDER BY `i`.`Id`, `i1`.`Id`, `i2`.`Id`, `s`.`Id` +ORDER BY `i`.`Id`, `i1`.`Id`, `i2`.`Id` """); } @@ -3560,7 +3560,7 @@ public override async Task Join_with_navigations_in_the_result_selector2(bool is INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id` LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -3755,7 +3755,7 @@ LEFT JOIN ( ) AS `l3` WHERE `l3`.`row` <= 1 ) AS `l4` ON `l`.`Id` = `l4`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -3772,7 +3772,7 @@ public override async Task OrderBy_collection_count_ThenBy_reference_navigation( ORDER BY ( SELECT COUNT(*) FROM `LevelThree` AS `l2` - WHERE `l0`.`Id` IS NOT NULL AND `l0`.`Id` = `l2`.`OneToMany_Required_Inverse3Id`), `l1`.`Name`, `l`.`Id` + WHERE `l0`.`Id` IS NOT NULL AND `l0`.`Id` = `l2`.`OneToMany_Required_Inverse3Id`), `l1`.`Name` """); } @@ -4054,7 +4054,7 @@ OUTER APPLY ( ) ) AS `l2` LEFT JOIN `LevelTwo` AS `l3` ON `l`.`Id` = `l3`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l2`.`Id` """); } @@ -4189,7 +4189,7 @@ LEFT JOIN ( ) AS `l3` ON `l`.`Id` = `l3`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelThree` AS `l1` ON `l3`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` WHERE `l`.`Id` < 2 -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -4343,7 +4343,7 @@ public override async Task SelectMany_subquery_with_custom_projection(bool async SELECT TOP @p `l0`.`Name` FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -4357,7 +4357,7 @@ public override async Task Include_multiple_collections_on_same_level(bool async FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -4755,7 +4755,7 @@ public override async Task Null_check_removal_applied_recursively_complex(bool a INNER JOIN `LevelOne` AS `l1` ON `l0`.`OneToMany_Required_Inverse2Id` = `l1`.`Id` LEFT JOIN `LevelFour` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` WHERE `l1`.`Name` = 'L1 01' -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -4785,7 +4785,7 @@ SELECT TOP 1 `l2`.`Id` WHERE `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` ORDER BY `l2`.`Id`) IS NULL AND `l0`.`OneToMany_Optional_Inverse3Id` IS NULL)) ) AS `s` -ORDER BY `l`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id` """); } @@ -4812,7 +4812,7 @@ SELECT MAX(`l3`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` ) AS `s` ON `l4`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l4`.`Id`, `s`.`Id` +ORDER BY `l4`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs index 79d41bbf..533e31f0 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; @@ -1060,7 +1061,7 @@ CROSS JOIN `Customer` AS `c0` FROM `Customer` AS `c1` CROSS JOIN `Customer` AS `c2` ) AS `u` -ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_FullName0` +ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0` """); } @@ -1089,7 +1090,7 @@ CROSS JOIN `Customer` AS `c2` ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0` ) AS `u0` ) AS `u1` -ORDER BY `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_FullName0` +ORDER BY `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_ZipCode0` """); } @@ -1256,6 +1257,359 @@ ORDER BY `c1`.`Id` DESC """); } + #region Non-shared test resources + + public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() + { + await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); + + AssertSql( + """ +@entity_equality_container_Id='1' (Nullable = true) +@entity_equality_container_Containee1_Id='2' (Nullable = true) +@entity_equality_container_Containee2_Id='3' (Nullable = true) + +SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` +FROM `EntityType` AS `e` +WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id +"""); + } + + public override async Task Projecting_complex_property_does_not_auto_include_owned_types() + { + await base.Projecting_complex_property_does_not_auto_include_owned_types(); + + AssertSql( + """ +SELECT `e`.`Complex_Name`, `e`.`Complex_Number` +FROM `EntityType` AS `e` +"""); + } + + #region 36837 + + #region 35025 + + public override async Task Select_TPC_base_with_ComplexType() + { + await base.Select_TPC_base_with_ComplexType(); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`ChildProperty`, NULL AS `ChildProperty1`, `t`.`PropertyInsideComplexThing`, `t`.`ChildComplexProperty_PropertyInsideComplexThing`, NULL AS `ChildComplexProperty_PropertyInsideComplexThing1`, 'TpcChild1' AS `Discriminator` +FROM `TpcChild1` AS `t` +UNION ALL +SELECT `t0`.`Id`, NULL AS `ChildProperty`, `t0`.`ChildProperty` AS `ChildProperty1`, `t0`.`PropertyInsideComplexThing`, NULL AS `ChildComplexProperty_PropertyInsideComplexThing`, `t0`.`ChildComplexProperty_PropertyInsideComplexThing` AS `ChildComplexProperty_PropertyInsideComplexThing1`, 'TpcChild2' AS `Discriminator` +FROM `TpcChild2` AS `t0` +"""); + } + + #endregion 35025 + + #region 34706 + + public override async Task Complex_type_on_an_entity_mapped_to_view_and_table() + { + await base.Complex_type_on_an_entity_mapped_to_view_and_table(); + + AssertSql( + """ +SELECT TOP 2 `b`.`Id`, `b`.`ComplexThing_Prop1`, `b`.`ComplexThing_Prop2` +FROM `BlogsView` AS `b` +"""); + } + + #endregion 34706 + + #region 38077 + + public override async Task Complex_property_on_split_entity() + { + await base.Complex_property_on_split_entity(); + + AssertSql( + """ +SELECT `h`.`Id`, `h`.`CreatedOn`, `h0`.`IsTestHook`, `h0`.`Weight`, `h`.`Number_Parsed`, `h`.`Number_Raw` +FROM `Hook` AS `h` +INNER JOIN `HookMetadata` AS `h0` ON `h`.`Id` = `h0`.`HookId` +"""); + } + + #endregion 38077 + + [Fact] + public virtual async Task Complex_type_equality_with_non_default_type_mapping() + { + var contextFactory = await InitializeNonSharedTest( + seed: context => + { + context.AddRange( + new Context36837.EntityType { ComplexThing = new Context36837.ComplexThing { DateTime = new DateTime(2020, 1, 1) } }); + return context.SaveChangesAsync(); + }); + + await using var context = contextFactory.CreateDbContext(); + + var count = await context.Set() + .CountAsync(b => b.ComplexThing == new Context36837.ComplexThing { DateTime = new DateTime(2020, 1, 1, 1, 1, 1, 999, 999) }); + Assert.Equal(0, count); + + AssertSql( + """ +SELECT COUNT(*) +FROM `EntityType` AS `e` +WHERE `e`.`ComplexThing_DateTime` = #2020-01-01 01:01:01.999# +"""); + } + + private class Context36837(DbContextOptions options) : DbContext(options) + { + protected override void OnModelCreating(ModelBuilder modelBuilder) + => modelBuilder.Entity().ComplexProperty(b => b.ComplexThing); + + public class EntityType + { + public int Id { get; set; } + public ComplexThing ComplexThing { get; set; } = null!; + } + + public class ComplexThing + { + [Column(TypeName = "datetime")] // Non-default type mapping + public DateTime DateTime { get; set; } + } + } + + #endregion 36837 + + + public override async Task Optional_complex_type_with_discriminator() + { + await base.Optional_complex_type_with_discriminator(); + + AssertSql( + """ +SELECT TOP 2 `e`.`Id`, `e`.`AllOptionalsComplexType_Discriminator`, `e`.`AllOptionalsComplexType_OptionalProperty` +FROM `EntityType` AS `e` +WHERE `e`.`AllOptionalsComplexType_Discriminator` IS NULL +""", + // + """ +@p2='3' +@p0='AllOptionalsComplexType' (Size = 255) +@p1='New thing' (Size = 255) + +UPDATE `EntityType` SET `AllOptionalsComplexType_Discriminator` = @p0, `AllOptionalsComplexType_OptionalProperty` = @p1 +WHERE `Id` = @p2; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT `e`.`Id`, `e`.`AllOptionalsComplexType_Discriminator`, `e`.`AllOptionalsComplexType_OptionalProperty` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Non_optional_complex_type_with_all_nullable_properties() + { + await base.Non_optional_complex_type_with_all_nullable_properties(); + + AssertSql( + """ +SELECT TOP 2 `e`.`Id`, `e`.`NonOptionalComplexType_NullableDateTime`, `e`.`NonOptionalComplexType_NullableString` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Non_optional_complex_type_with_all_nullable_properties_via_left_join() + { + await base.Non_optional_complex_type_with_all_nullable_properties_via_left_join(); + + AssertSql( + """ +SELECT `p0`.`Id`, `c`.`Id`, `c`.`ParentId`, `c`.`ComplexType_NullableDateTime`, `c`.`ComplexType_NullableString` +FROM ( + SELECT TOP 2 `p`.`Id` + FROM `Parent` AS `p` +) AS `p0` +LEFT JOIN `Child` AS `c` ON `p0`.`Id` = `c`.`ParentId` +ORDER BY `p0`.`Id` +"""); + } + + public override async Task Nullable_complex_type_with_discriminator_and_shadow_property() + { + await base.Nullable_complex_type_with_discriminator_and_shadow_property(); + + AssertSql( + """ +SELECT `e`.`Id`, `e`.`CreatedBy`, `e`.`Prop_Discriminator`, `e`.`Prop_OptionalValue` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_set_to_different_value() + { + await base.Nullable_complex_type_with_discriminator_set_to_different_value(); + } + + public override async Task Nullable_complex_type_with_discriminator_set_to_null() + { + await base.Nullable_complex_type_with_discriminator_set_to_null(); + } + + public override async Task Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip() + { + await base.Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip(); + } + + public override async Task Update_entity_with_nullable_complex_type_and_discriminator_does_not_throw() + { + await base.Update_entity_with_nullable_complex_type_and_discriminator_does_not_throw(); + } + + public override async Task Can_query_by_complex_type_property_with_index() + { + await base.Can_query_by_complex_type_property_with_index(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +WHERE `p`.`Address_City` = 'Seattle' +"""); + } + + public override async Task Can_update_entity_with_index_on_complex_type_property() + { + await base.Can_update_entity_with_index_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +""", + // + """ +@p1='1' +@p0='98102' (Nullable = false) (Size = 255) + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +"""); + } + + public override async Task Can_delete_entity_with_index_on_complex_type_property() + { + await base.Can_delete_entity_with_index_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +""", + // + """ +@p0='1' + +DELETE FROM `Person` +WHERE `Id_Id` = @p0; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT COUNT(*) +FROM `Person` AS `p` +"""); + } + + public override async Task Can_query_by_alternate_key_on_complex_type_property() + { + await base.Can_query_by_alternate_key_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +WHERE `p`.`Address_City` = 'Redmond' +"""); + } + + public override async Task Can_save_batch_swapping_alternate_key_values_on_complex_type_property() + { + await base.Can_save_batch_swapping_alternate_key_values_on_complex_type_property(); + + AssertSql( + """ +SELECT `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +ORDER BY `p`.`Id_Id` +""", + // + """ +@p1='1' +@p0='98103' (Nullable = false) (Size = 255) + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +@p1='2' +@p0='98054' (Nullable = false) (Size = 255) + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +ORDER BY `p`.`Id_Id` +"""); + } + + public override async Task Complex_json_collection_inside_left_join_subquery() + { + await base.Complex_json_collection_inside_left_join_subquery(); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`ChildId`, `c0`.`Id`, `c0`.`IsPublic`, `c0`.`c` +FROM `Parent` AS `p` +LEFT JOIN ( + SELECT `c`.`Id`, `c`.`IsPublic`, `c`.`CareNeeds` AS `c` + FROM `Child` AS `c` + WHERE `c`.`IsPublic` +) AS `c0` ON `p`.`ChildId` = `c0`.`Id` +"""); + } + + #endregion Non-shared test resources + [Fact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs index 21bd1bef..8e429561 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs @@ -28,7 +28,7 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ FROM `CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2` LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1` """); } @@ -42,7 +42,7 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ FROM `CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2` LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1` DESC, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1` DESC, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1` """); } @@ -56,7 +56,7 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le FROM `CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2` LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id1`, `c`.`Id2`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id1`, `c`.`Id2`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1` """); } @@ -70,7 +70,7 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le FROM `CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2` LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1` """); } @@ -131,7 +131,7 @@ LEFT JOIN ( LEFT JOIN `CompositeFours` AS `c13` ON `c11`.`Id1` = `c13`.`OneToMany_Required_Inverse4Id1` AND `c11`.`Id2` = `c13`.`OneToMany_Required_Inverse4Id2` ) AS `s3` ON `c7`.`Id1` = `s3`.`OneToMany_Optional_Inverse3Id1` AND `c7`.`Id2` = `s3`.`OneToMany_Optional_Inverse3Id2` ) AS `s4` ON `c`.`Id1` = `s4`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `s4`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id10`, `s1`.`Id20`, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`Id110`, `s4`.`Id210` +ORDER BY `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id10`, `s1`.`Id20`, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`Id110` """); } @@ -175,7 +175,7 @@ LEFT JOIN ( LEFT JOIN `CompositeFours` AS `c13` ON `c11`.`Id1` = `c13`.`OneToMany_Required_Inverse4Id1` AND `c11`.`Id2` = `c13`.`OneToMany_Required_Inverse4Id2` ) AS `s3` ON `c7`.`Id1` = `s3`.`OneToMany_Optional_Inverse3Id1` AND `c7`.`Id2` = `s3`.`OneToMany_Optional_Inverse3Id2` ) AS `s4` ON `c`.`Id1` = `s4`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `s4`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Name`, `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id20` DESC, `s1`.`Id10` DESC, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`c`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`c0` DESC, `s4`.`Id110`, `s4`.`Id210` +ORDER BY `c`.`Name`, `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id20` DESC, `s1`.`Id10` DESC, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`c`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`c0` DESC, `s4`.`Id110` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Ef6GroupByLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Ef6GroupByLibRedTest.cs index cd23f7b3..a8a6075b 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Ef6GroupByLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Ef6GroupByLibRedTest.cs @@ -493,7 +493,7 @@ LEFT JOIN ( FROM `OrderForLinq` AS `o` LEFT JOIN `CustomerForLinq` AS `c0` ON `o`.`CustomerId` = `c0`.`Id` ) AS `s` ON `c`.`Id` = `s`.`Id0` -ORDER BY `c`.`Id`, `s`.`Id` +ORDER BY `c`.`Id` """); } @@ -513,7 +513,7 @@ GROUP BY `p`.`LastName` ORDER BY LEN(( SELECT TOP 1 `p0`.`LastName` FROM `Person` AS `p0` - WHERE `p0`.`MiddleInitial` = 'Q' AND `p0`.`Age` = 20 AND (`p`.`LastName` = `p0`.`LastName` OR (`p`.`LastName` IS NULL AND `p0`.`LastName` IS NULL)))), `p`.`LastName` + WHERE `p0`.`MiddleInitial` = 'Q' AND `p0`.`Age` = 20 AND (`p`.`LastName` = `p0`.`LastName` OR (`p`.`LastName` IS NULL AND `p0`.`LastName` IS NULL)))) """); } @@ -532,7 +532,7 @@ GROUP BY `p`.`FirstName` ORDER BY ( SELECT TOP 1 `p0`.`LastName` FROM `Person` AS `p0` - WHERE `p`.`FirstName` = `p0`.`FirstName` OR (`p`.`FirstName` IS NULL AND `p0`.`FirstName` IS NULL)), `p`.`FirstName` + WHERE `p`.`FirstName` = `p0`.`FirstName` OR (`p`.`FirstName` IS NULL AND `p0`.`FirstName` IS NULL)) """); } @@ -552,7 +552,7 @@ GROUP BY `p`.`Id` ORDER BY ( SELECT TOP 1 `p0`.`MiddleInitial` FROM `Person` AS `p0` - WHERE `p0`.`Age` = 20 AND `p`.`Id` = `p0`.`Id`), `p`.`Id` + WHERE `p0`.`Age` = 20 AND `p`.`Id` = `p0`.`Id`) """); } @@ -652,7 +652,7 @@ LEFT JOIN ( FROM `Person` AS `p0` LEFT JOIN `Shoes` AS `s` ON `p0`.`Id` = `s`.`PersonId` ) AS `s0` ON `p1`.`FirstName` = `s0`.`FirstName` -ORDER BY `p1`.`FirstName`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `p1`.`FirstName`, `s0`.`Id` """); } @@ -757,7 +757,7 @@ LEFT JOIN ( WHERE `p2`.`row` <= 1 ) AS `p3` ON `p1`.`FirstName` = `p3`.`FirstName` LEFT JOIN `Shoes` AS `s` ON `p3`.`Id` = `s`.`PersonId` -ORDER BY `p1`.`FirstName`, `s`.`Id` +ORDER BY `p1`.`FirstName` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs index 206cee96..c23005e8 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs @@ -125,7 +125,7 @@ LEFT JOIN ( INNER JOIN `SplitEntityOnePart3` AS `s` ON `e0`.`Id` = `s`.`Id` INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e0`.`Id` = `s0`.`Id` ) AS `s1` ON `e`.`Id` = `s1`.`EntityThreeId` -ORDER BY `e`.`Id`, `s1`.`Id` +ORDER BY `e`.`Id` """); } @@ -162,7 +162,7 @@ LEFT JOIN ( INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e0`.`Id` = `s0`.`Id` LEFT JOIN `EntityTwo` AS `e1` ON `e0`.`Id` = `e1`.`EntityOneId` ) AS `s1` ON `e`.`Id` = `s1`.`EntityThreeId` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`Id` """); } @@ -191,7 +191,7 @@ public override async Task Include_collection_on_split_entity(bool async) INNER JOIN `SplitEntityOnePart3` AS `s` ON `e`.`Id` = `s`.`Id` INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e`.`Id` = `s0`.`Id` LEFT JOIN `EntityTwo` AS `e0` ON `e`.`Id` = `e0`.`EntityOneId` -ORDER BY `e`.`Id`, `e0`.`Id` +ORDER BY `e`.`Id` """); } @@ -725,7 +725,7 @@ LEFT JOIN ( INNER JOIN `OwnedReferencePart4` AS `o0` ON `o`.`BaseEntityId` = `o0`.`BaseEntityId` AND `o`.`Id` = `o0`.`Id` INNER JOIN `OwnedReferencePart3` AS `o1` ON `o`.`BaseEntityId` = `o1`.`BaseEntityId` AND `o`.`Id` = `o1`.`Id` ) AS `s0` ON `u`.`Id` = `s0`.`BaseEntityId` -ORDER BY `u`.`Id`, `s0`.`BaseEntityId` +ORDER BY `u`.`Id`, `s0`.`BaseEntityId`, `s0`.`Id` """); } @@ -771,7 +771,7 @@ LEFT JOIN ( INNER JOIN `OwnedReferencePart4` AS `o0` ON `o`.`MiddleEntityId` = `o0`.`MiddleEntityId` AND `o`.`Id` = `o0`.`Id` INNER JOIN `OwnedReferencePart3` AS `o1` ON `o`.`MiddleEntityId` = `o1`.`MiddleEntityId` AND `o`.`Id` = `o1`.`Id` ) AS `s0` ON `u`.`Id` = `s0`.`MiddleEntityId` -ORDER BY `u`.`Id`, `s0`.`MiddleEntityId` +ORDER BY `u`.`Id`, `s0`.`MiddleEntityId`, `s0`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/FromSqlQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/FromSqlQueryLibRedTest.cs index 7d1308d9..22cca424 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/FromSqlQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/FromSqlQueryLibRedTest.cs @@ -535,7 +535,7 @@ public override async Task FromSqlRaw_queryable_simple_include(bool async) SELECT * FROM `Customers` ) AS `m` LEFT JOIN `Orders` AS `o` ON `m`.`CustomerID` = `o`.`CustomerID` -ORDER BY `m`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID` """); } @@ -551,7 +551,7 @@ public override async Task FromSqlRaw_queryable_simple_composed_include(bool asy ) AS `m` LEFT JOIN `Orders` AS `o` ON `m`.`CustomerID` = `o`.`CustomerID` WHERE `m`.`City` = 'London' -ORDER BY `m`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID` """); } @@ -676,7 +676,7 @@ CROSS JOIN ( SELECT * FROM `Customers` WHERE `CustomerID` = 'AROUT' ) AS `m0` LEFT JOIN `Orders` AS `o` ON `m0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `m`.`CustomerID`, `m0`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID`, `m0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs index 06aa5635..d415f2b2 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs @@ -51,7 +51,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool isAs FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -78,7 +78,7 @@ public override async Task Include_multiple_circular(bool isAsync) FROM `Gears` AS `g` INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name` LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -93,7 +93,7 @@ public override async Task Include_multiple_circular_with_filter(bool isAsync) INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name` LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -107,7 +107,7 @@ public override async Task Include_using_alternate_key(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -121,7 +121,7 @@ public override async Task Include_navigation_on_derived_type(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -135,7 +135,7 @@ public override async Task String_based_Include_navigation_on_derived_type(bool FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -188,7 +188,7 @@ public override async Task Include_with_join_collection1(bool isAsync) FROM `Gears` AS `g` INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -202,7 +202,7 @@ public override async Task Include_with_join_collection2(bool isAsync) FROM `Tags` AS `t` INNER JOIN `Gears` AS `g` ON `t`.`GearSquadId` = `g`.`SquadId` AND `t`.`GearNickName` = `g`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -305,7 +305,7 @@ public override async Task Include_with_join_multi_level(bool isAsync) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName` INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name` LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `g0`.`Nickname` """); } @@ -340,7 +340,7 @@ INNER JOIN ( WHERE `g`.`Discriminator` = 'Officer' ) AS `g0` ON `t`.`GearSquadId` = `g0`.`SquadId` AND `t`.`GearNickName` = `g0`.`Nickname` LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` -ORDER BY NOT (`g0`.`HasSoulPatch`), `g0`.`Nickname` DESC, `t`.`Id`, `g0`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY NOT (`g0`.`HasSoulPatch`), `g0`.`Nickname` DESC, `t`.`Id`, `g0`.`SquadId`, `g1`.`Nickname` """); } @@ -355,7 +355,7 @@ public override async Task Include_with_join_and_inheritance2(bool isAsync) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -373,7 +373,7 @@ INNER JOIN ( WHERE `g`.`Discriminator` = 'Officer' ) AS `g0` ON `t`.`GearSquadId` = `g0`.`SquadId` AND `t`.`GearNickName` = `g0`.`Nickname` LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` -ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g1`.`Nickname` """); } @@ -727,7 +727,7 @@ public override async Task Select_null_propagation_negative3(bool isAsync) END AS `Condition` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`HasSoulPatch` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g0`.`Nickname` """); } @@ -740,7 +740,7 @@ public override async Task Select_null_propagation_negative4(bool isAsync) SELECT `g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `g0`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`HasSoulPatch` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g0`.`Nickname` """); } @@ -753,7 +753,7 @@ public override async Task Select_null_propagation_negative5(bool isAsync) SELECT `g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `g0`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`HasSoulPatch` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g0`.`Nickname` """); } @@ -847,7 +847,7 @@ public override async Task Select_conditional_with_anonymous_type_and_null_const """ SELECT `g`.`LeaderNickname` IS NOT NULL, `g`.`HasSoulPatch` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -859,7 +859,7 @@ public override async Task Select_conditional_with_anonymous_types(bool isAsync) """ SELECT `g`.`LeaderNickname` IS NOT NULL, `g`.`Nickname`, `g`.`FullName` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -872,7 +872,7 @@ public override async Task Where_conditional_equality_1(bool async) SELECT `g`.`Nickname` FROM `Gears` AS `g` WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -885,7 +885,7 @@ public override async Task Where_conditional_equality_2(bool async) SELECT `g`.`Nickname` FROM `Gears` AS `g` WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -897,7 +897,7 @@ public override async Task Where_conditional_equality_3(bool async) """ SELECT `g`.`Nickname` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -909,7 +909,7 @@ public override async Task Select_coalesce_with_anonymous_types(bool isAsync) """ SELECT `g`.`LeaderNickname`, `g`.`FullName` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1204,7 +1204,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1223,7 +1223,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`), FALSE) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1239,7 +1239,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')), FALSE) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1258,7 +1258,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1278,7 +1278,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC)) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1298,7 +1298,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1802,7 +1802,7 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -1816,7 +1816,7 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -1831,7 +1831,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -1848,7 +1848,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Weapons` AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName` LEFT JOIN `Weapons` AS `w1` ON `g0`.`FullName` = `w1`.`OwnerFullName` LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } @@ -1867,7 +1867,7 @@ LEFT JOIN ( ) AS `g1` ON `g`.`LeaderNickname` = `g1`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g1`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId`, `w`.`Id` """); } @@ -1882,7 +1882,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -1901,7 +1901,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` LEFT JOIN `Weapons` AS `w3` ON `g0`.`FullName` = `w3`.`OwnerFullName` LEFT JOIN `Weapons` AS `w4` ON `g`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id`, `w4`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } @@ -2102,7 +2102,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -2128,7 +2128,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `g`.`SquadId`, `t`.`Id` +ORDER BY `g`.`SquadId` """); } @@ -2203,7 +2203,7 @@ LEFT JOIN ( WHERE `w`.`Name` <> 'Lancer' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `c`.`Name` IN ('Ephyra', 'Hanover') -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -2221,7 +2221,7 @@ LEFT JOIN ( WHERE `g0`.`Nickname` <> 'Dom' ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -2438,7 +2438,7 @@ public override async Task Unnecessary_include_doesnt_get_added_complex_when_pro SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`Rank`, `g`.`SquadId` +ORDER BY `g`.`Rank` """); } @@ -2451,7 +2451,7 @@ public override async Task Multiple_order_bys_are_properly_lifted_from_subquery_ SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2464,7 +2464,7 @@ public override async Task Order_by_is_properly_lifted_from_subquery_with_same_o SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2478,7 +2478,7 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE `g`.`FullName` <> 'Augustus Cole' AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2492,7 +2492,7 @@ public override async Task Subquery_is_lifted_from_main_from_clause_of_SelectMan FROM `Gears` AS `g` CROSS JOIN `Gears` AS `g0` WHERE `g`.`HasSoulPatch` AND NOT (`g0`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g0`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2505,7 +2505,7 @@ public override async Task Subquery_containing_SelectMany_projecting_main_from_c FROM `Gears` AS `g` CROSS JOIN `Tags` AS `t` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`FullName`, `t`.`Id` +ORDER BY `g`.`FullName` """); } @@ -2517,7 +2517,7 @@ public override async Task Subquery_containing_join_projecting_main_from_clause_ SELECT `g`.`Nickname` FROM `Gears` AS `g` INNER JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` -ORDER BY `g`.`Nickname`, `t`.`Id` +ORDER BY `g`.`Nickname` """); } @@ -2529,7 +2529,7 @@ public override async Task Subquery_containing_left_join_projecting_main_from_cl SELECT `g`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` -ORDER BY `g`.`Nickname`, `t`.`Id` +ORDER BY `g`.`Nickname` """); } @@ -2560,7 +2560,7 @@ WHERE EXISTS ( SELECT 1 FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName`) AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -2574,7 +2574,7 @@ public override async Task Subquery_is_lifted_from_additional_from_clause(bool i FROM `Gears` AS `g` CROSS JOIN `Gears` AS `g0` WHERE `g`.`HasSoulPatch` AND NOT (`g0`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g0`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2697,7 +2697,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool isAsy """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2709,7 +2709,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca """ SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2721,7 +2721,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2733,7 +2733,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool isA """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2816,7 +2816,7 @@ SELECT COUNT(*) FROM `LocustLeaders` AS `l` WHERE `f`.`Id` = `l`.`LocustHordeId`) AS `LeadersCount` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2847,7 +2847,7 @@ LEFT JOIN ( WHERE `l`.`Discriminator` = 'LocustCommander' ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name` LEFT JOIN `LocustLeaders` AS `l1` ON `f`.`Id` = `l1`.`LocustHordeId` -ORDER BY `f`.`Name`, `f`.`Id`, `l1`.`Name` +ORDER BY `f`.`Name`, `f`.`Id` """); } @@ -2983,7 +2983,7 @@ public override async Task Comparing_two_collection_navigations_composite_key(bo FROM `Gears` AS `g` CROSS JOIN `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`Nickname` AND `g`.`SquadId` = `g0`.`SquadId` -ORDER BY `g`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3182,7 +3182,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` INNER JOIN `Cities` AS `c` ON `g0`.`CityOfBirthName` = `c`.`Name` ) AS `s` ON `g`.`Nickname` IS NOT NULL AND `g`.`SquadId` IS NOT NULL AND `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `l`.`Name`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `l`.`Name`, `s`.`Nickname` """); } @@ -3231,7 +3231,7 @@ public override async Task Include_collection_on_derived_type_using_string(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3244,7 +3244,7 @@ public override async Task Include_collection_on_derived_type_using_lambda(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3257,7 +3257,7 @@ public override async Task Include_collection_on_derived_type_using_lambda_with_ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3271,7 +3271,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool isAsyn FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3285,7 +3285,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -3304,7 +3304,7 @@ LEFT JOIN ( ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name` LEFT JOIN `Gears` AS `g` ON `l0`.`DefeatedByNickname` = `g`.`Nickname` AND `l0`.`DefeatedBySquadId` = `g`.`SquadId` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` IS NOT NULL AND `g`.`SquadId` IS NOT NULL AND `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `f`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `f`.`Id`, `g0`.`Nickname` """); } @@ -3321,7 +3321,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -3338,7 +3338,7 @@ LEFT JOIN ( FROM `LocustLeaders` AS `l` LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId` ) AS `s` ON `f`.`Id` = `s`.`LocustHordeId` -ORDER BY `f`.`Id`, `s`.`Name` +ORDER BY `f`.`Id` """); } @@ -3357,7 +3357,7 @@ LEFT JOIN ( ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name` LEFT JOIN `Gears` AS `g` ON `l0`.`DefeatedByNickname` = `g`.`Nickname` AND `l0`.`DefeatedBySquadId` = `g`.`SquadId` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` IS NOT NULL AND `g`.`SquadId` IS NOT NULL AND `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `f`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `f`.`Id`, `g0`.`Nickname` """); } @@ -3524,7 +3524,7 @@ public override async Task Correlated_collections_naked_navigation_with_ToList(b FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3540,7 +3540,7 @@ SELECT COUNT(*) WHERE `g`.`FullName` = `w`.`OwnerFullName`) FROM `Gears` AS `g` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3554,7 +3554,7 @@ public override async Task Correlated_collections_naked_navigation_with_ToArray( FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3572,7 +3572,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3590,7 +3590,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3608,7 +3608,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3626,7 +3626,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` DESC, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` DESC """); } @@ -3644,7 +3644,7 @@ LEFT JOIN ( WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' AND `g`.`Nickname` <> 'Foo' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -3662,7 +3662,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3680,7 +3680,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3698,7 +3698,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3731,7 +3731,7 @@ public override async Task Correlated_collections_project_anonymous_collection_r FROM `Squads` AS `s` LEFT JOIN `Gears` AS `g` ON `s`.`Id` = `g`.`SquadId` WHERE `s`.`Id` < 20 -ORDER BY `s`.`Id`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `s`.`Id`, `g`.`Nickname` """); } @@ -3754,7 +3754,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3777,7 +3777,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3800,7 +3800,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3823,7 +3823,7 @@ LEFT JOIN ( WHERE `g0`.`FullName` <> 'Foo' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `g`.`Nickname`, `g`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `g`.`Nickname`, `g`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`) """); } @@ -3845,7 +3845,7 @@ LEFT JOIN ( FROM `Weapons` AS `w0` WHERE `w0`.`IsAutomatic` ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id` """); } @@ -3867,7 +3867,7 @@ LEFT JOIN ( FROM `Weapons` AS `w0` WHERE NOT (`w0`.`IsAutomatic`) ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`), `w2`.`Id` +ORDER BY `g`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`) """); } @@ -3886,7 +3886,7 @@ LEFT JOIN ( ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `g0`.`FullName`, `g0`.`Nickname` """); } @@ -3903,7 +3903,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`SquadId` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note` """); } @@ -3926,7 +3926,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC """); } @@ -3950,7 +3950,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC """); } @@ -4014,7 +4014,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Id0`, `s1`.`Nickname0`, `s1`.`SquadId0`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC, `s2`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Id0`, `s1`.`Nickname0`, `s1`.`SquadId0`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC """); } @@ -4032,7 +4032,7 @@ OUTER APPLY ( WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` ) AS `g1` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -4050,7 +4050,7 @@ OUTER APPLY ( WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` AND `g`.`FullName` <> 'Foo' ) AS `g1` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -4073,7 +4073,7 @@ OUTER APPLY ( WHERE `g0`.`FullName` <> 'Foo' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -4096,7 +4096,7 @@ LEFT JOIN ( WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` AND `g0`.`FullName` <> 'Foo' ) AS `s` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -4120,7 +4120,7 @@ LEFT JOIN ( WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `s`.`Id` = `g1`.`SquadId` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`Nickname`, `s`.`Id` DESC, `g`.`SquadId`, `w0`.`Id`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `s`.`Id` DESC, `g`.`SquadId`, `w0`.`Id`, `g1`.`Nickname` """); } @@ -4182,7 +4182,7 @@ ORDER BY `g`.`Nickname` OFFSET 0 ROWS ) AS `g0` ) AS `g1` -ORDER BY `s`.`Name`, `s`.`Id`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `s`.`Name`, `s`.`Id`, `g1`.`Nickname` """); } @@ -4198,7 +4198,7 @@ SELECT TOP 1 `g`.`FullName` WHERE `s`.`Id` = `g`.`SquadId` ORDER BY `g`.`Nickname`) FROM `Squads` AS `s` -ORDER BY `s`.`Name`, `s`.`Id` +ORDER BY `s`.`Name` """); } @@ -4213,7 +4213,7 @@ public override async Task Correlated_collections_on_left_join_with_predicate(bo LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -4228,7 +4228,7 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo RIGHT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -4242,7 +4242,7 @@ public override async Task Correlated_collections_on_left_join_with_null_value(b FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Note`, `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -4284,7 +4284,7 @@ LEFT JOIN ( ) AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName` WHERE `g0`.`HasSoulPatch` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `t`.`Note`, `g`.`Nickname` DESC, `t`.`Id`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `t`.`Note`, `g`.`Nickname` DESC, `t`.`Id`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -4326,7 +4326,7 @@ LEFT JOIN ( LEFT JOIN `Squads` AS `s` ON `g0`.`SquadId` = `s`.`Id` LEFT JOIN `Gears` AS `g1` ON `s`.`Id` = `g1`.`SquadId` ) AS `s0` ON `g`.`FullName` = `s0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname` """); } @@ -4350,7 +4350,7 @@ LEFT JOIN ( ) AS `s0` ON `g0`.`FullName` = `s0`.`OwnerFullName` ) AS `s1` ON `g`.`Nickname` = `s1`.`LeaderNickname` AND `g`.`SquadId` = `s1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`Id`, `s1`.`Nickname0` """); } @@ -4369,7 +4369,7 @@ LEFT JOIN ( LEFT JOIN `Squads` AS `s` ON `g0`.`SquadId` = `s`.`Id` LEFT JOIN `Gears` AS `g1` ON `s`.`Id` = `g1`.`SquadId` ) AS `s0` ON `g`.`FullName` = `s0`.`OwnerFullName` -ORDER BY `g`.`FullName`, `g`.`Nickname` DESC, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname` DESC, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname` """); } @@ -4393,7 +4393,7 @@ LEFT JOIN ( ) AS `s0` ON `g0`.`FullName` = `s0`.`OwnerFullName` ) AS `s1` ON `g`.`Nickname` = `s1`.`LeaderNickname` AND `g`.`SquadId` = `s1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY NOT (`g`.`HasSoulPatch`), `g`.`LeaderNickname`, `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0` +ORDER BY NOT (`g`.`HasSoulPatch`), `g`.`LeaderNickname`, `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0` """); } @@ -4410,7 +4410,7 @@ public override async Task Correlated_collection_with_top_level_FirstOrDefault(b ORDER BY `g`.`Nickname` ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -4438,7 +4438,7 @@ public override async Task Correlated_collection_with_top_level_Last_with_orderb ORDER BY `g`.`FullName` ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -4455,7 +4455,7 @@ public override async Task Correlated_collection_with_top_level_Last_with_order_ ORDER BY `g`.`FullName` DESC ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`FullName` DESC, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Name`, `w`.`Id` +ORDER BY `g0`.`FullName` DESC, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Name` """); } @@ -4510,7 +4510,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool ORDER BY `t`.`Note` ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Note`, `s`.`Name`, `w`.`Id` +ORDER BY `s`.`Note`, `s`.`Name` """); } @@ -4564,7 +4564,7 @@ OUTER APPLY ( INNER JOIN `Gears` AS `g0` ON `g`.`FullName` = `g0`.`FullName` ) AS `s` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -4582,7 +4582,7 @@ OUTER APPLY ( INNER JOIN `Gears` AS `g0` ON `g`.`FullName` = `g`.`Nickname` ) AS `s` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id`, `s`.`Nickname` """); } @@ -4627,7 +4627,7 @@ public override async Task Order_by_entity_qsre(bool isAsync) SELECT `g`.`FullName` FROM `Gears` AS `g` LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name` -ORDER BY `c`.`Name`, `g`.`Nickname` DESC, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` DESC """); } @@ -4668,7 +4668,7 @@ public override async Task Order_by_entity_qsre_with_other_orderbys(bool isAsync FROM `Weapons` AS `w` LEFT JOIN `Gears` AS `g` ON `w`.`OwnerFullName` = `g`.`FullName` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w`.`IsAutomatic`), `g`.`Nickname` DESC, `g`.`SquadId` DESC, `w0`.`Id`, `w`.`Name`, `w`.`Id` +ORDER BY NOT (`w`.`IsAutomatic`), `g`.`Nickname` DESC, `g`.`SquadId` DESC, `w0`.`Id`, `w`.`Name` """); } @@ -4966,7 +4966,7 @@ public override async Task Include_with_order_by_constant(bool isAsync) SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Squads` AS `s` LEFT JOIN `Gears` AS `g` ON `s`.`Id` = `g`.`SquadId` -ORDER BY `s`.`Id`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `s`.`Id`, `g`.`Nickname` """); } @@ -4979,7 +4979,7 @@ public override async Task Correlated_collection_order_by_constant(bool isAsync) SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5036,7 +5036,7 @@ public override async Task Include_collection_OrderBy_aggregate(bool isAsync) ORDER BY ( SELECT COUNT(*) FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` + WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -5054,7 +5054,7 @@ ORDER BY NOT (( SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)), `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` + ORDER BY `w`.`Id`)), `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -5072,7 +5072,7 @@ ORDER BY NOT (COALESCE(( SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`), FALSE)), `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` + ORDER BY `w`.`Id`), FALSE)), `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -5093,7 +5093,7 @@ WHERE NOT (`g0`.`HasSoulPatch`) ORDER BY ( SELECT COUNT(*) FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` + WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -5117,7 +5117,7 @@ SELECT COUNT(*) WHERE `g`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = COALESCE(( SELECT TOP 1 `g0`.`HasSoulPatch` FROM `Gears` AS `g0` - WHERE `g0`.`Nickname` = 'Marcus'), FALSE)), `g`.`Nickname`, `g`.`SquadId`, `g2`.`Nickname`, `g2`.`SquadId` + WHERE `g0`.`Nickname` = 'Marcus'), FALSE)), `g`.`Nickname`, `g`.`SquadId`, `g2`.`Nickname` """); } @@ -5364,7 +5364,7 @@ public override async Task Cast_subquery_to_base_type_using_typed_ToList(bool is FROM `Cities` AS `c` LEFT JOIN `Gears` AS `g` ON `c`.`Name` = `g`.`AssignedCityName` WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` """); } @@ -5378,7 +5378,7 @@ public override async Task Cast_ordered_subquery_to_base_type_using_typed_ToArra FROM `Cities` AS `c` LEFT JOIN `Gears` AS `g` ON `c`.`Name` = `g`.`AssignedCityName` WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `g`.`Nickname` DESC, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` DESC """); } @@ -5391,7 +5391,7 @@ public override async Task Correlated_collection_with_complex_order_by_funcletiz SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5404,7 +5404,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -5417,7 +5417,7 @@ public override async Task Double_order_by_on_Like(bool isAsync) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -5430,7 +5430,7 @@ public override async Task Double_order_by_on_is_null(bool isAsync) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -5454,7 +5454,7 @@ public override async Task Double_order_by_binary_expression(bool isAsync) """ SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` -ORDER BY `w`.`Id` + 2, `w`.`Id` +ORDER BY `w`.`Id` + 2 """); } @@ -5467,7 +5467,7 @@ public override async Task String_compare_with_null_conditional_argument(bool is SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -5480,7 +5480,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool i SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -5493,7 +5493,7 @@ public override async Task String_concat_with_null_conditional_argument(bool isA SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY COALESCE(`w0`.`Name`, '') & (5 & ''), `w`.`Id` +ORDER BY COALESCE(`w0`.`Name`, '') & (5 & '') """); } @@ -5506,7 +5506,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool is SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY COALESCE(`w0`.`Name`, '') & 'Marcus'' Lancer', `w`.`Id` +ORDER BY COALESCE(`w0`.`Name`, '') & 'Marcus'' Lancer' """); } @@ -5668,7 +5668,7 @@ public override async Task Include_collection_with_Cast_to_base(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5693,7 +5693,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5711,7 +5711,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -5728,7 +5728,7 @@ SELECT CASE ORDER BY NOT (CASE WHEN `g`.`LeaderNickname` IS NOT NULL THEN TRUE ELSE FALSE -END), `g`.`SquadId` +END) """); } @@ -6006,7 +6006,7 @@ public override async Task Include_with_complex_order_by(bool isAsync) ORDER BY ( SELECT TOP 1 `w`.`Name` FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Gnasher%')), `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` + WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Gnasher%')), `g`.`Nickname`, `g`.`SquadId` """); } @@ -6130,7 +6130,7 @@ LEFT JOIN ( WHERE `g1`.`row` <= 50 ) AS `g2` ON `g`.`Nickname` IS NOT NULL AND `g`.`SquadId` IS NOT NULL AND `g`.`Nickname` = `g2`.`LeaderNickname` AND `g`.`SquadId` = `g2`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `t`.`Id`, `g2`.`Nickname`, `g2`.`SquadId` +ORDER BY `t`.`Id`, `g2`.`Nickname` """); } @@ -6145,7 +6145,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` IS NOT NULL AND `g`.`SquadId` IS NOT NULL AND `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `t`.`Id`, `g0`.`Nickname` """); } @@ -6473,7 +6473,7 @@ LEFT JOIN ( FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` ) AS `s` ON `g`.`FullName` = `s`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6487,7 +6487,7 @@ public override async Task Reference_include_chain_loads_correctly_when_middle_i FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` LEFT JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id` -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -6505,7 +6505,7 @@ LEFT JOIN ( FROM `Weapons` AS `w` LEFT JOIN `Gears` AS `g0` ON `w`.`OwnerFullName` = `g0`.`FullName` ) AS `s` ON `g`.`FullName` = `s`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `s`.`Id` +ORDER BY `t`.`Note`, `t`.`Id` """); } @@ -6538,7 +6538,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para FROM `Gears` AS `g` WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `g0` -ORDER BY `g0`.`FullName`, `g0`.`SquadId` +ORDER BY `g0`.`FullName` """); } @@ -6608,7 +6608,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -6791,7 +6791,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -6803,7 +6803,6 @@ public override async Task OrderBy_Contains_empty_list(bool async) """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -ORDER BY `g`.`SquadId` """); } @@ -6884,7 +6883,7 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n """ @ranks='134' -SELECT (`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`g`.`Rank` BOR `g`.`Rank`) BOR @ranks) BOR `g`.`Rank`) BOR @ranks) = @ranks FROM `Gears` AS `g` """); } @@ -7130,7 +7129,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -7426,7 +7425,7 @@ public override async Task Constant_enum_with_same_underlying_value_as_previousl SELECT TOP @p `g`.`Rank` BAND 1 FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -7578,7 +7577,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` < `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7591,7 +7590,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` <= `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7604,7 +7603,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` >= `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7656,7 +7655,7 @@ OUTER APPLY ( WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` ) AS `g1` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -7708,7 +7707,7 @@ LEFT JOIN ( ) AS `w0` WHERE `w0`.`row` <= 10 ) AS `w1` ON `g`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7963,7 +7962,7 @@ SELECT CASE WHERE CASE WHEN `t`.`GearNickName` IS NOT NULL THEN `g`.`Nickname` END IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7981,7 +7980,7 @@ END AS `Id` WHERE CASE WHEN `t`.`GearNickName` IS NOT NULL THEN `g`.`Nickname` END IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -8003,7 +8002,7 @@ SELECT CASE WHERE CASE WHEN `t`.`GearNickName` IS NOT NULL THEN `g`.`Nickname` END IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -8021,7 +8020,7 @@ WHERE CASE END IS NOT NULL AND NOT (CASE WHEN `t`.`GearNickName` IS NOT NULL THEN `g`.`HasSoulPatch` END) -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -8035,7 +8034,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE DATEPART('m', `t`.`IssueDate`) <> 5 -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -8053,7 +8052,7 @@ WHERE CASE END IS NOT NULL ORDER BY CASE WHEN `t`.`GearNickName` IS NOT NULL THEN `g`.`SquadId` -END, `t`.`Note`, `t`.`Id` +END, `t`.`Note` """); } @@ -8070,7 +8069,7 @@ OUTER APPLY ( FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8086,7 +8085,7 @@ LEFT JOIN ( SELECT DISTINCT `w`.`Id`, `w`.`Name`, `w`.`OwnerFullName` FROM `Weapons` AS `w` ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8102,7 +8101,7 @@ LEFT JOIN ( SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` ) AS `g0` ON `s`.`Id` = `g0`.`SquadId` -ORDER BY `s`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `s`.`Id`, `g0`.`Nickname` """); } @@ -8119,7 +8118,7 @@ OUTER APPLY ( FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name`, NOT (`w0`.`IsAutomatic`) +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` """); } @@ -8138,7 +8137,7 @@ OUTER APPLY ( WHERE `g`.`FullName` = `w`.`OwnerFullName` GROUP BY `w`.`IsAutomatic` ) AS `w0` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, NOT (`w0`.`Key`) +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8157,7 +8156,7 @@ OUTER APPLY ( WHERE `g`.`FullName` = `w`.`OwnerFullName` GROUP BY `w`.`IsAutomatic` ) AS `w0` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, NOT (`w0`.`Key`) +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8179,7 +8178,7 @@ OUTER APPLY ( WHERE `g`.`FullName` = `w`.`OwnerFullName` GROUP BY `w`.`IsAutomatic`, `w`.`Name` ) AS `w0` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, NOT (`w0`.`IsAutomatic`), `w0`.`Name` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, NOT (`w0`.`IsAutomatic`) """); } @@ -8224,7 +8223,7 @@ SELECT DISTINCT `g1`.`HasSoulPatch` INNER JOIN `Gears` AS `g1` ON `c`.`Name` = `g1`.`CityOfBirthName` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `s` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`HasSoulPatch`) +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8252,7 +8251,7 @@ OUTER APPLY ( WHERE `w`.`OwnerFullName` = `g0`.`FullName` ) AS `w0` ) AS `s1` -ORDER BY `s0`.`Id`, `s1`.`Nickname`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch`), `s1`.`Id0` +ORDER BY `s0`.`Id`, `s1`.`Nickname`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch`) """); } @@ -8360,7 +8359,7 @@ ORDER BY `g`.`Nickname` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`HasSoulPatch0`), `w`.`Id` +ORDER BY `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`HasSoulPatch0`) """); } @@ -8418,7 +8417,7 @@ public override async Task Enum_matching_take_value_gets_different_type_mapping( SELECT TOP @p `g`.`Rank` BAND @value FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -8526,7 +8525,7 @@ public override async Task Cast_to_derived_followed_by_multiple_includes(bool as LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `l`.`Name` LIKE '%Queen%' -ORDER BY `l`.`Name`, `w`.`Id` +ORDER BY `l`.`Name` """); } @@ -8584,7 +8583,7 @@ LEFT JOIN ( ) AS `w1` WHERE `w1`.`row` <= 1 ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8931,7 +8930,7 @@ public override async Task Include_collection_on_derived_type_using_EF_Property( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -8945,7 +8944,7 @@ public override async Task EF_Property_based_Include_navigation_on_derived_type( FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -9165,7 +9164,7 @@ public override async Task Include_one_to_many_on_composite_key_then_orderby_key SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`SquadId`, `g`.`Nickname`, `w`.`Id` +ORDER BY `g`.`SquadId`, `g`.`Nickname` """); } @@ -9195,7 +9194,7 @@ public override async Task Join_include_coalesce_simple(bool async) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9203,7 +9202,7 @@ public override async Task Join_include_coalesce_simple(bool async) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9212,7 +9211,7 @@ public override async Task Join_include_coalesce_simple(bool async) LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -9226,7 +9225,7 @@ public override async Task Join_include_coalesce_nested(bool async) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9236,7 +9235,7 @@ public override async Task Join_include_coalesce_nested(bool async) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName` LEFT JOIN `Weapons` AS `w1` ON `g0`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` """); } @@ -9250,7 +9249,7 @@ public override async Task Join_include_conditional(bool async) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedFixture.cs similarity index 68% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedFixture.cs index ca22fde0..fdb75a6c 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedFixture.cs @@ -1,9 +1,6 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore.Query; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCFiltersInheritanceQueryLibRedFixture : TPCInheritanceQueryLibRedFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedTest.cs similarity index 98% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedTest.cs index 9d0e4da4..d2913ceb 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCFiltersInheritanceQueryLibRedTest : TPCFiltersInheritanceQueryTestBase { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCGearsOfWarQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedFixture.cs similarity index 96% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCGearsOfWarQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedFixture.cs index bed5d7a3..c8e27fed 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCGearsOfWarQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCGearsOfWarQueryLibRedFixture : TPCGearsOfWarQueryRelationalFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCGearsOfWarQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCGearsOfWarQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedTest.cs index 400c52fa..b508678e 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCGearsOfWarQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel; @@ -13,7 +10,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCGearsOfWarQueryLibRedTest : TPCGearsOfWarQueryRelationalTestBase { @@ -3139,7 +3136,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` -ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname` +ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } @@ -3792,7 +3789,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool async """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3804,7 +3801,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca """ SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3816,7 +3813,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3828,7 +3825,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool asy """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3841,7 +3838,7 @@ public override async Task Navigation_access_on_derived_entity_using_cast(bool a SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3854,7 +3851,7 @@ public override async Task Navigation_access_on_derived_materialized_entity_usin SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3867,7 +3864,7 @@ public override async Task Navigation_access_via_EFProperty_on_derived_entity_us SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3880,7 +3877,7 @@ public override async Task Navigation_access_fk_on_derived_entity_using_cast(boo SELECT `l`.`Name`, `l0`.`Name` AS `CommanderName` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -4557,7 +4554,7 @@ UNION ALL FROM `Officers` AS `o` ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND `u`.`DefeatedBySquadId` = `u0`.`SquadId` ) AS `s` ON `l`.`Id` = `s`.`LocustHordeId` -ORDER BY `l`.`Id`, `s`.`Name` +ORDER BY `l`.`Id` """); } @@ -4614,7 +4611,7 @@ UNION ALL INNER JOIN `Squads` AS `s` ON `u0`.`SquadId` = `s`.`Id` LEFT JOIN `SquadMissions` AS `s0` ON `s`.`Id` = `s0`.`SquadId` ) AS `s1` ON `u`.`Nickname` = `s1`.`LeaderNickname` AND `u`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`SquadId0` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`SquadId0`, `s1`.`MissionId` """); } @@ -4988,7 +4985,7 @@ LEFT JOIN ( WHERE `s0`.`MissionId` <> 17 ) AS `s1` ON `s`.`Id` = `s1`.`SquadId` WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`SquadId` +ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`SquadId`, `s1`.`MissionId` """); } @@ -5031,7 +5028,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -5054,7 +5051,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -5077,7 +5074,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -5657,7 +5654,7 @@ ORDER BY `u`.`Nickname` OFFSET 0 ROWS ) AS `u0` ) AS `u1` -ORDER BY `s`.`Name`, `s`.`Id`, `u1`.`Nickname`, `u1`.`SquadId` +ORDER BY `s`.`Name`, `s`.`Id`, `u1`.`Nickname` """); } @@ -6162,7 +6159,7 @@ UNION ALL ORDER BY `t`.`Note` ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Note`, `s`.`Name`, `w`.`Id` +ORDER BY `s`.`Note`, `s`.`Name` """); } @@ -7405,7 +7402,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -7418,7 +7415,7 @@ public override async Task Double_order_by_on_Like(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -7431,7 +7428,7 @@ public override async Task Double_order_by_on_is_null(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -7455,7 +7452,7 @@ public override async Task Double_order_by_binary_expression(bool async) """ SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` -ORDER BY `w`.`Id` + 2, `w`.`Id` +ORDER BY `w`.`Id` + 2 """); } @@ -7468,7 +7465,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -7481,7 +7478,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -7494,7 +7491,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY COALESCE(`w0`.`Name`, '') & (5 & ''), `w`.`Id` +ORDER BY COALESCE(`w0`.`Name`, '') & (5 & '') """); } @@ -7507,7 +7504,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY COALESCE(`w0`.`Name`, '') & 'Marcus'' Lancer', `w`.`Id` +ORDER BY COALESCE(`w0`.`Name`, '') & 'Marcus'' Lancer' """); } @@ -7803,7 +7800,7 @@ UNION ALL LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -8359,7 +8356,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` IS NOT NULL AND `t`.`GearSquadId` = `u`.`SquadId` AND `t`.`GearNickName` IS NOT NULL AND `t`.`Note` IS NOT NULL -ORDER BY `t`.`Id`, `u`.`Nickname` +ORDER BY `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } @@ -8744,7 +8741,7 @@ UNION ALL ) AS `u` WHERE `u`.`Nickname` <> @prm_Inner_Nickname ) AS `u0` -ORDER BY `u0`.`FullName`, `u0`.`SquadId` +ORDER BY `u0`.`FullName` """); } @@ -8838,7 +8835,7 @@ UNION ALL ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -9258,7 +9255,7 @@ UNION ALL """ @ranks='134' -SELECT (`u`.`Rank` BOR (`u`.`Rank` BOR (@ranks BOR (`u`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`u`.`Rank` BOR `u`.`Rank`) BOR @ranks) BOR `u`.`Rank`) BOR @ranks) = @ranks FROM ( SELECT `g`.`Rank` FROM `Gears` AS `g` @@ -9539,7 +9536,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs similarity index 51% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs index 45cc6083..03509a91 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs @@ -1,7 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCInheritanceQueryLibRedFixture : TPCInheritanceQueryLibRedFixtureBase { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedFixtureBase.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixtureBase.cs similarity index 80% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedFixtureBase.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixtureBase.cs index f887e182..ad799bdc 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedFixtureBase.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixtureBase.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public abstract class TPCInheritanceQueryLibRedFixtureBase : TPCInheritanceQueryFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTest.cs similarity index 72% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTest.cs index 776046df..59fe7657 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTest.cs @@ -1,12 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - // ReSharper disable InconsistentNaming using Microsoft.EntityFrameworkCore.Query; using Xunit; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCInheritanceQueryLibRedTest(TPCInheritanceQueryLibRedFixture fixture, ITestOutputHelper testOutputHelper) : TPCInheritanceQueryLibRedTestBase(fixture, testOutputHelper); diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedTestBase.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTestBase.cs similarity index 99% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedTestBase.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTestBase.cs index 79ad6add..43c38f4d 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCInheritanceQueryLibRedTestBase.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTestBase.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -8,7 +5,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public abstract class TPCInheritanceQueryLibRedTestBase(TFixture fixture, ITestOutputHelper testOutputHelper) : TPCInheritanceQueryTestBase(fixture, testOutputHelper) @@ -450,7 +447,7 @@ public override async Task Member_access_on_intermediate_type_works() """ SELECT `k`.`Name` FROM `Kiwi` AS `k` -ORDER BY `k`.`Name`, `k`.`Id` +ORDER BY `k`.`Name` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyNoTrackingQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryLibRedTest.cs index 30459126..0eb33ff5 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCManyToManyNoTrackingQueryLibRedTest : TPCManyToManyNoTrackingQueryRelationalTestBase { @@ -403,7 +400,7 @@ LEFT JOIN ( FROM `JoinCompositeKeyToLeaf` AS `j` INNER JOIN `Leaves` AS `l` ON `j`.`LeafId` = `l`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -473,7 +470,7 @@ SELECT TOP 1 `e3`.`Id` INNER JOIN `EntityThrees` AS `e3` ON `j`.`ThreeId` = `e3`.`Id` WHERE `e0`.`Key1` = `j`.`CompositeId1` AND `e0`.`Key2` = `j`.`CompositeId2` AND `e0`.`Key3` = `j`.`CompositeId3` ORDER BY `e3`.`Id`) -ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2`, `e0`.`Key3` +ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2` """); } @@ -645,7 +642,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -672,7 +669,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -722,7 +719,7 @@ UNION ALL FROM `Leaf2s` AS `l0` ) AS `u` ON `e0`.`RootSkipSharedId` = `u`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -740,7 +737,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -803,7 +800,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -821,7 +818,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -880,7 +877,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -901,7 +898,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id` """); } @@ -997,7 +994,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `l`.`Id` = `s0`.`LeafId` -ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1026,7 +1023,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -1053,7 +1050,7 @@ LEFT JOIN ( ) AS `s0` ON `e0`.`Id` = `s0`.`TwoId` WHERE `e0`.`Id` < 10 ) AS `s1` ON `e`.`Id` = `s1`.`OneId` -ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0`, `s1`.`ThreeId` """); } @@ -1073,7 +1070,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1112,7 +1109,7 @@ UNION ALL ) AS `s1` ON `e0`.`Id` = `s1`.`EntityOneId` WHERE `e0`.`Id` < 10 ) AS `s2` ON `e`.`Id` = `s2`.`ThreeId` -ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId`, `s2`.`EntityOneId` +ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId` """); } @@ -1135,7 +1132,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1158,7 +1155,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2080,7 +2077,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2110,7 +2107,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -2264,7 +2261,7 @@ UNION ALL ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` WHERE `u1`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2304,7 +2301,7 @@ SELECT TOP 1 `u4`.`Id` INNER JOIN `UnidirectionalEntityThrees` AS `u4` ON `u3`.`ThreeId` = `u4`.`Id` WHERE `u0`.`Key1` = `u3`.`CompositeId1` AND `u0`.`Key2` = `u3`.`CompositeId2` AND `u0`.`Key3` = `u3`.`CompositeId3` ORDER BY `u4`.`Id`) -ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2`, `u0`.`Key3` +ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2` """); } @@ -2424,7 +2421,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2450,7 +2447,7 @@ UNION ALL FROM `UnidirectionalLeaves` AS `u4` ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2468,7 +2465,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id` LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2549,7 +2546,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2587,7 +2584,7 @@ LEFT JOIN ( ) AS `s` WHERE 2 < `s`.`row` ) AS `s0` ON `u`.`Id` = `s0`.`UnidirectionalEntityTwoId` -ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id` +ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id`, `s0`.`SelfSkipSharedRightId` """); } @@ -2608,7 +2605,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2628,7 +2625,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `u`.`Key1` = `s0`.`CompositeId1` AND `u`.`Key2` = `s0`.`CompositeId2` AND `u`.`Key3` = `s0`.`CompositeId3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id` """); } @@ -2651,7 +2648,7 @@ LEFT JOIN ( ) AS `s` ON `u1`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u1`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u1`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u1`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2671,7 +2668,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2787,6 +2784,93 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u` +CROSS JOIN ( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedFixture.cs similarity index 79% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedFixture.cs index 04167315..2e50bf3a 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCManyToManyQueryLibRedFixture : TPCManyToManyQueryRelationalFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedTest.cs index 5d55480f..4a9b7b41 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCManyToManyQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCManyToManyQueryLibRedTest : TPCManyToManyQueryRelationalTestBase { @@ -403,7 +400,7 @@ LEFT JOIN ( FROM `JoinCompositeKeyToLeaf` AS `j` INNER JOIN `Leaves` AS `l` ON `j`.`LeafId` = `l`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -473,7 +470,7 @@ SELECT TOP 1 `e3`.`Id` INNER JOIN `EntityThrees` AS `e3` ON `j`.`ThreeId` = `e3`.`Id` WHERE `e0`.`Key1` = `j`.`CompositeId1` AND `e0`.`Key2` = `j`.`CompositeId2` AND `e0`.`Key3` = `j`.`CompositeId3` ORDER BY `e3`.`Id`) -ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2`, `e0`.`Key3` +ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2` """); } @@ -645,7 +642,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -672,7 +669,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -722,7 +719,7 @@ UNION ALL FROM `Leaf2s` AS `l0` ) AS `u` ON `e0`.`RootSkipSharedId` = `u`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -740,7 +737,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -803,7 +800,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -821,7 +818,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -880,7 +877,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -901,7 +898,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0` """); } @@ -997,7 +994,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `l`.`Id` = `s0`.`LeafId` -ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1026,7 +1023,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -1053,7 +1050,7 @@ LEFT JOIN ( ) AS `s0` ON `e0`.`Id` = `s0`.`TwoId` WHERE `e0`.`Id` < 10 ) AS `s1` ON `e`.`Id` = `s1`.`OneId` -ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0`, `s1`.`ThreeId` """); } @@ -1073,7 +1070,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1112,7 +1109,7 @@ UNION ALL ) AS `s1` ON `e0`.`Id` = `s1`.`EntityOneId` WHERE `e0`.`Id` < 10 ) AS `s2` ON `e`.`Id` = `s2`.`ThreeId` -ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId`, `s2`.`EntityOneId` +ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId` """); } @@ -1135,7 +1132,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1158,7 +1155,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2088,7 +2085,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2118,7 +2115,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -2265,7 +2262,7 @@ UNION ALL ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` WHERE `u1`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2305,7 +2302,7 @@ SELECT TOP 1 `u4`.`Id` INNER JOIN `UnidirectionalEntityThrees` AS `u4` ON `u3`.`ThreeId` = `u4`.`Id` WHERE `u0`.`Key1` = `u3`.`CompositeId1` AND `u0`.`Key2` = `u3`.`CompositeId2` AND `u0`.`Key3` = `u3`.`CompositeId3` ORDER BY `u4`.`Id`) -ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2`, `u0`.`Key3` +ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2` """); } @@ -2424,7 +2421,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2450,7 +2447,7 @@ UNION ALL FROM `UnidirectionalLeaves` AS `u4` ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2468,7 +2465,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id` LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2571,7 +2568,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2609,7 +2606,7 @@ LEFT JOIN ( ) AS `s` WHERE 2 < `s`.`row` ) AS `s0` ON `u`.`Id` = `s0`.`UnidirectionalEntityTwoId` -ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id` +ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id`, `s0`.`SelfSkipSharedRightId` """); } @@ -2630,7 +2627,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2651,7 +2648,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `u`.`Key1` = `s0`.`CompositeId1` AND `u`.`Key2` = `s0`.`CompositeId2` AND `u`.`Key3` = `s0`.`CompositeId3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0`, `s0`.`Id` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0` """); } @@ -2674,7 +2671,7 @@ LEFT JOIN ( ) AS `s` ON `u1`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u1`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u1`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u1`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2694,7 +2691,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2811,6 +2808,93 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u` +CROSS JOIN ( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCRelationshipsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCRelationshipsQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryLibRedTest.cs index f5863aa3..06751aaa 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPCRelationshipsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPCRelationshipsQueryLibRedTest : TPCRelationshipsQueryTestBase @@ -102,7 +99,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -150,7 +147,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `c`.`Name` <> 'Bar' OR `c`.`Name` IS NULL -ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -239,7 +236,7 @@ public override async Task Include_collection_with_inheritance_on_derived3(bool LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `d`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `DerivedCollectionsOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `d1`.`Id` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -261,7 +258,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d0`.`Id` = `o`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -290,7 +287,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u0`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -350,7 +347,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -373,7 +370,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -444,7 +441,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -468,7 +465,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -492,7 +489,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `r`.`Name` <> 'Bar' OR `r`.`Name` IS NULL -ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -521,7 +518,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -543,7 +540,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -565,7 +562,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -603,7 +600,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d0`.`Id` = `o`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -626,7 +623,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `d`.`Name` <> 'Bar' OR `d`.`Name` IS NULL -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -649,7 +646,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `d`.`Name` <> 'Bar' OR `d`.`Name` IS NULL -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -689,7 +686,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -718,7 +715,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u0`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -748,7 +745,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -778,7 +775,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -804,7 +801,7 @@ UNION ALL LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o2` ON `d0`.`Id` = `o2`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d3` ON `d0`.`Id` = `d3`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId`, `d3`.`Id` """); } @@ -830,7 +827,7 @@ UNION ALL LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `d`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o2` ON `u`.`Id` = `o2`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d3` ON `u`.`Id` = `d3`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId`, `d3`.`Id` """); } @@ -847,7 +844,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -922,7 +919,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -997,7 +994,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1098,7 +1095,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1134,7 +1131,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1163,7 +1160,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -1199,7 +1196,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id` LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPHInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedFixture.cs similarity index 78% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPHInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedFixture.cs index c9513aa2..bf2fd9a6 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPHInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPHInheritanceQueryLibRedFixture : TPHInheritanceQueryFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPHInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedTest.cs similarity index 98% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPHInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedTest.cs index f3c11602..b58321b5 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPHInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; @@ -12,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Query.Inheritance; #nullable disable // ReSharper disable InconsistentNaming -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPHInheritanceQueryLibRedTest(TPHInheritanceQueryLibRedFixture fixture, ITestOutputHelper testOutputHelper) : TPHInheritanceQueryTestBase(fixture, testOutputHelper) @@ -107,7 +104,7 @@ public override async Task Can_use_of_type_animal(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -168,7 +165,7 @@ public override async Task Can_use_of_type_bird(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -181,7 +178,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` WHERE `a`.`CountryId` = 1 -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -243,7 +240,7 @@ public override async Task Can_query_all_animals(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -282,7 +279,7 @@ public override async Task Can_filter_all_animals(bool async) SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` WHERE `a`.`Name` = 'Great spotted kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -294,7 +291,7 @@ public override async Task Can_query_all_birds(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -335,7 +332,7 @@ public override async Task Can_include_prey(bool async) WHERE `a`.`Discriminator` = 'Eagle' ) AS `a1` LEFT JOIN `Animals` AS `a0` ON `a1`.`Id` = `a0`.`EagleId` -ORDER BY `a1`.`Id`, `a0`.`Id` +ORDER BY `a1`.`Id` """); } @@ -348,7 +345,7 @@ public override async Task Can_include_animals(bool async) SELECT `c`.`Id`, `c`.`Name`, `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Countries` AS `c` LEFT JOIN `Animals` AS `a` ON `c`.`Id` = `a`.`CountryId` -ORDER BY `c`.`Name`, `c`.`Id`, `a`.`Id` +ORDER BY `c`.`Name`, `c`.`Id` """); } @@ -520,7 +517,7 @@ public override async Task Member_access_on_intermediate_type_works() SELECT `a`.`Name` FROM `Animals` AS `a` WHERE `a`.`Discriminator` = 'Kiwi' -ORDER BY `a`.`Name`, `a`.`Id` +ORDER BY `a`.`Name` """); } @@ -551,7 +548,7 @@ public override async Task Is_operator_on_result_of_FirstOrDefault(bool async) SELECT TOP 1 `a0`.`Discriminator` FROM `Animals` AS `a0` WHERE `a0`.`Name` = 'Great spotted kiwi') = 'Kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs similarity index 64% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs index b9021e1c..54402c60 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs @@ -1,9 +1,6 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore.Query; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTFiltersInheritanceQueryLibRedFixture : TPTInheritanceQueryLibRedFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedTest.cs similarity index 96% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedTest.cs index b5bb7ed8..f449d563 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTFiltersInheritanceQueryLibRedTest : TPTFiltersInheritanceQueryTestBase { @@ -41,7 +38,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -109,7 +106,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -128,7 +125,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTGearsOfWarQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedFixture.cs similarity index 96% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTGearsOfWarQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedFixture.cs index 59ee08a0..c413ddbc 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTGearsOfWarQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTGearsOfWarQueryLibRedFixture : TPTGearsOfWarQueryRelationalFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTGearsOfWarQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTGearsOfWarQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedTest.cs index 7f3c21b9..3fde116c 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTGearsOfWarQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -13,7 +10,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTGearsOfWarQueryLibRedTest : TPTGearsOfWarQueryRelationalTestBase { @@ -72,7 +69,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -114,7 +111,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -138,7 +135,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -155,7 +152,7 @@ public override async Task Include_using_alternate_key(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -178,7 +175,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -201,7 +198,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -272,7 +269,7 @@ public override async Task Include_with_join_collection1(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -292,7 +289,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearSquadId` = `s`.`SquadId` AND `t`.`GearNickName` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -413,7 +410,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `s`.`Nickname` """); } @@ -460,7 +457,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY NOT (`s`.`HasSoulPatch`), `s`.`Nickname` DESC, `t`.`Id`, `s`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY NOT (`s`.`HasSoulPatch`), `s`.`Nickname` DESC, `t`.`Id`, `s`.`SquadId`, `s0`.`Nickname` """); } @@ -478,7 +475,7 @@ public override async Task Include_with_join_and_inheritance2(bool async) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -505,7 +502,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `s0`.`Nickname` """); } @@ -1459,7 +1456,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1481,7 +1478,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`), FALSE) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1500,7 +1497,7 @@ END AS `Discriminator` SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')), FALSE) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1522,7 +1519,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1545,7 +1542,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC)) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1568,7 +1565,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -2134,7 +2131,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -2158,7 +2155,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -2183,7 +2180,7 @@ END AS `Discriminator` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2210,7 +2207,7 @@ END AS `Discriminator` LEFT JOIN `Weapons` AS `w0` ON `s`.`FullName` = `w0`.`OwnerFullName` LEFT JOIN `Weapons` AS `w1` ON `s`.`FullName` = `w1`.`OwnerFullName` LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } @@ -2236,7 +2233,7 @@ END AS `Discriminator` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2261,7 +2258,7 @@ END AS `Discriminator` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2289,7 +2286,7 @@ END AS `Discriminator` LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` LEFT JOIN `Weapons` AS `w3` ON `s`.`FullName` = `w3`.`OwnerFullName` LEFT JOIN `Weapons` AS `w4` ON `g`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id`, `w4`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } @@ -2673,7 +2670,7 @@ END AS `Discriminator` WHERE `g0`.`Nickname` <> 'Dom' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -2962,7 +2959,7 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE `g`.`FullName` <> 'Augustus Cole' AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -3054,7 +3051,7 @@ WHERE EXISTS ( SELECT 1 FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName`) AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3196,7 +3193,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool async FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3212,7 +3209,7 @@ END AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3226,7 +3223,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3240,7 +3237,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool asy FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3379,7 +3376,7 @@ END AS `Discriminator` LEFT JOIN `LocustCommanders` AS `l3` ON `l2`.`Name` = `l3`.`Name` ) AS `s0` ON `f`.`Id` = `s0`.`LocustHordeId` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id`, `s0`.`Name` +ORDER BY `f`.`Name`, `f`.`Id` """); } @@ -3705,7 +3702,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` INNER JOIN `Cities` AS `c` ON `g0`.`CityOfBirthName` = `c`.`Name` ) AS `s0` ON `s`.`Nickname` IS NOT NULL AND `s`.`SquadId` IS NOT NULL AND `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `l`.`Name`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `l`.`Name`, `s0`.`Nickname` """); } @@ -3790,7 +3787,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3812,7 +3809,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3834,7 +3831,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3851,7 +3848,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3871,7 +3868,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -3905,7 +3902,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s1` ON `s0`.`Nickname` IS NOT NULL AND `s0`.`SquadId` IS NOT NULL AND `s0`.`Nickname` = `s1`.`LeaderNickname` AND `s0`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `f`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `f`.`Id`, `s1`.`Nickname` """); } @@ -3934,7 +3931,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o1` ON `g1`.`Nickname` = `o1`.`Nickname` AND `g1`.`SquadId` = `o1`.`SquadId` ) AS `s` ON `g0`.`Nickname` = `s`.`LeaderNickname` AND `g0`.`SquadId` = `s`.`LeaderSquadId` ) AS `s0` ON `g`.`Nickname` = `s0`.`LeaderNickname` AND `g`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -3963,7 +3960,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `l1`.`DefeatedByNickname` = `s`.`Nickname` AND `l1`.`DefeatedBySquadId` = `s`.`SquadId` ) AS `s0` ON `f`.`Id` = `s0`.`LocustHordeId` -ORDER BY `f`.`Id`, `s0`.`Name` +ORDER BY `f`.`Id` """); } @@ -3997,7 +3994,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s1` ON `s0`.`Nickname` IS NOT NULL AND `s0`.`SquadId` IS NOT NULL AND `s0`.`Nickname` = `s1`.`LeaderNickname` AND `s0`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `f`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `f`.`Id`, `s1`.`Nickname` """); } @@ -4312,7 +4309,7 @@ LEFT JOIN ( WHERE `s0`.`MissionId` <> 17 ) AS `s1` ON `s`.`Id` = `s1`.`SquadId` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`SquadId`, `s1`.`MissionId` """); } @@ -4352,7 +4349,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4375,7 +4372,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4398,7 +4395,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4836,7 +4833,7 @@ ORDER BY `g`.`Nickname` OFFSET 0 ROWS ) AS `s0` ) AS `s1` -ORDER BY `s`.`Name`, `s`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `s`.`Name`, `s`.`Id`, `s1`.`Nickname` """); } @@ -5221,7 +5218,7 @@ END AS `Discriminator` ORDER BY `t`.`Note` ) AS `s0` LEFT JOIN `Weapons` AS `w` ON `s0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s0`.`Note`, `s0`.`Name`, `w`.`Id` +ORDER BY `s0`.`Note`, `s0`.`Name` """); } @@ -5725,7 +5722,7 @@ END AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `s`.`Id`, `s0`.`Nickname` """); } @@ -5804,7 +5801,7 @@ END AS `Discriminator` ORDER BY ( SELECT COUNT(*) FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` + WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -5831,7 +5828,7 @@ ORDER BY NOT (( SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` + ORDER BY `w`.`Id`)), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -5858,7 +5855,7 @@ ORDER BY NOT (COALESCE(( SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`), FALSE)), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` + ORDER BY `w`.`Id`), FALSE)), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -5883,7 +5880,7 @@ WHERE NOT (`g0`.`HasSoulPatch`) ORDER BY ( SELECT COUNT(*) FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` + WHERE `g`.`FullName` = `w`.`OwnerFullName`), `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -6212,7 +6209,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -6225,7 +6222,7 @@ public override async Task Double_order_by_on_Like(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -6238,7 +6235,7 @@ public override async Task Double_order_by_on_is_null(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -6262,7 +6259,7 @@ public override async Task Double_order_by_binary_expression(bool async) """ SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` -ORDER BY `w`.`Id` + 2, `w`.`Id` +ORDER BY `w`.`Id` + 2 """); } @@ -6275,7 +6272,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -6288,7 +6285,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -6301,7 +6298,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY COALESCE(`w0`.`Name`, '') & (5 & ''), `w`.`Id` +ORDER BY COALESCE(`w0`.`Name`, '') & (5 & '') """); } @@ -6314,7 +6311,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY COALESCE(`w0`.`Name`, '') & 'Marcus'' Lancer', `w`.`Id` +ORDER BY COALESCE(`w0`.`Name`, '') & 'Marcus'' Lancer' """); } @@ -6485,7 +6482,7 @@ public override async Task Include_collection_with_Cast_to_base(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6516,7 +6513,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6537,7 +6534,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -6863,7 +6860,7 @@ public override async Task Include_with_complex_order_by(bool async) ORDER BY ( SELECT TOP 1 `w`.`Name` FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Gnasher%')), `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` + WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Gnasher%')), `g`.`Nickname`, `g`.`SquadId` """); } @@ -7404,7 +7401,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` LEFT JOIN `Squads` AS `s0` ON `s`.`SquadId` = `s0`.`Id` -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7465,7 +7462,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `s` -ORDER BY `s`.`FullName`, `s`.`SquadId` +ORDER BY `s`.`FullName` """); } @@ -7544,7 +7541,7 @@ END AS `Discriminator` ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -7738,7 +7735,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo END AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -7753,7 +7750,6 @@ public override async Task OrderBy_Contains_empty_list(bool async) END AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -ORDER BY `g`.`SquadId` """); } @@ -7851,7 +7847,7 @@ END AS `Discriminator` """ @ranks='134' -SELECT (`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`g`.`Rank` BOR `g`.`Rank`) BOR @ranks) BOR `g`.`Rank`) BOR @ranks) = @ranks FROM `Gears` AS `g` """); } @@ -8072,7 +8068,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -9235,7 +9231,7 @@ LEFT JOIN ( ) AS `w1` WHERE `w1`.`row` <= 1 ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -9510,7 +9506,7 @@ END AS `Discriminator` ) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` WHERE `l`.`Name` LIKE '%Queen%' -ORDER BY `l`.`Name`, `w`.`Id` +ORDER BY `l`.`Name` """); } @@ -10164,7 +10160,7 @@ END AS `Discriminator` FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -10187,7 +10183,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -10425,7 +10421,7 @@ public override async Task Include_one_to_many_on_composite_key_then_orderby_key FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`SquadId`, `g`.`Nickname`, `w`.`Id` +ORDER BY `g`.`SquadId`, `g`.`Nickname` """); } @@ -10465,7 +10461,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -10482,7 +10478,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -10500,7 +10496,7 @@ END AS `Discriminator` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -10523,7 +10519,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -10542,7 +10538,7 @@ END AS `Discriminator` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` LEFT JOIN `Weapons` AS `w0` ON `s`.`FullName` = `w0`.`OwnerFullName` LEFT JOIN `Weapons` AS `w1` ON `s`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` """); } @@ -10565,7 +10561,7 @@ END AS `Discriminator` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedFixture.cs similarity index 84% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedFixture.cs index f741db96..b1fc7091 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; @@ -8,7 +5,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTInheritanceQueryLibRedFixture : TPTInheritanceQueryFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedTest.cs similarity index 98% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedTest.cs index 6764b79c..0731f461 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - // ReSharper disable InconsistentNaming using System.Threading.Tasks; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTInheritanceQueryLibRedTest(TPTInheritanceQueryLibRedFixture fixture, ITestOutputHelper testOutputHelper) : TPTInheritanceQueryTestBase(fixture, testOutputHelper) @@ -51,7 +48,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`Name` = 'Great spotted kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -73,7 +70,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` ) AS `s` ON `c`.`Id` = `s`.`CountryId` -ORDER BY `c`.`Name`, `c`.`Id`, `s`.`Id` +ORDER BY `c`.`Name`, `c`.`Id` """); } @@ -100,7 +97,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e0` ON `a0`.`Id` = `e0`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a0`.`Id` = `k`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`EagleId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """); } @@ -121,7 +118,7 @@ END AS `Discriminator` LEFT JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -139,7 +136,7 @@ END AS `Discriminator` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -331,7 +328,7 @@ END AS `Discriminator` LEFT JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -350,7 +347,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -388,7 +385,7 @@ END AS `Discriminator` LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -480,7 +477,7 @@ public override async Task Member_access_on_intermediate_type_works() FROM `Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id` INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Name`, `a`.`Id` +ORDER BY `a`.`Name` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyNoTrackingQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryLibRedTest.cs index a0a9a85b..e1c0af34 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTManyToManyNoTrackingQueryLibRedTest : TPTManyToManyNoTrackingQueryRelationalTestBase< TPTManyToManyQueryLibRedFixture> @@ -383,7 +380,7 @@ INNER JOIN ( INNER JOIN `Leaves` AS `l` ON `r`.`Id` = `l`.`Id` ) AS `s` ON `j`.`LeafId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2` """); } @@ -451,7 +448,7 @@ SELECT TOP 1 `e3`.`Id` INNER JOIN `EntityThrees` AS `e3` ON `j`.`ThreeId` = `e3`.`Id` WHERE `e0`.`Key1` = `j`.`CompositeId1` AND `e0`.`Key2` = `j`.`CompositeId2` AND `e0`.`Key3` = `j`.`CompositeId3` ORDER BY `e3`.`Id`) -ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2`, `e0`.`Key3` +ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2` """); } @@ -610,7 +607,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -637,7 +634,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -686,7 +683,7 @@ END AS `Discriminator` LEFT JOIN `Leaf2s` AS `l0` ON `r`.`Id` = `l0`.`Id` ) AS `s` ON `e0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -704,7 +701,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -772,7 +769,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -790,7 +787,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -849,7 +846,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -870,7 +867,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id` """); } @@ -901,7 +898,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s` ON `e0`.`Id` = `s`.`ThreeId` ) AS `s0` ON `r`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -935,7 +932,7 @@ LEFT JOIN ( WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e0`.`Key1` = `s0`.`CompositeId1` AND `e0`.`Key2` = `s0`.`CompositeId2` AND `e0`.`Key3` = `s0`.`CompositeId3` ) AS `s1` ON `r`.`Id` = `s1`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id`, `s1`.`Id0` +ORDER BY `r`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id` """); } @@ -960,7 +957,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `r`.`Id` = `s0`.`LeafId` -ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -989,7 +986,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -1016,7 +1013,7 @@ LEFT JOIN ( ) AS `s0` ON `e0`.`Id` = `s0`.`TwoId` WHERE `e0`.`Id` < 10 ) AS `s1` ON `e`.`Id` = `s1`.`OneId` -ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0`, `s1`.`ThreeId` """); } @@ -1036,7 +1033,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1076,7 +1073,7 @@ END AS `Discriminator` ) AS `s2` ON `e0`.`Id` = `s2`.`EntityOneId` WHERE `e0`.`Id` < 10 ) AS `s3` ON `e`.`Id` = `s3`.`ThreeId` -ORDER BY `e`.`Id`, `s3`.`OneId`, `s3`.`ThreeId`, `s3`.`OneId0`, `s3`.`Id0`, `s3`.`TwoId`, `s3`.`EntityBranchId`, `s3`.`EntityOneId` +ORDER BY `e`.`Id`, `s3`.`OneId`, `s3`.`ThreeId`, `s3`.`OneId0`, `s3`.`Id0`, `s3`.`TwoId`, `s3`.`EntityBranchId` """); } @@ -1099,7 +1096,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1122,7 +1119,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2061,7 +2058,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2091,7 +2088,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -2244,7 +2241,7 @@ END AS `Discriminator` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` WHERE `s`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2284,7 +2281,7 @@ SELECT TOP 1 `u4`.`Id` INNER JOIN `UnidirectionalEntityThrees` AS `u4` ON `u3`.`ThreeId` = `u4`.`Id` WHERE `u0`.`Key1` = `u3`.`CompositeId1` AND `u0`.`Key2` = `u3`.`CompositeId2` AND `u0`.`Key3` = `u3`.`CompositeId3` ORDER BY `u4`.`Id`) -ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2`, `u0`.`Key3` +ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2` """); } @@ -2396,7 +2393,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2421,7 +2418,7 @@ END AS `Discriminator` LEFT JOIN `UnidirectionalLeaves` AS `u3` ON `u1`.`Id` = `u3`.`Id` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2439,7 +2436,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id` LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2525,7 +2522,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2562,7 +2559,7 @@ LEFT JOIN ( ) AS `s` WHERE 2 < `s`.`row` ) AS `s0` ON `u`.`Id` = `s0`.`UnidirectionalEntityTwoId` -ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id` +ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id`, `s0`.`SelfSkipSharedRightId` """); } @@ -2583,7 +2580,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2603,7 +2600,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `u`.`Key1` = `s0`.`CompositeId1` AND `u`.`Key2` = `s0`.`CompositeId2` AND `u`.`Key3` = `s0`.`CompositeId3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id` """); } @@ -2628,7 +2625,7 @@ LEFT JOIN ( ) AS `s` ON `u3`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u3`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u3`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u3`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2648,7 +2645,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2767,6 +2764,93 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u` +CROSS JOIN ( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyQueryLibRedFixture.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedFixture.cs similarity index 79% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyQueryLibRedFixture.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedFixture.cs index 244e7ebc..562e6eef 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTManyToManyQueryLibRedFixture : TPTManyToManyQueryRelationalFixture { diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedTest.cs index ee0c082b..40b203de 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTManyToManyQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTManyToManyQueryLibRedTest : TPTManyToManyQueryRelationalTestBase { @@ -382,7 +379,7 @@ INNER JOIN ( INNER JOIN `Leaves` AS `l` ON `r`.`Id` = `l`.`Id` ) AS `s` ON `j`.`LeafId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2` """); } @@ -450,7 +447,7 @@ SELECT TOP 1 `e3`.`Id` INNER JOIN `EntityThrees` AS `e3` ON `j`.`ThreeId` = `e3`.`Id` WHERE `e0`.`Key1` = `j`.`CompositeId1` AND `e0`.`Key2` = `j`.`CompositeId2` AND `e0`.`Key3` = `j`.`CompositeId3` ORDER BY `e3`.`Id`) -ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2`, `e0`.`Key3` +ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2` """); } @@ -609,7 +606,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -636,7 +633,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -685,7 +682,7 @@ END AS `Discriminator` LEFT JOIN `Leaf2s` AS `l0` ON `r`.`Id` = `l0`.`Id` ) AS `s` ON `e0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -703,7 +700,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -771,7 +768,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -789,7 +786,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -848,7 +845,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -869,7 +866,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0` """); } @@ -900,7 +897,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s` ON `e0`.`Id` = `s`.`ThreeId` ) AS `s0` ON `r`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -934,7 +931,7 @@ LEFT JOIN ( WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e0`.`Key1` = `s0`.`CompositeId1` AND `e0`.`Key2` = `s0`.`CompositeId2` AND `e0`.`Key3` = `s0`.`CompositeId3` ) AS `s1` ON `r`.`Id` = `s1`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id0`, `s1`.`Id` +ORDER BY `r`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id0` """); } @@ -959,7 +956,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `r`.`Id` = `s0`.`LeafId` -ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -988,7 +985,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -1015,7 +1012,7 @@ LEFT JOIN ( ) AS `s0` ON `e0`.`Id` = `s0`.`TwoId` WHERE `e0`.`Id` < 10 ) AS `s1` ON `e`.`Id` = `s1`.`OneId` -ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0`, `s1`.`ThreeId` """); } @@ -1035,7 +1032,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1075,7 +1072,7 @@ END AS `Discriminator` ) AS `s2` ON `e0`.`Id` = `s2`.`EntityOneId` WHERE `e0`.`Id` < 10 ) AS `s3` ON `e`.`Id` = `s3`.`ThreeId` -ORDER BY `e`.`Id`, `s3`.`OneId`, `s3`.`ThreeId`, `s3`.`OneId0`, `s3`.`Id0`, `s3`.`TwoId`, `s3`.`EntityBranchId`, `s3`.`EntityOneId` +ORDER BY `e`.`Id`, `s3`.`OneId`, `s3`.`ThreeId`, `s3`.`OneId0`, `s3`.`Id0`, `s3`.`TwoId`, `s3`.`EntityBranchId` """); } @@ -1098,7 +1095,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1121,7 +1118,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2068,7 +2065,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2098,7 +2095,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -2244,7 +2241,7 @@ END AS `Discriminator` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` WHERE `s`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2284,7 +2281,7 @@ SELECT TOP 1 `u4`.`Id` INNER JOIN `UnidirectionalEntityThrees` AS `u4` ON `u3`.`ThreeId` = `u4`.`Id` WHERE `u0`.`Key1` = `u3`.`CompositeId1` AND `u0`.`Key2` = `u3`.`CompositeId2` AND `u0`.`Key3` = `u3`.`CompositeId3` ORDER BY `u4`.`Id`) -ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2`, `u0`.`Key3` +ORDER BY `u`.`Key1`, `u0`.`Key1`, `u`.`Key2`, `u0`.`Key2` """); } @@ -2396,7 +2393,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2421,7 +2418,7 @@ END AS `Discriminator` LEFT JOIN `UnidirectionalLeaves` AS `u3` ON `u1`.`Id` = `u3`.`Id` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2439,7 +2436,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id` LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2547,7 +2544,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2585,7 +2582,7 @@ LEFT JOIN ( ) AS `s` WHERE 2 < `s`.`row` ) AS `s0` ON `u`.`Id` = `s0`.`UnidirectionalEntityTwoId` -ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id` +ORDER BY `u`.`Id`, `s0`.`UnidirectionalEntityTwoId`, `s0`.`Id`, `s0`.`SelfSkipSharedRightId` """); } @@ -2606,7 +2603,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -2627,7 +2624,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `u`.`Key1` = `s0`.`CompositeId1` AND `u`.`Key2` = `s0`.`CompositeId2` AND `u`.`Key3` = `s0`.`CompositeId3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0`, `s0`.`Id` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0` """); } @@ -2652,7 +2649,7 @@ LEFT JOIN ( ) AS `s` ON `u3`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u3`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u3`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u3`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2672,7 +2669,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2790,6 +2787,93 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u` +CROSS JOIN ( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTRelationshipsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTRelationshipsQueryLibRedTest.cs rename to test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryLibRedTest.cs index 13783077..166fe4c3 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/TPTRelationshipsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.Extended.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.Extended.FunctionalTests.Query.Inheritance; public class TPTRelationshipsQueryLibRedTest : TPTRelationshipsQueryTestBase @@ -51,7 +48,7 @@ END AS `Discriminator` FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`BaseParentId` -ORDER BY `s`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -69,7 +66,7 @@ public override async Task Include_collection_without_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `b`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -109,7 +106,7 @@ public override async Task Include_collection_without_inheritance_with_filter(bo LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `b`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -155,7 +152,7 @@ END AS `Discriminator` FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -177,7 +174,7 @@ END AS `Discriminator` FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -199,7 +196,7 @@ END AS `Discriminator` FROM `BaseCollectionsOnDerived` AS `b1` LEFT JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -219,7 +216,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnDerived` AS `b1` INNER JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -290,7 +287,7 @@ END AS `Discriminator` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -785,7 +782,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -816,7 +813,7 @@ END AS `Discriminator` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s` ON `b1`.`Id` = `s`.`ParentCollectionId` ) AS `s0` ON `b`.`Id` = `s0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` """); } @@ -878,7 +875,7 @@ END AS `Discriminator` LEFT JOIN `NestedReferencesDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s` ON `b1`.`Id` = `s`.`ParentCollectionId` ) AS `s0` ON `b`.`Id` = `s0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -940,7 +937,7 @@ END AS `Discriminator` FROM `NestedCollections` AS `n` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -969,7 +966,7 @@ END AS `Discriminator` FROM `NestedCollections` AS `n` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -1133,7 +1130,7 @@ LEFT JOIN ( INNER JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Id` >= 4 -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs index 1b951067..4d9c0378 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs @@ -196,7 +196,7 @@ public override async Task Include_collection_with_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -227,7 +227,7 @@ public override async Task Include_collection_with_inheritance_with_filter(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -258,7 +258,7 @@ public override async Task Include_collection_without_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -289,7 +289,7 @@ public override async Task Include_collection_without_inheritance_with_filter(bo LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -515,7 +515,7 @@ public override async Task Include_collection_with_inheritance_on_derived1(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -531,7 +531,7 @@ public override async Task Include_collection_with_inheritance_on_derived2(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `BaseCollectionsOnDerived` AS `b2` ON `b`.`Id` = `b2`.`ParentId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -551,7 +551,7 @@ LEFT JOIN ( WHERE `b2`.`Discriminator` = 'DerivedCollectionOnDerived' ) AS `b3` ON `b`.`Id` = `b3`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b3`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -635,7 +635,7 @@ public override async Task Nested_include_with_inheritance_reference_collection( LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b1` ON `b`.`Id` = `b1`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b2` ON `b`.`Id` = `b2`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `NestedCollections` AS `n` ON `b0`.`Id` = `n`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id`, `n`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id` """); } @@ -652,7 +652,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b2` ON `b`.`Id` = `b2`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `NestedCollections` AS `n` ON `b0`.`Id` = `n`.`ParentReferenceId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id`, `n`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id` """); } @@ -687,7 +687,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b2` LEFT JOIN `NestedReferences` AS `n` ON `b2`.`Id` = `n`.`ParentCollectionId` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -722,7 +722,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b2` LEFT JOIN `NestedCollections` AS `n` ON `b2`.`Id` = `n`.`ParentCollectionId` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id` """); } @@ -755,7 +755,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -768,7 +768,7 @@ public override async Task Collection_projection_on_base_type(bool async) SELECT `b`.`Id`, `b0`.`Id`, `b0`.`BaseParentId`, `b0`.`Discriminator`, `b0`.`Name`, `b0`.`DerivedProperty` FROM `BaseEntities` AS `b` LEFT JOIN `BaseCollectionsOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`Id` +ORDER BY `b`.`Id` """); } @@ -788,7 +788,7 @@ LEFT JOIN ( WHERE `b2`.`Discriminator` = 'DerivedCollectionOnDerived' ) AS `b3` ON `b`.`Id` = `b3`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Id` >= 4 -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b3`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -1556,7 +1556,7 @@ public override void Changes_in_derived_related_entities_are_detected() LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b3`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId` LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b3`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId` LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b3`.`Id` = `b2`.`BaseParentId` -ORDER BY `b3`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b3`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs index 793526e4..4df82b45 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs @@ -370,7 +370,7 @@ INNER JOIN ( WHERE `e0`.`Discriminator` = 'EntityLeaf' ) AS `e1` ON `j`.`LeafId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -388,7 +388,7 @@ LEFT JOIN ( INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` WHERE `e1`.`Discriminator` = 'EntityLeaf' ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -428,7 +428,7 @@ SELECT TOP 1 `e3`.`Id` INNER JOIN `EntityThrees` AS `e3` ON `j`.`ThreeId` = `e3`.`Id` WHERE `e0`.`Key1` = `j`.`CompositeId1` AND `e0`.`Key2` = `j`.`CompositeId2` AND `e0`.`Key3` = `j`.`CompositeId3` ORDER BY `e3`.`Id`) -ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2`, `e0`.`Key3` +ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2` """); } @@ -574,7 +574,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -601,7 +601,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -639,7 +639,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityRoot` AS `e0` INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -657,7 +657,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -724,7 +724,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -742,7 +742,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -801,7 +801,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -822,7 +822,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id` """); } @@ -845,7 +845,7 @@ LEFT JOIN ( WHERE `e2`.`Id` < 10 ) AS `s` ON `e1`.`Id` = `s`.`ThreeId` ) AS `s0` ON `e`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -871,7 +871,7 @@ LEFT JOIN ( WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e1`.`Key1` = `s0`.`CompositeId1` AND `e1`.`Key2` = `s0`.`CompositeId2` AND `e1`.`Key3` = `s0`.`CompositeId3` ) AS `s1` ON `e`.`Id` = `s1`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id` """); } @@ -895,7 +895,7 @@ LEFT JOIN ( WHERE `e0`.`Key1` < 5 ) AS `s0` ON `e`.`Id` = `s0`.`LeafId` WHERE `e`.`Discriminator` = 'EntityLeaf' -ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -924,7 +924,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -951,7 +951,7 @@ LEFT JOIN ( ) AS `s0` ON `e0`.`Id` = `s0`.`TwoId` WHERE `e0`.`Id` < 10 ) AS `s1` ON `e`.`Id` = `s1`.`OneId` -ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0`, `s1`.`ThreeId` """); } @@ -971,7 +971,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1008,7 +1008,7 @@ INNER JOIN ( ) AS `s1` ON `e0`.`Id` = `s1`.`EntityOneId` WHERE `e0`.`Id` < 10 ) AS `s2` ON `e`.`Id` = `s2`.`ThreeId` -ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId`, `s2`.`EntityOneId` +ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId` """); } @@ -1031,7 +1031,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1054,7 +1054,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs index 1a3255e6..e79d95b5 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs @@ -370,7 +370,7 @@ INNER JOIN ( WHERE `e0`.`Discriminator` = 'EntityLeaf' ) AS `e1` ON `j`.`LeafId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -388,7 +388,7 @@ LEFT JOIN ( INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` WHERE `e1`.`Discriminator` = 'EntityLeaf' ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -428,7 +428,7 @@ SELECT TOP 1 `e3`.`Id` INNER JOIN `EntityThrees` AS `e3` ON `j`.`ThreeId` = `e3`.`Id` WHERE `e0`.`Key1` = `j`.`CompositeId1` AND `e0`.`Key2` = `j`.`CompositeId2` AND `e0`.`Key3` = `j`.`CompositeId3` ORDER BY `e3`.`Id`) -ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2`, `e0`.`Key3` +ORDER BY `e`.`Key1`, `e0`.`Key1`, `e`.`Key2`, `e0`.`Key2` """); } @@ -574,7 +574,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -601,7 +601,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -639,7 +639,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityRoot` AS `e0` INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -657,7 +657,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -724,7 +724,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -742,7 +742,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -801,7 +801,7 @@ LEFT JOIN ( ) AS `s` WHERE `s`.`row` <= 2 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3`, `s0`.`Id`, `s0`.`TwoSkipSharedId` """); } @@ -822,7 +822,7 @@ LEFT JOIN ( ) AS `s` WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0`, `s0`.`Id` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`Id0` """); } @@ -845,7 +845,7 @@ LEFT JOIN ( WHERE `e2`.`Id` < 10 ) AS `s` ON `e1`.`Id` = `s`.`ThreeId` ) AS `s0` ON `e`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -871,7 +871,7 @@ LEFT JOIN ( WHERE 1 < `s`.`row` AND `s`.`row` <= 3 ) AS `s0` ON `e1`.`Key1` = `s0`.`CompositeId1` AND `e1`.`Key2` = `s0`.`CompositeId2` AND `e1`.`Key3` = `s0`.`CompositeId3` ) AS `s1` ON `e`.`Id` = `s1`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id0`, `s1`.`Id` +ORDER BY `e`.`Id`, `s1`.`RootSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3`, `s1`.`CompositeId1`, `s1`.`CompositeId2`, `s1`.`CompositeId3`, `s1`.`Id0` """); } @@ -895,7 +895,7 @@ LEFT JOIN ( WHERE `e0`.`Key1` < 5 ) AS `s0` ON `e`.`Id` = `s0`.`LeafId` WHERE `e`.`Discriminator` = 'EntityLeaf' -ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -924,7 +924,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` ) AS `s1` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId`, `s1`.`TwoId0` +ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`ThreeId` """); } @@ -951,7 +951,7 @@ LEFT JOIN ( ) AS `s0` ON `e0`.`Id` = `s0`.`TwoId` WHERE `e0`.`Id` < 10 ) AS `s1` ON `e`.`Id` = `s1`.`OneId` -ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`OneId`, `s1`.`TwoId`, `s1`.`TwoId0`, `s1`.`Id0`, `s1`.`ThreeId` """); } @@ -971,7 +971,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1008,7 +1008,7 @@ INNER JOIN ( ) AS `s1` ON `e0`.`Id` = `s1`.`EntityOneId` WHERE `e0`.`Id` < 10 ) AS `s2` ON `e`.`Id` = `s2`.`ThreeId` -ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId`, `s2`.`EntityOneId` +ORDER BY `e`.`Id`, `s2`.`OneId`, `s2`.`ThreeId`, `s2`.`OneId0`, `s2`.`Id0`, `s2`.`TwoId`, `s2`.`EntityBranchId` """); } @@ -1031,7 +1031,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1054,7 +1054,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -1798,6 +1798,97 @@ SELECT 1 """); } + #region Non-shared tests + + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u` +CROSS JOIN ( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM `ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id` +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + + #endregion Non-shared tests + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs index 8df24f62..3284a66d 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs @@ -885,7 +885,7 @@ public override async Task OrderBy_client_Take(bool async) SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -ORDER BY 1, `e`.`EmployeeID` +ORDER BY 1 """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs index 4dc3050f..27756b18 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs @@ -58,14 +58,14 @@ public override void Query_ending_with_include() SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -275,7 +275,7 @@ public override async Task Compiled_query_with_max_parameters() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -343,7 +343,7 @@ SELECT COUNT(*) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -762,7 +762,7 @@ public override void Query_with_single_parameter_with_include() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @customerID -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -772,7 +772,7 @@ public override void Query_with_single_parameter_with_include() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @customerID -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs index d7077eda..d4c3c50a 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs @@ -45,7 +45,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -62,7 +62,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -77,7 +77,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -91,7 +91,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -131,7 +131,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`OrderDate` DESC) DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -165,7 +165,7 @@ public override async Task Include_collection_skip_take_no_order_by(bool async) OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -228,7 +228,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -243,7 +243,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -261,7 +261,7 @@ CROSS JOIN ( WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -289,7 +289,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -308,7 +308,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -347,7 +347,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -370,7 +370,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -414,7 +414,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` """); } @@ -457,7 +457,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -492,7 +492,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -507,7 +507,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -533,7 +533,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `c2` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } @@ -547,7 +547,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -625,7 +625,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -647,7 +647,7 @@ ORDER BY NOT (`c`.`CustomerID` <> @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -708,7 +708,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -741,7 +741,7 @@ ORDER BY `c`.`ContactTitle` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -756,7 +756,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -801,7 +801,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -819,7 +819,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -833,7 +833,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -872,7 +872,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1` CROSS JOIN `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -895,7 +895,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -985,7 +985,7 @@ ORDER BY NOT (FALSE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1001,7 +1001,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1169,7 +1169,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1185,7 +1185,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1269,7 +1269,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1341,7 +1341,7 @@ CROSS JOIN `Order Details` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1363,7 +1363,7 @@ ORDER BY NOT (`c`.`CustomerID` = @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1445,7 +1445,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1487,7 +1487,7 @@ ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` """); } @@ -1517,7 +1517,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1533,7 +1533,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1558,7 +1558,7 @@ ORDER BY `c`.`ContactName` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName`, `c0`.`CustomerID` """); } @@ -1587,7 +1587,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1633,7 +1633,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1662,7 +1662,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1676,7 +1676,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1716,7 +1716,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1762,7 +1762,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1791,7 +1791,7 @@ CROSS JOIN `Orders` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1808,7 +1808,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1829,7 +1829,7 @@ ORDER BY NOT (TRUE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1912,7 +1912,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`EmployeeID`) ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -1927,7 +1927,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1991,7 +1991,7 @@ public override async Task Include_collection_skip_no_order_by(bool async) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2009,7 +2009,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2026,7 +2026,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2067,7 +2067,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -2099,7 +2099,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -2128,7 +2128,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2145,7 +2145,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy ORDER BY CASE WHEN `c`.`CustomerID` LIKE 'S%' THEN 1 ELSE 2 -END, `c`.`CustomerID`, `o`.`OrderID` +END, `c`.`CustomerID` """); } @@ -2200,7 +2200,7 @@ ORDER BY `o`.`OrderID` OFFSET 1 ROWS ) AS `o0` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderDate` DESC, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o0`.`OrderDate` DESC """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs index 29febc32..621e3cc9 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs @@ -136,7 +136,7 @@ public override async Task Order_by_length_twice_followed_by_projection_of_naked SELECT `c`.`CustomerID`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY LEN(`c`.`CustomerID`), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY LEN(`c`.`CustomerID`), `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs index 2d4be30a..df11d8a2 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs @@ -2083,7 +2083,7 @@ OUTER APPLY ( GROUP BY `o0`.`OrderID` ) AS `o1` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o1`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2101,7 +2101,7 @@ OUTER APPLY ( GROUP BY `o`.`OrderID` ) AS `o0` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2124,7 +2124,7 @@ SELECT COUNT(*) AS `c`, `p0`.`ProductID` GROUP BY `p0`.`ProductID` ) AS `p2` WHERE `o`.`CustomerID` LIKE 'A%' -ORDER BY `o`.`OrderID`, `p1`.`ProductID`, `p2`.`ProductID` +ORDER BY `o`.`OrderID`, `p1`.`ProductID` """); } @@ -2538,7 +2538,7 @@ public override async Task GroupBy_select_grouping_list(bool async) GROUP BY `c`.`City` ) AS `c1` LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -2555,7 +2555,7 @@ public override async Task GroupBy_select_grouping_array(bool async) GROUP BY `c`.`City` ) AS `c1` LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -2576,7 +2576,7 @@ LEFT JOIN ( FROM `Customers` AS `c0` WHERE `c0`.`CustomerID` LIKE 'A%' ) AS `c2` ON `c1`.`City` = `c2`.`City` -ORDER BY `c1`.`City`, `c2`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -3334,7 +3334,7 @@ LEFT JOIN ( ) AS `o3` WHERE `o3`.`row` <= 1 ) AS `o4` ON `o2`.`CustomerID` = `o4`.`CustomerID` -ORDER BY `c`.`City`, `o4`.`OrderID`, `o2`.`CustomerID` +ORDER BY `c`.`City`, `o4`.`OrderID` """); } @@ -3472,7 +3472,7 @@ LEFT JOIN ( ) AS `o4` WHERE `o4`.`row` <= 1 ) AS `o5` ON `o3`.`CustomerID` = `o5`.`CustomerID` -ORDER BY `o3`.`c`, `o3`.`c0`, `o3`.`CustomerID` +ORDER BY `o3`.`c`, `o3`.`c0` """); } @@ -3507,7 +3507,7 @@ INNER JOIN ( FROM `Orders` AS `o` GROUP BY `o`.`CustomerID` ) AS `o0` ON `c`.`CustomerID` = `o0`.`Key` -ORDER BY `o0`.`Max`, `c`.`CustomerID`, `o0`.`Key` +ORDER BY `o0`.`Max`, `c`.`CustomerID` OFFSET @p ROWS FETCH NEXT @p ROWS ONLY """); } @@ -3629,7 +3629,7 @@ public override async Task GroupBy_selecting_grouping_key_list(bool async) GROUP BY `o`.`CustomerID` ) AS `o1` LEFT JOIN `Orders` AS `o0` ON `o1`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o1`.`CustomerID`, `o0`.`OrderID` +ORDER BY `o1`.`CustomerID` """); } @@ -3689,7 +3689,7 @@ SELECT COALESCE(SUM(`o`.`OrderID`), 0) AS `Sum`, `o`.`CustomerID` WHERE `c`.`CustomerID` = `o`.`CustomerID` GROUP BY `o`.`CustomerID` ) AS `o0` -ORDER BY `c`.`CustomerID`, `o0`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -3707,7 +3707,7 @@ SELECT MAX(LEN(`o`.`CustomerID`)) AS `Max`, COALESCE(SUM(`o`.`OrderID`), 0) AS ` WHERE `c`.`CustomerID` = `o`.`CustomerID` GROUP BY `o`.`CustomerID` ) AS `o0` -ORDER BY `c`.`CustomerID`, `o0`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -3724,7 +3724,7 @@ SELECT MAX(LEN(`o`.`CustomerID`)) AS `Max`, COALESCE(SUM(`o`.`OrderID`), 0) AS ` FROM `Orders` AS `o` GROUP BY `o`.`CustomerID` ) AS `o0` -ORDER BY `c`.`CustomerID`, `o0`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -3841,7 +3841,7 @@ LEFT JOIN ( ) AS `o3` ON `o1`.`CustomerID` = `o3`.`CustomerID` ) AS `s` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `s`.`CustomerID0` +ORDER BY `c`.`CustomerID` """); } @@ -3949,7 +3949,7 @@ SELECT COUNT(*) AS `c`, `p0`.`ProductID` FROM `Products` AS `p0` GROUP BY `p0`.`ProductID` ) AS `p2` -ORDER BY `s`.`City`, `p1`.`ProductID`, `p2`.`ProductID` +ORDER BY `s`.`City`, `p1`.`ProductID` """); } @@ -3967,7 +3967,7 @@ GROUP BY `c`.`CustomerID` HAVING `c`.`CustomerID` LIKE 'F%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -3985,7 +3985,7 @@ GROUP BY `o`.`CustomerID` HAVING `o`.`CustomerID` LIKE 'F%' ) AS `o1` LEFT JOIN `Orders` AS `o0` ON `o1`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o1`.`CustomerID`, `o0`.`OrderID` +ORDER BY `o1`.`CustomerID` """); } @@ -4056,7 +4056,7 @@ public override async Task Final_GroupBy_property_entity(bool async) """ SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4070,7 +4070,7 @@ public override async Task Final_GroupBy_entity(bool async) FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` WHERE `o`.`OrderID` < 10500 -ORDER BY `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` """); } @@ -4083,7 +4083,7 @@ public override async Task Final_GroupBy_property_entity_non_nullable(bool async SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` FROM `Order Details` AS `o` WHERE `o`.`OrderID` < 10500 -ORDER BY `o`.`OrderID`, `o`.`ProductID` +ORDER BY `o`.`OrderID` """); } @@ -4095,7 +4095,7 @@ public override async Task Final_GroupBy_property_anonymous_type(bool async) """ SELECT `c`.`City`, `c`.`ContactName`, `c`.`ContactTitle` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4107,7 +4107,7 @@ public override async Task Final_GroupBy_multiple_properties_entity(bool async) """ SELECT `c`.`City`, `c`.`Region`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`Region`, `c`.`CustomerID` +ORDER BY `c`.`City`, `c`.`Region` """); } @@ -4122,7 +4122,7 @@ public override async Task Final_GroupBy_complex_key_entity(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, 1 AS `Constant` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`City`, `c0`.`Region`, `c0`.`Constant`, `c0`.`CustomerID` +ORDER BY `c0`.`City`, `c0`.`Region`, `c0`.`Constant` """); } @@ -4137,7 +4137,7 @@ public override async Task Final_GroupBy_nominal_type_entity(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, 1 AS `Constant` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`City`, `c0`.`Constant`, `c0`.`CustomerID` +ORDER BY `c0`.`City`, `c0`.`Constant` """); } @@ -4149,7 +4149,7 @@ public override async Task Final_GroupBy_property_anonymous_type_element_selecto """ SELECT `c`.`City`, `c`.`ContactName`, `c`.`ContactTitle` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4163,7 +4163,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection(bool FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4177,7 +4177,7 @@ public override async Task Final_GroupBy_property_entity_projecting_collection(b FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4195,7 +4195,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` < 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4221,7 +4221,7 @@ LEFT JOIN ( WHERE `o2`.`row` <= 1 ) AS `o3` ON `c`.`CustomerID` = `o3`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o1`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4235,7 +4235,7 @@ public override async Task Final_GroupBy_TagWith(bool async) SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs index 5ffc7be0..e7c04899 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs @@ -56,7 +56,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -85,7 +85,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -99,7 +99,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -116,7 +116,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy ORDER BY CASE WHEN `c`.`CustomerID` LIKE 'S%' THEN 1 ELSE 2 -END, `c`.`CustomerID`, `o`.`OrderID` +END, `c`.`CustomerID` """); } @@ -194,7 +194,7 @@ ORDER BY NOT (`c`.`CustomerID` <> @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -381,7 +381,7 @@ ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` """); } @@ -409,7 +409,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -428,7 +428,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -464,7 +464,7 @@ ORDER BY NOT (`c`.`CustomerID` = @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -497,7 +497,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -576,7 +576,7 @@ public override async Task Include_collection_skip_take_no_order_by(bool async) OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -675,7 +675,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1` CROSS JOIN `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -738,7 +738,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -758,7 +758,7 @@ ORDER BY `c`.`ContactName` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName`, `c0`.`CustomerID` """); } @@ -860,7 +860,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` """); } @@ -913,7 +913,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -932,7 +932,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -955,7 +955,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -984,7 +984,7 @@ CROSS JOIN `Order Details` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1027,7 +1027,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1056,7 +1056,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1070,7 +1070,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1096,7 +1096,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`EmployeeID`) ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -1158,7 +1158,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1198,7 +1198,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1251,7 +1251,7 @@ ORDER BY `c`.`ContactTitle` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -1319,7 +1319,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -1333,7 +1333,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1388,7 +1388,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`OrderDate` DESC) DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -1411,7 +1411,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1429,7 +1429,7 @@ CROSS JOIN ( WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -1448,7 +1448,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1529,7 +1529,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1574,7 +1574,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1599,7 +1599,7 @@ ORDER BY `o`.`OrderID` OFFSET 1 ROWS ) AS `o0` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderDate` DESC, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o0`.`OrderDate` DESC """); } @@ -1628,7 +1628,7 @@ CROSS JOIN `Orders` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1645,7 +1645,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1690,7 +1690,7 @@ public override async Task Include_collection_skip_no_order_by(bool async) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1707,7 +1707,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1750,7 +1750,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1776,7 +1776,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `c2` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } @@ -1819,7 +1819,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -1834,7 +1834,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -1849,7 +1849,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -2053,7 +2053,7 @@ ORDER BY NOT (FALSE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -2074,7 +2074,7 @@ ORDER BY NOT (TRUE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs index 66628a53..79f283bd 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs @@ -38,7 +38,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -77,7 +77,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -94,7 +94,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -115,7 +115,7 @@ public override async Task Include_collection_skip_no_order_by(bool async) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } } @@ -136,7 +136,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } } @@ -159,7 +159,7 @@ public override async Task Include_collection_skip_take_no_order_by(bool async) OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } } @@ -235,7 +235,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -253,7 +253,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -314,7 +314,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`OrderDate` DESC) DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -328,7 +328,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -342,7 +342,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -361,7 +361,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -384,7 +384,7 @@ ORDER BY `c`.`ContactTitle` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } } @@ -402,7 +402,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -428,7 +428,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`EmployeeID`) ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -451,7 +451,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -465,7 +465,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -479,7 +479,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -545,7 +545,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -560,7 +560,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -575,7 +575,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -652,7 +652,7 @@ CROSS JOIN ( WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -704,7 +704,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `c2` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } } @@ -738,7 +738,7 @@ ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` """); } } @@ -754,7 +754,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -793,7 +793,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1` CROSS JOIN `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -850,7 +850,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` """); } } @@ -909,7 +909,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } } @@ -940,7 +940,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } } @@ -971,7 +971,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } } @@ -1032,7 +1032,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1101,7 +1101,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -1123,7 +1123,7 @@ ORDER BY `c`.`ContactName` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName`, `c0`.`CustomerID` """); } } @@ -1197,7 +1197,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy ORDER BY CASE WHEN `c`.`CustomerID` LIKE 'S%' THEN 1 ELSE 2 -END, `c`.`CustomerID`, `o`.`OrderID` +END, `c`.`CustomerID` """); } @@ -1279,7 +1279,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1336,7 +1336,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1391,7 +1391,7 @@ CROSS JOIN `Order Details` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1448,7 +1448,7 @@ CROSS JOIN `Orders` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1509,7 +1509,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1544,7 +1544,7 @@ ORDER BY NOT (FALSE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1565,7 +1565,7 @@ ORDER BY NOT (TRUE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1587,7 +1587,7 @@ ORDER BY NOT (`c`.`CustomerID` = @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1609,7 +1609,7 @@ ORDER BY NOT (`c`.`CustomerID` <> @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1726,7 +1726,7 @@ ORDER BY `o`.`OrderID` OFFSET 1 ROWS ) AS `o0` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderDate` DESC, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o0`.`OrderDate` DESC """); } @@ -1804,7 +1804,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1826,7 +1826,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1871,7 +1871,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1889,7 +1889,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -1918,7 +1918,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1934,7 +1934,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1980,7 +1980,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1995,7 +1995,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2012,7 +2012,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2048,7 +2048,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2078,7 +2078,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2095,7 +2095,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2111,7 +2111,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2127,7 +2127,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2145,7 +2145,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2190,7 +2190,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs index c5f39691..a3bad020 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs @@ -366,7 +366,7 @@ public override async Task GroupJoin_simple_ordering(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`City`, `o`.`OrderID` +ORDER BY `c`.`City` """); } @@ -398,7 +398,7 @@ public override async Task GroupJoin_as_final_operator(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -412,7 +412,7 @@ public override async Task Unflattened_GroupJoin_composed(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE (`c`.`CustomerID` LIKE 'F%') AND `c`.`City` = 'Lisboa' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -431,7 +431,7 @@ INNER JOIN ( ) AS `c1` ON `c`.`CustomerID` = `c1`.`CustomerID` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -520,7 +520,7 @@ public override async Task GroupJoin_Where_OrderBy(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `o`.`CustomerID` = 'ALFKI' OR `c`.`CustomerID` = 'ANATR' -ORDER BY `c`.`City`, `o`.`OrderID` +ORDER BY `c`.`City` """); } @@ -817,7 +817,7 @@ INNER JOIN ( ) AS `o1` ON `o`.`OrderID` = `o1`.`OrderID` ) AS `s` ON `c`.`CustomerID` = `s`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `s`.`OrderID0`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `c`.`CustomerID`, `s`.`OrderID0`, `s`.`OrderID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs index 2406d20b..34126b18 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs @@ -394,7 +394,7 @@ public override async Task Entity_equality_orderby_subquery(bool async) ORDER BY ( SELECT TOP 1 `o`.`OrderID` FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID`), `c`.`CustomerID` + WHERE `c`.`CustomerID` = `o`.`CustomerID`) """); } @@ -412,7 +412,7 @@ SELECT TOP 1 `o0`.`OrderID` WHERE `o`.`OrderID` = `o0`.`OrderID`) DESC, ( SELECT TOP 1 `o1`.`ProductID` FROM `Order Details` AS `o1` - WHERE `o`.`OrderID` = `o1`.`OrderID`) DESC, `o`.`OrderID` + WHERE `o`.`OrderID` = `o1`.`OrderID`) DESC """); } @@ -967,7 +967,7 @@ CROSS JOIN ( ORDER BY `o`.`OrderID` ) AS `o0` WHERE `e0`.`EmployeeID` = `o0`.`EmployeeID` -ORDER BY `e0`.`EmployeeID`, `o0`.`OrderID` +ORDER BY `e0`.`EmployeeID` """); } @@ -996,7 +996,7 @@ CROSS JOIN ( ORDER BY `c`.`CustomerID` ) AS `c0` WHERE `e0`.`City` = 'Seattle' -ORDER BY `e0`.`EmployeeID`, `c0`.`CustomerID` +ORDER BY `e0`.`EmployeeID` """); } @@ -1042,7 +1042,7 @@ public override async Task OrderBy_arithmetic(bool isAsync) """ SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -ORDER BY `e`.`EmployeeID` - `e`.`EmployeeID`, `e`.`EmployeeID` +ORDER BY `e`.`EmployeeID` - `e`.`EmployeeID` """); } @@ -1126,7 +1126,7 @@ public override async Task Skip_orderby_const(bool isAsync) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY NOT (TRUE), `c`.`CustomerID` +ORDER BY NOT (TRUE) OFFSET @p ROWS """); } @@ -1142,7 +1142,7 @@ public override async Task Skip_Take(bool isAsync) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`ContactName`, `c`.`CustomerID` +ORDER BY `c`.`ContactName` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY """); } @@ -1253,7 +1253,7 @@ public override async Task Take_Skip(bool isAsync) FROM `Customers` AS `c` ORDER BY `c`.`ContactName` ) AS `c0` -ORDER BY `c0`.`ContactName`, `c0`.`CustomerID` +ORDER BY `c0`.`ContactName` OFFSET @p1 ROWS """); } @@ -2067,7 +2067,7 @@ public override async Task Where_orderby_join_select(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` <> 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2082,7 +2082,7 @@ public override async Task Where_join_orderby_join_select(bool isAsync) INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` INNER JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` WHERE `c`.`CustomerID` <> 'ALFKI' -ORDER BY `c`.`CustomerID`, `o0`.`ProductID` +ORDER BY `c`.`CustomerID` """); } @@ -2109,7 +2109,7 @@ public override async Task Where_orderby_select_many(bool isAsync) FROM `Customers` AS `c` CROSS JOIN `Orders` AS `o` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2123,7 +2123,7 @@ public override async Task SelectMany_cartesian_product_with_ordering(bool isAsy FROM `Customers` AS `c` CROSS JOIN `Employees` AS `e` WHERE `c`.`City` = `e`.`City` OR (`c`.`City` IS NULL AND `e`.`City` IS NULL) -ORDER BY `e`.`City`, `c`.`CustomerID` DESC, `e`.`EmployeeID` +ORDER BY `e`.`City`, `c`.`CustomerID` DESC """); } @@ -2258,7 +2258,7 @@ public override async Task Distinct_Skip_Take(bool isAsync) SELECT DISTINCT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`ContactName`, `c0`.`CustomerID` +ORDER BY `c0`.`ContactName` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY """); } @@ -2417,7 +2417,6 @@ public override async Task OrderBy_true(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2429,7 +2428,6 @@ public override async Task OrderBy_integer(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2441,7 +2439,6 @@ public override async Task OrderBy_parameter(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2523,7 +2520,7 @@ public override async Task OrderBy_multiple(bool isAsync) SELECT `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`Country`, `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`Country`, `c`.`City` """); } @@ -2647,7 +2644,7 @@ SELECT DISTINCT `o`.`CustomerID` WHERE `o`.`OrderID` < 10300 ) AS `o0` LEFT JOIN `Orders` AS `o1` ON `o0`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `o0`.`CustomerID`, `o1`.`OrderID` +ORDER BY `o0`.`CustomerID` """); } @@ -2667,7 +2664,7 @@ SELECT DISTINCT `o`.`CustomerID` WHERE `o`.`OrderID` < 10300 ) AS `o0` LEFT JOIN `Orders` AS `o1` ON `o0`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `o0`.`CustomerID`, `o1`.`OrderID` +ORDER BY `o0`.`CustomerID` """); } @@ -2756,7 +2753,7 @@ public override async Task Select_correlated_subquery_filtered(bool isAsync) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2934,7 +2931,7 @@ public override async Task OrderBy_conditional_operator_where_condition_false(bo """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -2946,7 +2943,7 @@ public override async Task OrderBy_comparison_operator(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY NOT (`c`.`Region` = 'ASK' AND `c`.`Region` IS NOT NULL), `c`.`CustomerID` +ORDER BY NOT (`c`.`Region` = 'ASK' AND `c`.`Region` IS NOT NULL) """); } @@ -3064,7 +3061,7 @@ public override async Task Select_take_skip_null_coalesce_operator3(bool isAsync FROM `Customers` AS `c` ORDER BY COALESCE(`c`.`Region`, 'ZZ') ) AS `c0` -ORDER BY `c0`.`c`, `c0`.`CustomerID` +ORDER BY `c0`.`c` OFFSET @p1 ROWS """); } @@ -3077,7 +3074,7 @@ public override async Task Selected_column_can_coalesce(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY COALESCE(`c`.`Region`, 'ZZ'), `c`.`CustomerID` +ORDER BY COALESCE(`c`.`Region`, 'ZZ') """); } @@ -3614,7 +3611,7 @@ public override async Task OrderBy_skip_take(bool isAsync) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`ContactTitle`, `c`.`ContactName`, `c`.`CustomerID` +ORDER BY `c`.`ContactTitle`, `c`.`ContactName` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY """); } @@ -3636,7 +3633,7 @@ public override async Task OrderBy_skip_skip_take(bool isAsync) ORDER BY `c`.`ContactTitle`, `c`.`ContactName` OFFSET @p ROWS ) AS `c0` -ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName`, `c0`.`CustomerID` +ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName` OFFSET @p1 ROWS FETCH NEXT @p2 ROWS ONLY """); } @@ -3658,7 +3655,7 @@ public override async Task OrderBy_skip_take_take(bool isAsync) ORDER BY `c`.`ContactTitle`, `c`.`ContactName` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` -ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName`, `c0`.`CustomerID` +ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName` """); } @@ -3688,7 +3685,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c1` ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName` ) AS `c2` -ORDER BY `c2`.`ContactTitle`, `c2`.`ContactName`, `c2`.`CustomerID` +ORDER BY `c2`.`ContactTitle`, `c2`.`ContactName` """); } @@ -3715,7 +3712,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName` OFFSET @p2 ROWS FETCH NEXT @p3 ROWS ONLY ) AS `c1` -ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName` OFFSET @p ROWS """); } @@ -3814,7 +3811,7 @@ public override async Task OrderBy_skip_take_distinct_orderby_take(bool isAsync) OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` ) AS `c1` -ORDER BY `c1`.`ContactTitle`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactTitle` """); } @@ -4039,7 +4036,7 @@ public override async Task Anonymous_complex_orderby(bool isAsync) """ SELECT `c`.`CustomerID` & COALESCE(`c`.`City`, '') AS `A` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` & COALESCE(`c`.`City`, ''), `c`.`CustomerID` +ORDER BY `c`.`CustomerID` & COALESCE(`c`.`City`, '') """); } @@ -4063,7 +4060,7 @@ ORDER BY ( SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` WHERE `c`.`CustomerID` = `o0`.`CustomerID` - ORDER BY `o0`.`OrderID` DESC), `c`.`CustomerID` + ORDER BY `o0`.`OrderID` DESC) """); } @@ -4182,7 +4179,7 @@ ORDER BY ( SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` WHERE `c`.`CustomerID` = `o0`.`CustomerID` - ORDER BY `o0`.`OrderID` DESC), `c`.`CustomerID` + ORDER BY `o0`.`OrderID` DESC) """); } @@ -4204,7 +4201,7 @@ public override async Task Include_with_orderby_skip_preserves_ordering(bool isA OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`City`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`City`, `c0`.`CustomerID` """); } @@ -4630,7 +4627,7 @@ public override async Task Comparing_entities_using_Equals(bool isAsync) FROM `Customers` AS `c` CROSS JOIN `Customers` AS `c0` WHERE (`c`.`CustomerID` LIKE 'ALFKI%') AND `c`.`CustomerID` = `c0`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -4847,7 +4844,7 @@ SELECT COUNT(*) WHERE `c`.`CustomerID` = `o`.`CustomerID` ) AS `o1` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o1`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -4915,7 +4912,6 @@ public override async Task OrderBy_empty_list_contains(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -4927,7 +4923,6 @@ public override async Task OrderBy_empty_list_does_not_contains(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -5429,7 +5424,7 @@ public override async Task Checked_context_with_arithmetic_does_not_fail(bool is SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` FROM `Order Details` AS `o` WHERE (`o`.`Quantity` + CINT(1)) = CINT(5) AND (`o`.`Quantity` - CINT(1)) = CINT(3) AND (`o`.`Quantity` * CINT(1)) = `o`.`Quantity` -ORDER BY `o`.`OrderID`, `o`.`ProductID` +ORDER BY `o`.`OrderID` """); } @@ -5949,7 +5944,7 @@ OUTER APPLY ( FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID` ) AS `o0` -ORDER BY `c`.`CustomerID`, `o0`.`First` +ORDER BY `c`.`CustomerID` """); } @@ -5968,7 +5963,7 @@ OUTER APPLY ( LEFT JOIN `Customers` AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID` WHERE `c`.`CustomerID` = `o`.`CustomerID` ) AS `s` -ORDER BY `c`.`CustomerID`, `s`.`First` +ORDER BY `c`.`CustomerID` """); } @@ -5988,7 +5983,7 @@ SELECT DISTINCT `o0`.`CustomerID` FROM `Orders` AS `o0` ) AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o1`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -6209,7 +6204,7 @@ public override async Task OrderBy_Join(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -7064,7 +7059,7 @@ ORDER BY ( SELECT MAX(`o1`.`OrderDate`) FROM `Order Details` AS `o0` INNER JOIN `Orders` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` - WHERE `o0`.`OrderID` IN (@ids1, @ids2) AND `o`.`Quantity` = `o0`.`Quantity`), `o`.`Quantity` + WHERE `o0`.`OrderID` IN (@ids1, @ids2) AND `o`.`Quantity` = `o0`.`Quantity`) """); } @@ -7296,7 +7291,6 @@ public override async Task Cast_to_object_over_parameter_directly_in_lambda(bool """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -ORDER BY `o`.`OrderID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs index cc049bb5..7a10895a 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs @@ -446,7 +446,7 @@ public override async Task Select_collection_navigation_simple(bool isAsync) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -476,7 +476,7 @@ public override async Task Select_collection_navigation_simple_followed_by_order FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -491,7 +491,7 @@ public override async Task Select_collection_navigation_multi_part(bool isAsync) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` = 'ALFKI' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -507,7 +507,7 @@ public override async Task Select_collection_navigation_multi_part2(bool isAsync LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o0`.`CustomerID` IN ('ALFKI', 'ANTON') -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs index 473990d7..4434827d 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs @@ -165,7 +165,7 @@ public override async Task Include_query_opt_out(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs index bb77c862..0339a11e 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs @@ -98,7 +98,7 @@ public override void Tag_on_include_query() ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs index 81778dd1..b55eeb89 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs @@ -67,7 +67,7 @@ CROSS JOIN ( FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` -ORDER BY `o0`.`OrderID`, `e0`.`EmployeeID` +ORDER BY `o0`.`OrderID` """); } @@ -91,7 +91,7 @@ public override async Task Projection_when_client_evald_subquery(bool isAsync) SELECT `c`.`CustomerID`, `o`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -168,7 +168,6 @@ public override async Task Select_bool_closure_with_order_parameter_with_cast_to SELECT @boolean FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -1119,13 +1118,12 @@ ORDER BY `c`.`CustomerID` public override async Task Anonymous_projection_with_repeated_property_being_ordered_2(bool isAsync) { await base.Anonymous_projection_with_repeated_property_being_ordered_2(isAsync); - - AssertSql( - """ +AssertSql( + """ SELECT `c`.`CustomerID` AS `A`, `o`.`CustomerID` AS `B` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` -ORDER BY `o`.`CustomerID`, `o`.`OrderID` +ORDER BY `o`.`CustomerID` """); } @@ -1449,7 +1447,7 @@ public override Task Member_binding_after_ctor_arguments_fails_with_client_eval( public override async Task Filtered_collection_projection_is_tracked(bool isAsync) { await base.Filtered_collection_projection_is_tracked(isAsync); - + AssertSql( """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` @@ -1460,7 +1458,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` > 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1478,7 +1476,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` > 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1528,14 +1526,14 @@ SELECT CASE public override async Task Select_chained_entity_navigation_doesnt_materialize_intermittent_entities(bool isAsync) { await base.Select_chained_entity_navigation_doesnt_materialize_intermittent_entities(isAsync); - + AssertSql( - """ + """ SELECT `o`.`OrderID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1676,7 +1674,7 @@ public override async Task Collection_projection_AsNoTracking_OrderBy(bool async SELECT `c`.`CustomerID`, `o`.`OrderDate`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1818,11 +1816,11 @@ public override async Task Reverse_in_join_outer(bool async) await base.Reverse_in_join_outer(async); AssertSql( - """ + """ SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`City`, `c`.`CustomerID` DESC, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` DESC """); } @@ -1850,11 +1848,11 @@ public override async Task Reverse_in_join_inner(bool async) await base.Reverse_in_join_inner(async); AssertSql( - """ + """ SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1887,7 +1885,7 @@ public override async Task Reverse_in_SelectMany(bool async) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID` DESC, `o`.`OrderID` +ORDER BY `c`.`CustomerID` DESC """); } @@ -1977,7 +1975,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` AND `o`.`OrderID` < 11000) > 0 -ORDER BY `c`.`CustomerID`, `o1`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1998,13 +1996,13 @@ public override async Task Projecting_multiple_collection_with_same_constant_wor await base.Projecting_multiple_collection_with_same_constant_works(async); AssertSql( - """ + """ SELECT `c`.`CustomerID`, 1, `o`.`OrderID`, `o0`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -2071,11 +2069,11 @@ public override async Task Projecting_count_of_navigation_which_is_generic_colle await base.Projecting_count_of_navigation_which_is_generic_collection_using_convert(async); AssertSql( - """ + """ SELECT `c`.`CustomerID`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2233,7 +2231,7 @@ OUTER APPLY ( FROM `Orders` AS `o1` WHERE `o1`.`OrderID` = `o0`.`OrderID` AND `o1`.`OrderID` IN (@filteredOrderIds1, @filteredOrderIds2, @filteredOrderIds3) ) AS `o2` -ORDER BY `o0`.`OrderID`, `o2`.`Inner` +ORDER BY `o0`.`OrderID` """); } @@ -2257,7 +2255,7 @@ OUTER APPLY ( FROM `Orders` AS `o1` WHERE (`o1`.`CustomerID` = `o0`.`CustomerID` OR (`o1`.`CustomerID` IS NULL AND `o0`.`CustomerID` IS NULL)) AND `o1`.`OrderID` IN (@filteredOrderIds1, @filteredOrderIds2, @filteredOrderIds3) ) AS `o2` -ORDER BY `o0`.`OrderDate`, `o0`.`CustomerID`, `o2`.`Inner` +ORDER BY `o0`.`OrderDate`, `o0`.`CustomerID` """); } @@ -2405,7 +2403,7 @@ OUTER APPLY ( ) AS `o1` WHERE `c0`.`CustomerID` = `o`.`CustomerID` ) AS `s` -ORDER BY `c0`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `c0`.`CustomerID`, `s`.`OrderID` """); } @@ -2482,7 +2480,7 @@ SELECT COUNT(*) WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2511,7 +2509,7 @@ public override async Task MemberInit_in_projection_without_arguments(bool async FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2568,7 +2566,7 @@ CROSS JOIN ( FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` -ORDER BY `o0`.`OrderID`, `e0`.`EmployeeID` +ORDER BY `o0`.`OrderID` """); } @@ -2780,7 +2778,7 @@ public override async Task List_from_result_of_single_result(bool async) await base.List_from_result_of_single_result(async); AssertSql( - """ + """ SELECT `c0`.`CustomerID`, `o`.`OrderID` FROM ( SELECT TOP 1 `c`.`CustomerID` @@ -2788,7 +2786,7 @@ SELECT TOP 1 `c`.`CustomerID` ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2805,7 +2803,7 @@ SELECT TOP 1 `c`.`CustomerID` ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2862,7 +2860,7 @@ public override async Task Set_operation_in_pending_collection(bool async) await base.Set_operation_in_pending_collection(async); AssertSql( - """ + """ @p='5' SELECT `c0`.`CustomerID`, `u`.`OrderID` @@ -2880,7 +2878,7 @@ OUTER APPLY ( FROM `Orders` AS `o0` WHERE `o0`.`CustomerID` = `c0`.`CustomerID` ) AS `u` -ORDER BY `c0`.`CustomerID`, `u`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs index ad305fce..50a581cb 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs @@ -110,7 +110,7 @@ public override async Task Union_OrderBy_Skip_Take(bool isAsync) FROM `Customers` AS `c0` WHERE `c0`.`City` = 'London' ) AS `u` -ORDER BY `u`.`ContactName`, `u`.`CustomerID` +ORDER BY `u`.`ContactName` OFFSET @p ROWS FETCH NEXT @p ROWS ONLY """); } @@ -159,7 +159,7 @@ public override async Task Union_Skip_Take_OrderBy_ThenBy_Where(bool isAsync) OFFSET @p ROWS ) AS `u0` WHERE `u0`.`ContactName` LIKE '%Thomas%' -ORDER BY `u0`.`Region`, `u0`.`City`, `u0`.`CustomerID` +ORDER BY `u0`.`Region`, `u0`.`City` """); } @@ -376,7 +376,7 @@ ORDER BY `u`.`Foo` OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `u0` WHERE `u0`.`Foo` = 'Berlin' -ORDER BY `u0`.`Foo`, `u0`.`CustomerID` +ORDER BY `u0`.`Foo` """); } @@ -397,7 +397,7 @@ public override async Task Union_Include(bool isAsync) WHERE `c0`.`City` = 'London' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -418,7 +418,7 @@ public override async Task Include_Union(bool isAsync) WHERE `c0`.`City` = 'London' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1152,7 +1152,7 @@ public override async Task Collection_projection_after_set_operation(bool async) WHERE `c0`.`CustomerID` LIKE 'F%' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1192,7 +1192,7 @@ public override async Task Union_on_entity_with_correlated_collection(bool async WHERE `o0`.`OrderID` < 10250 ) AS `u` LEFT JOIN `Orders` AS `o1` ON `u`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o1`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1215,7 +1215,7 @@ public override async Task Union_on_entity_plus_other_column_with_correlated_col WHERE `o0`.`OrderID` < 10250 ) AS `u` LEFT JOIN `Orders` AS `o1` ON `u`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `u`.`CustomerID`, `u`.`OrderDate`, `o1`.`OrderID` +ORDER BY `u`.`CustomerID`, `u`.`OrderDate` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs index 709a4eab..c3dfef70 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs @@ -258,7 +258,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1` CROSS JOIN `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -457,7 +457,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1290,7 +1290,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1343,7 +1343,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs index 73fc84bf..9f1cff28 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs @@ -1184,7 +1184,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1` CROSS JOIN `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -1311,7 +1311,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1339,7 +1339,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1367,7 +1367,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs index 7e960b43..5e3dc5e6 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs @@ -46,7 +46,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -63,7 +63,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -78,7 +78,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -92,7 +92,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -132,7 +132,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`OrderDate` DESC) DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -166,7 +166,7 @@ public override async Task Include_collection_skip_take_no_order_by(bool async) OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -229,7 +229,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -244,7 +244,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -262,7 +262,7 @@ CROSS JOIN ( WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -290,7 +290,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -309,7 +309,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -348,7 +348,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -371,7 +371,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -415,7 +415,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` """); } @@ -458,7 +458,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -493,7 +493,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -508,7 +508,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -534,7 +534,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `c2` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } @@ -548,7 +548,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -626,7 +626,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -648,7 +648,7 @@ ORDER BY NOT (`c`.`CustomerID` <> @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -709,7 +709,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -742,7 +742,7 @@ ORDER BY `c`.`ContactTitle` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -757,7 +757,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -802,7 +802,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -820,7 +820,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -834,7 +834,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -873,7 +873,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1` CROSS JOIN `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -896,7 +896,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -986,7 +986,7 @@ ORDER BY NOT (FALSE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1002,7 +1002,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1170,7 +1170,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1186,7 +1186,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1270,7 +1270,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1342,7 +1342,7 @@ CROSS JOIN `Order Details` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1364,7 +1364,7 @@ ORDER BY NOT (`c`.`CustomerID` = @list1) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1446,7 +1446,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1488,7 +1488,7 @@ ORDER BY `c1`.`CustomerID` ) AS `s` LEFT JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`CustomerID`, `s`.`CustomerID0`, `o`.`OrderID` """); } @@ -1518,7 +1518,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1534,7 +1534,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1559,7 +1559,7 @@ ORDER BY `c`.`ContactName` OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName`, `c0`.`CustomerID` """); } @@ -1588,7 +1588,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1634,7 +1634,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1663,7 +1663,7 @@ LEFT JOIN ( WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1677,7 +1677,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1717,7 +1717,7 @@ OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1763,7 +1763,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1792,7 +1792,7 @@ CROSS JOIN `Orders` AS `o2` WHERE `s0`.`row` <= 1 ) AS `s1` ON `s`.`OrderID` = `s1`.`OrderID` LEFT JOIN `Order Details` AS `o3` ON `s1`.`OrderID` = `o3`.`OrderID` -ORDER BY `s`.`OrderID`, `o3`.`OrderID` +ORDER BY `s`.`OrderID`, `o3`.`OrderID`, `o3`.`ProductID` """); } @@ -1809,7 +1809,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1830,7 +1830,7 @@ ORDER BY NOT (TRUE) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY NOT (`c0`.`c`), `c0`.`CustomerID` """); } @@ -1913,7 +1913,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `o`.`EmployeeID`) ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -1928,7 +1928,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1992,7 +1992,7 @@ public override async Task Include_collection_skip_no_order_by(bool async) OFFSET @p ROWS ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2010,7 +2010,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2027,7 +2027,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2068,7 +2068,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -2100,7 +2100,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -2129,7 +2129,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2146,7 +2146,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy ORDER BY CASE WHEN `c`.`CustomerID` LIKE 'S%' THEN 1 ELSE 2 -END, `c`.`CustomerID`, `o`.`OrderID` +END, `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs index 05b520cb..d6d36cff 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs @@ -1443,7 +1443,7 @@ public override async Task Where_navigation_contains(bool isAsync) WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1729,7 +1729,7 @@ public override async Task Where_Queryable_ToList_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1747,7 +1747,7 @@ public override async Task Where_Queryable_ToList_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1764,7 +1764,7 @@ public override async Task Where_Queryable_ToArray_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1782,7 +1782,7 @@ public override async Task Where_Queryable_ToArray_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1799,7 +1799,7 @@ public override async Task Where_Queryable_AsEnumerable_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1817,7 +1817,7 @@ public override async Task Where_Queryable_AsEnumerable_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1835,7 +1835,7 @@ WHERE NOT (COALESCE('ALFKI' IN ( FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ), FALSE)) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1852,7 +1852,7 @@ public override async Task Where_Queryable_ToList_Count_member(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1869,7 +1869,7 @@ public override async Task Where_Queryable_ToArray_Length_member(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs index b62a4f2c..b6e1c193 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs @@ -2694,7 +2694,7 @@ public override async Task Null_comparison_in_order_by_with_relational_nulls(boo """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -ORDER BY NOT (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL), NOT (`e`.`NullableIntB` <> 10 OR `e`.`NullableIntB` IS NULL), `e`.`Id` +ORDER BY NOT (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL), NOT (`e`.`NullableIntB` <> 10 OR `e`.`NullableIntB` IS NULL) """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs index b9424b37..78dfe2dd 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs @@ -131,7 +131,7 @@ public override async Task Owned_reference_mapped_to_different_table_updated_cor LEFT JOIN `CustomerData` AS `c0` ON `c`.`Id` = `c0`.`CompanyId` LEFT JOIN `SupplierData` AS `s` ON `c`.`Id` = `s`.`CompanyId` WHERE `c0`.`CompanyId` IS NOT NULL -ORDER BY `c`.`Id`, `s`.`CompanyId` +ORDER BY `c`.`Id` """); } @@ -149,7 +149,7 @@ public override async Task Owned_reference_mapped_to_different_table_nested_upda LEFT JOIN `IM_CustomerData` AS `i0` ON `i`.`OwnerId` = `i0`.`IntermediateOwnedEntityOwnerId` LEFT JOIN `IM_SupplierData` AS `i1` ON `i`.`OwnerId` = `i1`.`IntermediateOwnedEntityOwnerId` WHERE `i0`.`IntermediateOwnedEntityOwnerId` IS NOT NULL -ORDER BY `o`.`Id`, `i1`.`IntermediateOwnedEntityOwnerId` +ORDER BY `o`.`Id` """); } @@ -161,7 +161,7 @@ public override async Task Owned_entity_with_all_null_properties_materializes_wh """ SELECT `r`.`Id`, `r`.`Buyer`, `r`.`Rot_ApartmentNo`, `r`.`Rot_ServiceType`, `r`.`Rut_Value` FROM `RotRutCases` AS `r` -ORDER BY `r`.`Buyer`, `r`.`Id` +ORDER BY `r`.`Buyer` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedQueryLibRedTest.cs index a163a36c..6ad2ef21 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/OwnedQueryLibRedTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( LEFT JOIN `OrderDetail` AS `o3` ON `o2`.`ClientId` = `o3`.`OrderClientId` AND `o2`.`Id` = `o3`.`OrderId` ) AS `s` ON `o`.`Id` = `s`.`ClientId` WHERE FALSE -ORDER BY `o`.`Id`, `o1`.`Id`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderClientId`, `s`.`OrderId` +ORDER BY `o`.`Id`, `o1`.`Id`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderClientId`, `s`.`OrderId`, `s`.`Id0` """); } @@ -354,7 +354,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg FROM `OwnedPerson` AS `o` LEFT JOIN `Planet` AS `p` ON `o`.`PersonAddress_Country_PlanetId` = `p`.`Id` LEFT JOIN `Moon` AS `m` ON `p`.`Id` = `m`.`PlanetId` -ORDER BY `o`.`Id`, `m`.`Id` +ORDER BY `o`.`Id` """); } @@ -396,7 +396,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg LEFT JOIN `Planet` AS `p` ON `o`.`PersonAddress_Country_PlanetId` = `p`.`Id` LEFT JOIN `Star` AS `s` ON `p`.`StarId` = `s`.`Id` LEFT JOIN `Element` AS `e` ON `s`.`Id` = `e`.`StarId` -ORDER BY `o`.`Id`, `e`.`Id` +ORDER BY `o`.`Id` """); } @@ -428,7 +428,7 @@ await base.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_ LEFT JOIN `Star` AS `s` ON `p`.`StarId` = `s`.`Id` LEFT JOIN `Element` AS `e` ON `s`.`Id` = `e`.`StarId` WHERE `s`.`Name` = 'Sol' -ORDER BY `o`.`Id`, `e`.`Id` +ORDER BY `o`.`Id` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs index 128013c7..0c250fb1 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs @@ -301,7 +301,7 @@ public override async Task OrderBy() """ SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -315,7 +315,7 @@ public override async Task Skip_with_constant() SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` OFFSET @p ROWS """); } @@ -330,7 +330,7 @@ public override async Task Skip_with_parameter() SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` OFFSET @p ROWS """); } @@ -345,7 +345,7 @@ public override async Task Take_with_constant() SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -359,7 +359,7 @@ public override async Task Take_with_parameter() SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -395,7 +395,7 @@ public override async Task Include_single() FROM `Blogs` AS `b` LEFT JOIN `Posts` AS `p` ON `b`.`Id` = `p`.`BlogId` WHERE `b`.`Id` > 8 -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -426,7 +426,7 @@ public override async Task Final_GroupBy() """ SELECT `b`.`Name`, `b`.`Id`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs index 6548e369..cfe4126a 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs @@ -197,7 +197,7 @@ public override async Task Include_single_query() SELECT `b`.`Id`, `b`.`Name`, `p`.`Id`, `p`.`BlogId`, `p`.`Title` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -228,7 +228,7 @@ public override async Task Final_GroupBy() """ SELECT `b`.`Name`, `b`.`Id` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs index 28fa65f7..c2cf0ba3 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs @@ -301,7 +301,7 @@ public override async Task Truncate_project_and_order_by_it_twice() """ SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` -ORDER BY FIX(`b`.`Double`), `b`.`Id` +ORDER BY FIX(`b`.`Double`) """); } @@ -319,7 +319,7 @@ public override async Task Truncate_project_and_order_by_it_twice2() """ SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` -ORDER BY FIX(`b`.`Double`) DESC, `b`.`Id` +ORDER BY FIX(`b`.`Double`) DESC """); } @@ -337,7 +337,7 @@ public override async Task Truncate_project_and_order_by_it_twice3() """ SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` -ORDER BY FIX(`b`.`Double`) DESC, `b`.`Id` +ORDER BY FIX(`b`.`Double`) DESC """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs index aecd86e4..601ea69a 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs @@ -22,9 +22,9 @@ protected override bool IsCaseSensitive #region Equals - public override async Task Equals() + public override async Task Instance_Equals() { - await base.Equals(); + await base.Instance_Equals(); AssertSql( """ @@ -1366,7 +1366,7 @@ public override async Task Join_over_non_nullable_column() GROUP BY `b`.`Int` ) AS `b1` LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` -ORDER BY `b1`.`Int`, `b0`.`Id` +ORDER BY `b1`.`Int` """); } @@ -1410,7 +1410,7 @@ LEFT JOIN ( FROM `BasicTypesEntities` AS `b0` WHERE LEN(`b0`.`String`) > 6 ) AS `b2` ON `b1`.`Int` = `b2`.`Int` -ORDER BY `b1`.`Int`, `b2`.`Id` +ORDER BY `b1`.`Int` """); } @@ -1474,7 +1474,7 @@ public override async Task Concat_aggregate() GROUP BY `b`.`Int` ) AS `b1` LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` -ORDER BY `b1`.`Int`, `b0`.`Id` +ORDER BY `b1`.`Int` """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs index ce3e93dc..4f841b31 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs @@ -211,7 +211,7 @@ public override async Task Order_by_FromTimeSpan() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -ORDER BY TIMEVALUE(`b`.`TimeSpan`), `b`.`Id` +ORDER BY TIMEVALUE(`b`.`TimeSpan`) """); } diff --git a/test/EFCore.LibRed.FunctionalTests/AssemblyInfo.cs b/test/EFCore.LibRed.FunctionalTests/AssemblyInfo.cs index 34b3e624..81093f8c 100644 --- a/test/EFCore.LibRed.FunctionalTests/AssemblyInfo.cs +++ b/test/EFCore.LibRed.FunctionalTests/AssemblyInfo.cs @@ -1,6 +1,7 @@ -using Xunit; +using Xunit.Sdk; +using Xunit.v3; -// Runs in parallel (MaxParallelThreads = 0). Unlike EFCore.Jet.FunctionalTests — which must serialise because +// Runs in parallel (MaxThreads = 0). Unlike EFCore.Jet.FunctionalTests — which must serialise because // the ACE OLE DB provider crashes the host with 0xC0000005 under concurrent connections — LibRed uses no ACE // and isolates concurrent connections itself: a transaction's writes are buffered in a private per-connection // deferred-write overlay and published to the shared page cache only on commit (read-committed isolation), so @@ -12,6 +13,6 @@ // in-process, fully-managed engine — puts its whole working set (page caches, catalogs, query buffers) in the // same managed address space as EF and the test platform, unlike out-of-process/native providers (SQL Server, // ACE). Under this concurrency that overflows 32-bit; on x64 the full ~38k-test suite runs green in parallel. -[assembly: CollectionBehavior( - DisableTestParallelization = false, - MaxParallelThreads = 0)] +[assembly: Parallelization( + Mode = ParallelMode.Collections, + MaxThreads = 0)] diff --git a/test/EFCore.LibRed.FunctionalTests/F1LibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/F1LibRedFixture.cs index 73109f89..c1c5b108 100644 --- a/test/EFCore.LibRed.FunctionalTests/F1LibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/F1LibRedFixture.cs @@ -15,78 +15,7 @@ namespace EntityFrameworkCore.LibRed.FunctionalTests { - public class F1LibRedFixture : F1LibRedFixtureBase - { - protected override void BuildModelExternal(ModelBuilder modelBuilder) - { - base.BuildModelExternal(modelBuilder); - - var converter = new BinaryVersionConverter(); - var comparer = new BinaryVersionComparer(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - - modelBuilder - .Entity() - .Property(e => e.BinaryVersion) - .HasConversion(converter, comparer) - .IsRowVersion(); - } - - private class BinaryVersionConverter() : ValueConverter, byte[]>( - v => v == null ? null : v.ToArray(), - v => v == null ? null : v.ToList()); - - private class BinaryVersionComparer() : ValueComparer>( - (l, r) => (l == null && r == null) || (l != null && r != null && l.SequenceEqual(r)), - v => CalculateHashCode(v), - v => v == null ? null : v.ToList()) - { - private static int CalculateHashCode(List source) - { - if (source == null) - { - return 0; - } - - var hash = new HashCode(); - foreach (var el in source) - { - hash.Add(el); - } - - return hash.ToHashCode(); - } - } - } + public class F1LibRedFixture : F1LibRedFixtureBase; public abstract class F1LibRedFixtureBase : F1RelationalFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/LibRedComplianceTest.cs b/test/EFCore.LibRed.FunctionalTests/LibRedComplianceTest.cs index 92e479e4..0b982377 100644 --- a/test/EFCore.LibRed.FunctionalTests/LibRedComplianceTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/LibRedComplianceTest.cs @@ -28,8 +28,6 @@ public class LibRedComplianceTest : RelationalComplianceTestBase typeof(JsonQueryTestBase<>), typeof(JsonQueryRelationalTestBase<>), typeof(JsonUpdateTestBase<>), - typeof(AdHocJsonQueryRelationalTestBase), - typeof(AdHocJsonQueryTestBase), typeof(OwnedJsonBulkUpdateRelationalTestBase<>), typeof(OwnedJsonCollectionRelationalTestBase<>), typeof(OwnedJsonMiscellaneousRelationalTestBase<>), diff --git a/test/EFCore.LibRed.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs b/test/EFCore.LibRed.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs index 9f3ac528..192e778d 100644 --- a/test/EFCore.LibRed.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs @@ -47,7 +47,7 @@ LEFT JOIN ( WHERE `e1`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId` """); } @@ -73,7 +73,7 @@ LEFT JOIN ( WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId` """); } @@ -135,7 +135,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } @@ -167,7 +167,7 @@ LEFT JOIN ( WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/ManyToManyLoadSqlServerTest.cs b/test/EFCore.LibRed.FunctionalTests/ManyToManyLoadSqlServerTest.cs index 3da3a9de..398d26a8 100644 --- a/test/EFCore.LibRed.FunctionalTests/ManyToManyLoadSqlServerTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/ManyToManyLoadSqlServerTest.cs @@ -27,45 +27,25 @@ public override async Task Load_collection(EntityState state, QueryTrackingBehav await base.Load_collection(state, queryTrackingBehavior, async); AssertSql( - state == EntityState.Detached - ? """ - @p='3' - - SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` - FROM (`EntityOnes` AS `e` - INNER JOIN ( - SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` - FROM `JoinOneToTwo` AS `j` - INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - ) AS `s` ON `e`.`Id` = `s`.`OneId`) - LEFT JOIN ( - SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` - FROM `JoinOneToTwo` AS `j0` - INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = @p - ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` - WHERE `e`.`Id` = @p - ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` - """ - : """ - @p='3' - - SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId`, `s0`.`JoinOneToTwoExtraId`, `s0`.`Id`, `s0`.`Name` - FROM (`EntityOnes` AS `e` - INNER JOIN ( - SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` - FROM `JoinOneToTwo` AS `j` - INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - ) AS `s` ON `e`.`Id` = `s`.`OneId`) - LEFT JOIN ( - SELECT `j0`.`OneId`, `j0`.`TwoId`, `j0`.`JoinOneToTwoExtraId`, `e1`.`Id`, `e1`.`Name` - FROM `JoinOneToTwo` AS `j0` - INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = @p - ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` - WHERE `e`.`Id` = @p - ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId` - """); + """ +@p='3' + +SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` +FROM (`EntityOnes` AS `e` +INNER JOIN ( + SELECT `e0`.`Id`, `e0`.`CollectionInverseId`, `e0`.`ExtraId`, `e0`.`Name`, `e0`.`ReferenceInverseId`, `j`.`OneId`, `j`.`TwoId` + FROM `JoinOneToTwo` AS `j` + INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` +) AS `s` ON `e`.`Id` = `s`.`OneId`) +LEFT JOIN ( + SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` + FROM `JoinOneToTwo` AS `j0` + INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` + WHERE `e1`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`TwoId` +WHERE `e`.`Id` = @p +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId` +"""); } public override async Task Load_collection_using_Query_with_Include_for_inverse(bool async) @@ -90,7 +70,7 @@ LEFT JOIN ( WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId` """); } @@ -152,7 +132,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } @@ -184,7 +164,7 @@ LEFT JOIN ( WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` WHERE `e`.`Id` = @p -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId`, `s1`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s1`.`ThreeId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs index ab4025d1..a4d56b59 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/AdHocAdvancedMappingsQueryLibRedTest.cs @@ -42,7 +42,7 @@ LEFT JOIN ( FROM `Posts` AS `p` WHERE `p`.`Name` LIKE '%2%' ) AS `p0` ON `b`.`Id` = `p0`.`BlogId` -ORDER BY `b`.`Id`, `p0`.`Id` +ORDER BY `b`.`Id` """, // """ diff --git a/test/EFCore.LibRed.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs deleted file mode 100644 index 0fc42d52..00000000 --- a/test/EFCore.LibRed.FunctionalTests/Query/AdHocComplexTypeQueryLibRedTest.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; - -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; - -public class AdHocComplexTypeQueryLibRedTest(NonSharedFixture fixture) : AdHocComplexTypeQueryRelationalTestBase(fixture) -{ - public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() - { - await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); - - AssertSql( - """ -@entity_equality_container_Id='1' (Nullable = true) -@entity_equality_container_Containee1_Id='2' (Nullable = true) -@entity_equality_container_Containee2_Id='3' (Nullable = true) - -SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` -FROM `EntityType` AS `e` -WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id -"""); - } - - public override async Task Projecting_complex_property_does_not_auto_include_owned_types() - { - await base.Projecting_complex_property_does_not_auto_include_owned_types(); - - AssertSql( - """ -SELECT `e`.`Complex_Name`, `e`.`Complex_Number` -FROM `EntityType` AS `e` -"""); - } - - protected new TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; - - protected new void AssertSql(params string[] expected) - => TestSqlLoggerFactory.AssertBaseline(expected); - - protected override ITestStoreFactory NonSharedTestStoreFactory - => LibRedTestStoreFactory.Instance; -} diff --git a/test/EFCore.LibRed.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs deleted file mode 100644 index b0250778..00000000 --- a/test/EFCore.LibRed.FunctionalTests/Query/AdHocManyToManyQueryLibRedTest.cs +++ /dev/null @@ -1,108 +0,0 @@ -using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System.Threading.Tasks; -using Xunit; - -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; - -#nullable disable - -public class AdHocManyToManyQueryLibRedTest(NonSharedFixture fixture) : AdHocManyToManyQueryRelationalTestBase(fixture) -{ - protected override ITestStoreFactory NonSharedTestStoreFactory - => LibRedTestStoreFactory.Instance; - - public override async Task SelectMany_with_collection_selector_having_subquery() - { - await base.SelectMany_with_collection_selector_having_subquery(); - - AssertSql( - """ -SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` -FROM `Users` AS `u`, -( - SELECT `o1`.`Id` - FROM ( - SELECT 1 - FROM (SELECT COUNT(*) FROM `#Dual`) - ) AS `e` - LEFT JOIN ( - SELECT `o`.`Id` - FROM `Organisations` AS `o` - WHERE EXISTS ( - SELECT 1 - FROM `OrganisationUser` AS `o0` - WHERE `o`.`Id` = `o0`.`OrganisationId`) - ) AS `o1` ON TRUE -) AS `s` -"""); - } - - public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) - { - await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); - - AssertSql( - """ -@p='1' - -SELECT TOP 1 `m`.`Id` -FROM `ManyM_DB` AS `m` -WHERE `m`.`Id` = @p -""", - // - """ -@p='1' - -SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` -FROM (`ManyM_DB` AS `m` -INNER JOIN ( - SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` - FROM `ManyMN_DB` AS `m0` - LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` -) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) -LEFT JOIN ( - SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` - FROM `ManyMN_DB` AS `m2` - INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @p -) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` -WHERE `m`.`Id` = @p -ORDER BY `m`.`Id`, `s`.`Id0`, `s0`.`Id` -""", - // - """ -@p='1' - -SELECT TOP 1 `m`.`Id` -FROM `ManyN_DB` AS `m` -WHERE `m`.`Id` = @p -""", - // - """ -@p='1' - -SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` -FROM (`ManyN_DB` AS `m` -INNER JOIN ( - SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` - FROM `ManyMN_DB` AS `m0` - INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` -) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) -LEFT JOIN ( - SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` - FROM `ManyMN_DB` AS `m2` - INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @p -) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` -WHERE `m`.`Id` = @p -ORDER BY `m`.`Id`, `s`.`Id0`, `s0`.`Id` -"""); - } - - [Fact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); -} diff --git a/test/EFCore.LibRed.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs index bbe5a69d..4c1765ca 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/AdHocMiscellaneousQueryLibRedTest.cs @@ -1990,7 +1990,7 @@ SELECT DISTINCT `i`.`Parcel` HAVING COUNT(*) = 1 ) AS `i0` ON `t`.`ParcelNumber` = `i0`.`Parcel` WHERE `t`.`TableId` = 123 -ORDER BY `t`.`ParcelNumber`, `i0`.`Parcel` +ORDER BY `t`.`ParcelNumber` """); } @@ -2131,7 +2131,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2148,7 +2148,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2165,7 +2165,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2182,7 +2182,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2216,7 +2216,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2233,7 +2233,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2268,7 +2268,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2285,7 +2285,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2302,7 +2302,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2319,7 +2319,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2336,7 +2336,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2353,7 +2353,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2370,7 +2370,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2387,7 +2387,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2404,7 +2404,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2431,7 +2431,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2468,7 +2468,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2489,7 +2489,7 @@ GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s1` INNER JOIN `Statuses` AS `s0` ON `s1`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `s1`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2513,7 +2513,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2530,7 +2530,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2554,7 +2554,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2571,7 +2571,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2589,7 +2589,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId`) INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2602,7 +2602,7 @@ public override async Task Plain_inner_no_aggregate_LeftJoin_whole_object() SELECT `s`.`PickupStatusId`, `r`.`PickupStatusId`, 1 AS `Count` FROM `Statuses` AS `s` LEFT JOIN `Requests` AS `r` ON `s`.`PickupStatusId` = `r`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r`.`Id` +ORDER BY `s`.`PickupStatusId` """); } @@ -2647,7 +2647,7 @@ LEFT JOIN ( FROM `Requests` AS `r` GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`PickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r0`.`PickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2824,7 +2824,7 @@ LEFT JOIN ( FROM `Requests` AS `r1` GROUP BY `r1`.`PickupStatusId` ) AS `r2` ON `s`.`PickupStatusId` = `r2`.`pickupStatusId` -ORDER BY `s`.`PickupStatusId`, `r2`.`pickupStatusId` +ORDER BY `s`.`PickupStatusId` """); } @@ -2844,7 +2844,7 @@ GROUP BY `r`.`PickupStatusId` INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId`) LEFT JOIN `Statuses` AS `s1` ON `s0`.`PickupStatusId` = `s1`.`PickupStatusId` WHERE `s0`.`PickupStatusId` IS NOT NULL AND `s1`.`PickupStatusId` IS NOT NULL -ORDER BY `s1`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s1`.`PickupStatusId` """); } @@ -2862,7 +2862,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId`) INNER JOIN `Statuses` AS `s0` ON `s`.`PickupStatusId` = `s0`.`PickupStatusId` -ORDER BY `s0`.`PickupStatusId`, `r0`.`pickupStatusId` +ORDER BY `s0`.`PickupStatusId` """); } @@ -2900,7 +2900,7 @@ LEFT JOIN ( GROUP BY `r`.`PickupStatusId` ) AS `r0` ON `s`.`PickupStatusId` = `r0`.`pickupStatusId` ) AS `s0` -ORDER BY `s0`.`PickupStatusId`, `s0`.`pickupStatusId0` +ORDER BY `s0`.`PickupStatusId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs index 8429f689..0379444b 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/AdHocNavigationsQueryLibRedTest.cs @@ -44,35 +44,35 @@ public virtual async Task Nested_include_queries_do_not_populate_navigation_twic SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """, // """ SELECT `b`.`Id`, `p`.`Id`, `p`.`BlogId` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -131,7 +131,7 @@ LEFT JOIN ( FROM `Children` AS `c` LEFT JOIN `Children` AS `c0` ON `c`.`Id` = `c0`.`SelfReferenceBackNavigationId` ) AS `s` ON `p`.`Id` = `s`.`ParentBackNavigationId` -ORDER BY `p`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `p`.`Id`, `s`.`Id` """, // """ @@ -165,28 +165,28 @@ public override async Task Customer_collections_materialize_properly() SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId1` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId2` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId3` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """, // """ SELECT `c`.`Id`, `o`.`Id`, `o`.`CustomerId1`, `o`.`CustomerId2`, `o`.`CustomerId3`, `o`.`CustomerId4`, `o`.`Name` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`Id` = `o`.`CustomerId4` -ORDER BY `c`.`Id`, `o`.`Id` +ORDER BY `c`.`Id` """); } @@ -219,7 +219,7 @@ LEFT JOIN ( WHERE `p0`.`Discriminator` = 'PersonKid9038' ) AS `s` ON `p`.`Id` = `s`.`TeacherId` WHERE `p`.`Discriminator` = 'PersonTeacher9038' -ORDER BY `p`.`Id`, `s`.`Id`, `s`.`Id1` +ORDER BY `p`.`Id`, `s`.`Id` """, // """ @@ -233,7 +233,7 @@ LEFT JOIN ( WHERE `p1`.`Discriminator` = 'PersonKid9038' ) AS `p2` ON `p`.`Id` = `p2`.`TeacherId` WHERE `p`.`Discriminator` = 'PersonTeacher9038' -ORDER BY `p`.`Id`, `p0`.`Id`, `p2`.`Id` +ORDER BY `p`.`Id`, `p0`.`Id` """); } @@ -246,14 +246,14 @@ public override async Task Include_with_order_by_on_interface_key() SELECT `p`.`Id`, `p`.`Name`, `c`.`Id`, `c`.`Name`, `c`.`Parent10635Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Children` AS `c` ON `p`.`Id` = `c`.`Parent10635Id` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ SELECT `p`.`Id`, `c`.`Id`, `c`.`Name`, `c`.`Parent10635Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Children` AS `c` ON `p`.`Id` = `c`.`Parent10635Id` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """); } @@ -268,7 +268,7 @@ public override async Task Collection_without_setter_materialized_correctly() LEFT JOIN `Posts` AS `p` ON `b`.`Id` = `p`.`BlogId1`) LEFT JOIN `Posts` AS `p0` ON `b`.`Id` = `p0`.`BlogId2`) LEFT JOIN `Posts` AS `p1` ON `b`.`Id` = `p1`.`BlogId3` -ORDER BY `b`.`Id`, `p`.`Id`, `p0`.`Id`, `p1`.`Id` +ORDER BY `b`.`Id`, `p`.`Id`, `p0`.`Id` """, // """ @@ -307,14 +307,14 @@ public override async Task Include_collection_works_when_defined_on_intermediate SELECT `s`.`Id`, `s`.`Discriminator`, `s0`.`Id`, `s0`.`SchoolId` FROM `Schools` AS `s` LEFT JOIN `Students` AS `s0` ON `s`.`Id` = `s0`.`SchoolId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """, // """ SELECT `s`.`Id`, `s0`.`Id`, `s0`.`SchoolId` FROM `Schools` AS `s` LEFT JOIN `Students` AS `s0` ON `s`.`Id` = `s0`.`SchoolId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """); } @@ -368,7 +368,7 @@ public override async Task Include_collection_with_OfType_base() SELECT `e`.`Id`, `e`.`Name`, `d`.`Id`, `d`.`Device`, `d`.`EmployeeId` FROM `Employees` AS `e` LEFT JOIN `Devices` AS `d` ON `e`.`Id` = `d`.`EmployeeId` -ORDER BY `e`.`Id`, `d`.`Id` +ORDER BY `e`.`Id` """, // """ @@ -379,7 +379,7 @@ LEFT JOIN ( FROM `Devices` AS `d` WHERE `d`.`Device` <> 'foo' OR `d`.`Device` IS NULL ) AS `d0` ON `e`.`Id` = `d0`.`EmployeeId` -ORDER BY `e`.`Id`, `d0`.`Id` +ORDER BY `e`.`Id` """); } @@ -392,7 +392,7 @@ public override async Task Correlated_collection_correctly_associates_entities_w SELECT `b`.`Name`, `c`.`Id` FROM `Blogs` AS `b` LEFT JOIN `Comments` AS `c` ON `b`.`Name` = `c`.`BlogName` -ORDER BY `b`.`Name`, `c`.`Id` +ORDER BY `b`.`Name` """); } @@ -533,7 +533,7 @@ ORDER BY `e`.`Id` SELECT `e`.`Id`, `o`.`Id`, `o`.`AppEntityId` FROM `Entities` AS `e` LEFT JOIN `OtherEntity` AS `o` ON `e`.`Id` = `o`.`AppEntityId` -ORDER BY `e`.`Id`, `o`.`Id` +ORDER BY `e`.`Id` """); } } @@ -559,7 +559,7 @@ public override async Task Cycles_in_auto_include() SELECT `p`.`Id`, `d`.`Id`, `d`.`PrincipalId` FROM `PrincipalOneToMany` AS `p` LEFT JOIN `DependentOneToMany` AS `d` ON `p`.`Id` = `d`.`PrincipalId` -ORDER BY `p`.`Id`, `d`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -567,7 +567,7 @@ public override async Task Cycles_in_auto_include() FROM (`DependentOneToMany` AS `d` INNER JOIN `PrincipalOneToMany` AS `p` ON `d`.`PrincipalId` = `p`.`Id`) LEFT JOIN `DependentOneToMany` AS `d0` ON `p`.`Id` = `d0`.`PrincipalId` -ORDER BY `d`.`Id`, `d0`.`Id` +ORDER BY `d`.`Id` """, // """ @@ -624,7 +624,7 @@ LEFT JOIN ( FROM `ManyDependent` AS `m0` LEFT JOIN `SingleDependent` AS `s` ON `m0`.`Id` = `s`.`ManyDependentId` ) AS `s0` ON `p`.`Id` = `s0`.`PrincipalId` -ORDER BY `m`.`Id`, `s0`.`Id` +ORDER BY `m`.`Id` """); } @@ -691,7 +691,7 @@ public override async Task Filtered_collection_through_optional_navigation_does_ FROM (`People` AS `p` LEFT JOIN `Employers` AS `e` ON `p`.`EmployerId` = `e`.`EmployerId`) LEFT JOIN `People` AS `p0` ON `e`.`EmployerId` = `p0`.`EmployerId` AND `p`.`PersonId` <> `p0`.`PersonId` -ORDER BY `p`.`PersonId`, `p0`.`PersonId` +ORDER BY `p`.`PersonId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs index 93761e5a..0428dac0 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/AdHocQuerySplittingQueryLibRedTest.cs @@ -67,7 +67,7 @@ public override async Task Can_configure_SingleQuery_at_context_level() SELECT `p`.`Id`, `c`.`Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -88,7 +88,7 @@ ORDER BY `p`.`Id` FROM (`Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId`) LEFT JOIN `AnotherChild` AS `a` ON `p`.`Id` = `a`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id`, `a`.`Id` +ORDER BY `p`.`Id`, `c`.`Id` """); } @@ -114,7 +114,7 @@ ORDER BY `p`.`Id` SELECT `p`.`Id`, `c`.`Id`, `c`.`ParentId` FROM `Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id` +ORDER BY `p`.`Id` """, // """ @@ -174,7 +174,7 @@ public override async Task Using_AsSingleQuery_without_context_configuration_doe FROM (`Parents` AS `p` LEFT JOIN `Child` AS `c` ON `p`.`Id` = `c`.`ParentId`) LEFT JOIN `AnotherChild` AS `a` ON `p`.`Id` = `a`.`ParentId` -ORDER BY `p`.`Id`, `c`.`Id`, `a`.`Id` +ORDER BY `p`.`Id`, `c`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs index 40967b88..60fab13d 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionLibRedTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId`) = 2) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -67,7 +67,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Int` <> 8) = 2) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -107,7 +107,7 @@ ORDER BY `a`.`Id` ORDER BY `a3`.`Id` DESC ) AS `a4` ORDER BY `a4`.`Id`) = 8) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -143,7 +143,7 @@ SELECT COUNT(*) FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` ) AS `a0`) = 2) AND (`a2`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -257,7 +257,7 @@ SELECT IIF(SUM(`a`.`Int`) IS NULL, 0, SUM(`a`.`Int`)) WHERE `r`.`Id` = `a`.`CollectionRootId` GROUP BY `a`.`String` )) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs index f492298b..d022e0d9 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeLibRedTest.cs @@ -32,7 +32,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -60,7 +60,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -88,7 +88,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -116,7 +116,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -144,7 +144,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -172,7 +172,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -200,7 +200,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -228,7 +228,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -256,7 +256,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs index 37ce5f5b..2605e591 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousLibRedTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Int` = 8) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -64,7 +64,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Int` = 8) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -92,7 +92,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Int` = 8) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -124,7 +124,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `m`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `m`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs index 97f3f6b1..fd774e68 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionLibRedTest.cs @@ -34,7 +34,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -105,7 +105,7 @@ public override async Task Select_associate(QueryTrackingBehavior queryTrackingB LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -121,7 +121,7 @@ public override async Task Select_optional_associate(QueryTrackingBehavior query LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -191,7 +191,7 @@ public override async Task Select_required_associate_via_optional_navigation(Que LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -208,7 +208,7 @@ public override async Task Select_unmapped_associate_scalar_property(QueryTracki LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -243,7 +243,7 @@ LEFT JOIN ( INNER JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` ) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `r`.`Id`, `s`.`Id` """); } @@ -257,7 +257,7 @@ public override async Task Select_nested_collection_on_required_associate(QueryT FROM (`RootEntity` AS `r` INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`Id` = `n`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n`.`Id` +ORDER BY `r`.`Id` """); } @@ -271,7 +271,7 @@ public override async Task Select_nested_collection_on_optional_associate(QueryT FROM (`RootEntity` AS `r` LEFT JOIN `AssociateType` AS `a` ON `r`.`OptionalAssociateId` = `a`.`Id`) LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`Id` = `n`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n`.`Id` +ORDER BY `r`.`Id` """); } @@ -288,7 +288,7 @@ public override async Task SelectMany_associate_collection(QueryTrackingBehavior LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `a`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id`, `a`.`Id` """); } @@ -357,7 +357,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n11` ON `a`.`Id` = `n11`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n12` ON `a0`.`Id` = `n12`.`CollectionAssociateId` WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `n11`.`Id`, `n12`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `n11`.`Id` """); } @@ -375,7 +375,7 @@ public override async Task Select_required_associate_duplicated(QueryTrackingBeh LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n2` ON `a`.`Id` = `n2`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id`, `n2`.`Id` +ORDER BY `r`.`Id`, `n1`.`Id` """); } @@ -396,7 +396,7 @@ public override async Task Select_required_associate_and_optional_associate(Quer LEFT JOIN `NestedAssociateType` AS `n3` ON `a`.`Id` = `n3`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n4` ON `a0`.`Id` = `n4`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n3`.`Id`, `n4`.`Id` +ORDER BY `r`.`Id`, `n3`.`Id` """); } @@ -413,7 +413,7 @@ public override async Task Select_optional_associate_and_ints(QueryTrackingBehav LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } @@ -430,7 +430,7 @@ public override async Task Select_associate_and_target_to_index_based_binding_vi LEFT JOIN `NestedAssociateType` AS `n0` ON `a`.`RequiredNestedAssociateId` = `n0`.`Id`) LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`Id` = `n1`.`CollectionAssociateId` WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL -ORDER BY `r`.`Id`, `n1`.`Id` +ORDER BY `r`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs index b8c09c30..95f41f81 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityLibRedTest.cs @@ -34,7 +34,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` = `a0`.`Id`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -62,7 +62,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` = `n0`.`Id`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -90,7 +90,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` <> `a0`.`Id` OR `a0`.`Id` IS NULL) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -118,7 +118,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` IS NULL) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -146,7 +146,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` IS NULL) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -174,7 +174,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` IS NULL) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -202,7 +202,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` = 1000) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -232,7 +232,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`n`.`Id` = @entity_equality_nested_Id) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -260,7 +260,7 @@ LEFT JOIN ( LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` WHERE (`a`.`Id` = `a0`.`Id`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } @@ -307,7 +307,7 @@ LEFT JOIN ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = 1002)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -340,7 +340,7 @@ LEFT JOIN ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = @entity_equality_nested_Id)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -374,7 +374,7 @@ LEFT JOIN ( SELECT 1 FROM `NestedAssociateType` AS `n` WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Int` > @get_Item_Int AND `n`.`Id` = @entity_equality_get_Item_Id)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id`, `n8`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n7`.`Id` """); } @@ -408,7 +408,7 @@ LEFT JOIN ( SELECT 1 FROM `AssociateType` AS `a` WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Id` > @get_Item_Id AND `a`.`Id` = @entity_equality_get_Item_Id)) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) -ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id`, `n7`.`Id` +ORDER BY `r`.`Id`, `s`.`Id`, `s`.`Id0`, `n6`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionLibRedTest.cs index c22a2945..6179ebbd 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionLibRedTest.cs @@ -107,7 +107,7 @@ ORDER BY `r0`.`Id` ORDER BY `r9`.`Id` DESC ) AS `r10` ORDER BY `r10`.`Id`) = 8 -ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r8`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r8`.`AssociateTypeRootEntityId`, `r8`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs index 8ed94247..a49385cd 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsLibRedTest.cs @@ -46,7 +46,7 @@ SELECT 1 FROM `RelatedCollection` AS `r1` WHERE `r`.`Id` = `r1`.`RootEntityId` AND `r1`.`String` = 'foo' ) AS `u`) = 4 -ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`RootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`RootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId`, `r9`.`Id` """); } @@ -114,7 +114,7 @@ SELECT 1 FROM `RequiredRelated_NestedCollection` AS `r2` WHERE `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId` AND `r2`.`String` = 'foo' ) AS `u`) = 4 -ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r9`.`AssociateTypeRootEntityId`, `r9`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs index 1f9be8ff..d0eca7c3 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsQueryLibRedTest.cs @@ -37,7 +37,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -61,7 +61,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id1` +ORDER BY `l`.`Id`, `s0`.`Id`, `s0`.`Id0` """); } @@ -80,7 +80,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -99,7 +99,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l2` LEFT JOIN `LevelOne` AS `l3` ON `l2`.`OneToOne_Optional_Self1Id` = `l3`.`Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Self_Inverse1Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -113,7 +113,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -127,7 +127,7 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -144,7 +144,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -157,7 +157,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY IIF(`l`.`Name` LIKE '%03', 1, 2), `l`.`Id`, `l0`.`Id` +ORDER BY IIF(`l`.`Name` LIKE '%03', 1, 2), `l`.`Id` """); } @@ -176,7 +176,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -195,7 +195,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Required_Inverse3Id` WHERE `l0`.`Name` <> 'L2 09' OR `l0`.`Name` IS NULL -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -221,7 +221,7 @@ ORDER BY `l4`.`Name` DESC LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id`) LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Required_Inverse3Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l2`.`Id`, `l3`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id`, `l2`.`Id` """); } @@ -248,7 +248,7 @@ ORDER BY `l5`.`Name` DESC LEFT JOIN `LevelTwo` AS `l2` ON `l1`.`Id` = `l2`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`OneToMany_Optional_Inverse3Id`) LEFT JOIN `LevelThree` AS `l4` ON `l2`.`Id` = `l4`.`OneToMany_Required_Inverse3Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id`, `l4`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id` """); } @@ -274,7 +274,7 @@ ORDER BY `l4`.`Name` DESC LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`Level2_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l1`.`Name`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l1`.`Name`, `l1`.`Id` """); } @@ -293,7 +293,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b LEFT JOIN `LevelThree` AS `l4` ON `l3`.`Id` = `l4`.`Level2_Optional_Id`) LEFT JOIN `LevelThree` AS `l5` ON `l0`.`Id` = `l5`.`OneToMany_Optional_Inverse3Id` WHERE `l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL -ORDER BY `l`.`Id`, `l5`.`Id` +ORDER BY `l`.`Id` """); } @@ -307,7 +307,7 @@ public override async Task SelectMany_with_Include1(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -321,7 +321,7 @@ public override async Task Orderby_SelectMany_with_Include1(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -349,7 +349,7 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -366,7 +366,7 @@ public override async Task Multiple_SelectMany_with_Include(bool async) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l1`.`Id` = `l3`.`OneToMany_Optional_Inverse4Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`OneToMany_Optional_Inverse3Id` IS NOT NULL -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -413,7 +413,7 @@ LEFT JOIN ( FROM `LevelThree` AS `l1` LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l0`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -427,7 +427,7 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id` """); } @@ -441,7 +441,7 @@ public override async Task Optional_navigation_with_Include_and_order(bool async FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id` """); } @@ -455,7 +455,7 @@ public override async Task SelectMany_with_order_by_and_Include(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -469,7 +469,7 @@ public override async Task SelectMany_with_Include_and_order_by(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -486,7 +486,7 @@ INNER JOIN ( FROM `LevelTwo` AS `l0` ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -503,7 +503,7 @@ INNER JOIN ( FROM `LevelTwo` AS `l0` ) AS `l1` ON `l`.`Id` = `l1`.`FK`) LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -558,7 +558,7 @@ public override async Task Project_collection_navigation(bool async) SELECT `l`.`Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -572,7 +572,7 @@ public override async Task Project_collection_navigation_nested(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -586,7 +586,7 @@ public override async Task Project_collection_navigation_using_ef_property(bool FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -600,7 +600,7 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -618,7 +618,7 @@ LEFT JOIN ( WHERE `l0`.`Name` <> 'Foo' OR `l0`.`Name` IS NULL ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` WHERE `l`.`Id` < 3 -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -631,7 +631,7 @@ public override async Task Project_collection_and_root_entity(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -645,7 +645,7 @@ public override async Task Project_collection_and_include(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -659,7 +659,7 @@ public override async Task Project_navigation_and_collection(bool async) FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -691,7 +691,7 @@ public override async Task Include_collection_with_multiple_orderbys_member(bool SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Name`, `l`.`Level1_Required_Id`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Name`, `l`.`Level1_Required_Id`, `l`.`Id` """); } @@ -704,7 +704,7 @@ public override async Task Include_collection_with_multiple_orderbys_property(bo SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -717,7 +717,7 @@ public override async Task Include_collection_with_multiple_orderbys_methodcall( SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY ABS(`l`.`Level1_Required_Id`), `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY ABS(`l`.`Level1_Required_Id`), `l`.`Name`, `l`.`Id` """); } @@ -730,7 +730,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex(boo SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY ABS(`l`.`Level1_Required_Id`) + 7, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY ABS(`l`.`Level1_Required_Id`) + 7, `l`.`Name`, `l`.`Id` """); } @@ -743,7 +743,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex_rep SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -835,7 +835,7 @@ public override async Task Include_reference_collection_order_by_reference_navig FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l0`.`Id`, `l`.`Id`, `l1`.`Id` +ORDER BY `l0`.`Id`, `l`.`Id` """); } @@ -849,7 +849,7 @@ public override async Task Include_after_SelectMany(bool async) FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Required_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -866,7 +866,7 @@ public override async Task Include_after_multiple_SelectMany_and_reference_navig LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Required_Self_Inverse4Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`OneToMany_Optional_Inverse3Id` IS NOT NULL -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -882,7 +882,7 @@ public override async Task Include_after_SelectMany_and_multiple_reference_navig LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id`) LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`OneToMany_Optional_Self_Inverse4Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l3`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -899,7 +899,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -916,7 +916,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -930,7 +930,7 @@ public override async Task SelectMany_navigation_property_followed_by_select_col FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -946,7 +946,7 @@ public override async Task Multiple_SelectMany_navigation_property_followed_by_s LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`OneToMany_Optional_Inverse3Id` IS NOT NULL -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -961,7 +961,7 @@ public override async Task SelectMany_navigation_property_with_include_and_follo INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Required_Inverse3Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` """); } @@ -974,7 +974,7 @@ public override async Task Include_collection(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -991,7 +991,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1005,7 +1005,7 @@ public override async Task Include_reference_followed_by_include_collection(bool FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1018,7 +1018,7 @@ public override async Task Include_collection_followed_by_projecting_the_include SELECT `l`.`Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -1035,7 +1035,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1053,7 +1053,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1071,7 +1071,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1091,7 +1091,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`Level2_Optional_Id`) LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id3` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1111,7 +1111,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l3` ON `l0`.`Id` = `l3`.`Level2_Optional_Id`) LEFT JOIN `LevelFour` AS `l4` ON `l3`.`Id` = `l4`.`OneToMany_Optional_Inverse4Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Id3` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1129,7 +1129,7 @@ LEFT JOIN ( LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id1` +ORDER BY `l`.`Id` """); } @@ -1151,7 +1151,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`OneToOne_Optional_PK_Inverse3Id` ) AS `s0` ON `l`.`Id` = `s0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s0`.`Id` +ORDER BY `l`.`Id`, `s`.`Id` """); } @@ -1174,7 +1174,7 @@ SELECT COUNT(*) FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` WHERE `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` AND (`l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL)) > 0 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -1215,7 +1215,7 @@ public override async Task Including_reference_navigation_and_projecting_collect LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id`) LEFT JOIN `LevelTwo` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -1233,7 +1233,7 @@ SELECT IIF(`l0`.`Id` IS NULL, 0, `l0`.`Id`), `l`.`Id`, `l1`.`Id`, `l1`.`Level2_O LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Required_Inverse3Id` WHERE `l`.`Name` IN (@validIds1, @validIds2) -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1296,7 +1296,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` WHERE `l0`.`Id` > 5 ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -1309,7 +1309,7 @@ public override async Task Filtered_include_OrderBy(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Name`, `l0`.`Id` +ORDER BY `l`.`Id`, `l0`.`Name` """); } @@ -1326,7 +1326,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Name0`, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Id`, `s`.`Name0` """); } @@ -1343,7 +1343,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`Name0` DESC, `s`.`Id0` +ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Id`, `s`.`Name0` DESC """); } @@ -1984,7 +1984,7 @@ SELECT TOP 1 `l`.`Id` WHERE `l`.`Id` = 1 ) AS `l1` LEFT JOIN `LevelTwo` AS `l0` ON `l1`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l1`.`Id`, `l0`.`Id` +ORDER BY `l1`.`Id` """); } @@ -2352,7 +2352,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l0` WHERE `l0`.`Name` IN (@validIds1, @validIds2) ) AS `l2` ON `l1`.`Date` = `l2`.`Date` -ORDER BY `l1`.`Date`, `l2`.`Id` +ORDER BY `l1`.`Date` """); } @@ -2372,7 +2372,7 @@ LEFT JOIN ( LEFT JOIN `LevelFour` AS `l3` ON `l2`.`Id` = `l3`.`Level3_Optional_Id` ) AS `s` ON `l1`.`Id` = `s`.`OneToMany_Optional_Inverse3Id` WHERE `l0`.`Id` < 3 OR `l1`.`Id` > 8 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -2614,7 +2614,7 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool SELECT `l`.`Id`, `l0`.`Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -2650,7 +2650,7 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2688,7 +2688,7 @@ public override async Task Include_collection_with_multiple_orderbys_complex_rep SELECT `l`.`Id`, `l`.`Date`, `l`.`Level1_Optional_Id`, `l`.`Level1_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse2Id`, `l`.`OneToMany_Optional_Self_Inverse2Id`, `l`.`OneToMany_Required_Inverse2Id`, `l`.`OneToMany_Required_Self_Inverse2Id`, `l`.`OneToOne_Optional_PK_Inverse2Id`, `l`.`OneToOne_Optional_Self2Id`, `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelTwo` AS `l` LEFT JOIN `LevelThree` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse3Id` -ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY -`l`.`Level1_Required_Id`, `l`.`Name`, `l`.`Id` """); } @@ -2703,7 +2703,7 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -2760,7 +2760,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l2` LEFT JOIN `LevelThree` AS `l3` ON `l2`.`Id` = `l3`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2779,7 +2779,7 @@ LEFT JOIN ( FROM `LevelOne` AS `l2` LEFT JOIN `LevelOne` AS `l3` ON `l2`.`OneToOne_Optional_Self1Id` = `l3`.`Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Self_Inverse1Id` -ORDER BY `l`.`Id`, `l1`.`Id`, `s`.`Id` +ORDER BY `l`.`Id`, `l1`.`Id` """); } @@ -2802,7 +2802,7 @@ SELECT COUNT(*) FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToOne_Optional_PK_Inverse3Id` WHERE `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` AND (`l1`.`Name` <> 'Foo' OR `l1`.`Name` IS NULL)) > 0 -ORDER BY `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Id` """); } @@ -2819,7 +2819,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` WHERE `l0`.`Id` > 5 ) AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id` """); } @@ -2832,7 +2832,7 @@ public override async Task Filtered_include_OrderBy_EF_Property(bool async) SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Name`, `l0`.`Id` +ORDER BY `l`.`Id`, `l0`.`Name` """); } @@ -2887,7 +2887,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2904,7 +2904,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id` """); } @@ -2921,7 +2921,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l0` LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` ) AS `s` ON `l`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `s`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2935,7 +2935,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_mult FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Id` """); } @@ -2949,7 +2949,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Name`, `l`.`Id`, `l1`.`Id` +ORDER BY `l`.`Name`, `l`.`Id` """); } @@ -2962,7 +2962,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -2976,7 +2976,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference_multi FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Required_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs index 8e636f33..52353f39 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryLibRedTest.cs @@ -4427,7 +4427,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference(bool SELECT `l`.`Name`, `l`.`Id`, `l`.`Date`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -4441,7 +4441,7 @@ public override async Task Final_GroupBy_property_entity_Include_reference_multi FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Required_Id` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs index 5c761038..45fcdd18 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/ComplexNavigationsQueryLibRedTest.cs @@ -257,7 +257,7 @@ LEFT JOIN ( FROM `Globalizations` AS `g0` LEFT JOIN `Languages` AS `l0` ON `g0`.`LanguageName` = `l0`.`Name` ) AS `s0` ON `m0`.`DefaultText` = `s0`.`ComplexNavigationStringDefaultText` -ORDER BY `f`.`Name`, `s`.`Text`, `s0`.`Text` +ORDER BY `f`.`Name`, `s`.`Text` """); } @@ -1369,7 +1369,7 @@ LEFT JOIN ( FROM `LevelTwo` AS `l1` LEFT JOIN `LevelThree` AS `l2` ON `l1`.`Id` = `l2`.`Level2_Optional_Id` ) AS `s` ON `m`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `m`.`Id`, `l0`.`Id`, `s`.`Id` +ORDER BY `m`.`Id`, `l0`.`Id` """); } @@ -1515,7 +1515,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1528,7 +1528,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1541,7 +1541,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT `l0`.`Id`, `l0`.`Date`, `l0`.`Level1_Optional_Id`, `l0`.`Level1_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse2Id`, `l0`.`OneToMany_Optional_Self_Inverse2Id`, `l0`.`OneToMany_Required_Inverse2Id`, `l0`.`OneToMany_Required_Self_Inverse2Id`, `l0`.`OneToOne_Optional_PK_Inverse2Id`, `l0`.`OneToOne_Optional_Self2Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1556,7 +1556,7 @@ public override async Task Order_by_key_of_navigation_similar_to_projected_gets_ INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelOne` AS `l1` ON `l0`.`Level1_Required_Id` = `l1`.`Id` WHERE `l0`.`Level1_Required_Id` IS NOT NULL AND `l1`.`Id` IS NOT NULL -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1592,7 +1592,7 @@ public override async Task Order_by_key_of_anonymous_type_projected_navigation_d SELECT TOP @p `l0`.`Name` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1645,7 +1645,7 @@ SELECT TOP @p `l`.`Name` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`Level2_Required_Id` IS NOT NULL -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -1663,7 +1663,7 @@ SELECT TOP @p `l0`.`Name` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` WHERE `l0`.`Id` IS NOT NULL AND `l1`.`Level2_Required_Id` IS NOT NULL -ORDER BY `l0`.`Id`, `l`.`Id` +ORDER BY `l0`.`Id` """); } @@ -3056,7 +3056,7 @@ await base LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`DifferentTypeReference_InheritanceDerived1Id`) LEFT JOIN `InheritanceLeafTwo` AS `i1` ON `i`.`Id` = `i1`.`DifferentTypeReference_InheritanceDerived2Id`) LEFT JOIN `InheritanceTwo` AS `i2` ON `i1`.`Id` = `i2`.`InheritanceLeaf2Id` -ORDER BY `i`.`Id`, `i2`.`Id` +ORDER BY `i`.`Id` """); } @@ -3070,7 +3070,7 @@ public override async Task String_include_multiple_derived_collection_navigation FROM (`InheritanceOne` AS `i` LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`InheritanceDerived1Id1`) LEFT JOIN `InheritanceLeafOne` AS `i1` ON `i`.`Id` = `i1`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `i1`.`Id` +ORDER BY `i`.`Id`, `i0`.`Id` """); } @@ -3084,7 +3084,7 @@ public override async Task String_include_multiple_derived_collection_navigation FROM (`InheritanceOne` AS `i` LEFT JOIN `InheritanceLeafOne` AS `i0` ON `i`.`Id` = `i0`.`InheritanceDerived1Id`) LEFT JOIN `InheritanceLeafTwo` AS `i1` ON `i`.`Id` = `i1`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `i1`.`Id` +ORDER BY `i`.`Id`, `i0`.`Id` """); } @@ -3106,7 +3106,7 @@ LEFT JOIN ( FROM `InheritanceLeafTwo` AS `i1` LEFT JOIN `InheritanceTwo` AS `i2` ON `i1`.`Id` = `i2`.`InheritanceLeaf2Id` ) AS `s` ON `i`.`Id` = `s`.`InheritanceDerived2Id` -ORDER BY `i`.`Id`, `i0`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `i`.`Id`, `i0`.`Id`, `s`.`Id` """); } @@ -3127,7 +3127,7 @@ LEFT JOIN ( LEFT JOIN `InheritanceLeafOne` AS `i4` ON `i3`.`Id` = `i4`.`SameTypeReference_InheritanceDerived1Id`) LEFT JOIN `InheritanceLeafOne` AS `i5` ON `i3`.`Id` = `i5`.`SameTypeReference_InheritanceDerived2Id` ) AS `s` ON `i`.`Id` = `s`.`InheritanceBase2Id1` -ORDER BY `i`.`Id`, `i1`.`Id`, `i2`.`Id`, `s`.`Id` +ORDER BY `i`.`Id`, `i1`.`Id`, `i2`.`Id` """); } @@ -3577,7 +3577,7 @@ public override async Task Join_with_navigations_in_the_result_selector2(bool is INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l2` ON `l0`.`Id` = `l2`.`OneToMany_Optional_Inverse3Id` -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -3788,7 +3788,7 @@ SELECT COUNT(*) LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` ) AS `s` -ORDER BY `s`.`c`, `s`.`Name0`, `s`.`Id` +ORDER BY `s`.`c`, `s`.`Name0` """); } @@ -4344,7 +4344,7 @@ public override async Task SelectMany_subquery_with_custom_projection(bool async SELECT TOP @p `l0`.`Name` FROM `LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id` +ORDER BY `l`.`Id` """); } @@ -4358,7 +4358,7 @@ public override async Task Include_multiple_collections_on_same_level(bool async FROM (`LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`OneToMany_Optional_Inverse2Id`) LEFT JOIN `LevelTwo` AS `l1` ON `l`.`Id` = `l1`.`OneToMany_Required_Inverse2Id` -ORDER BY `l`.`Id`, `l0`.`Id`, `l1`.`Id` +ORDER BY `l`.`Id`, `l0`.`Id` """); } @@ -4759,7 +4759,7 @@ public override async Task Null_check_removal_applied_recursively_complex(bool a LEFT JOIN `LevelOne` AS `l1` ON `l0`.`OneToMany_Required_Inverse2Id` = `l1`.`Id`) LEFT JOIN `LevelFour` AS `l2` ON `l`.`Id` = `l2`.`OneToMany_Optional_Inverse4Id` WHERE (`l1`.`Name` = 'L1 01') AND (`l0`.`OneToMany_Required_Inverse2Id` IS NOT NULL AND `l1`.`Id` IS NOT NULL) -ORDER BY `l`.`Id`, `l2`.`Id` +ORDER BY `l`.`Id` """); } @@ -4819,7 +4819,7 @@ SELECT MAX(`l3`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id`) LEFT JOIN `LevelFour` AS `l2` ON `l1`.`Id` = `l2`.`Level3_Required_Id` ) AS `s` ON `l4`.`Id` = `s`.`OneToMany_Optional_Inverse2Id` -ORDER BY `l4`.`Id`, `s`.`Id` +ORDER BY `l4`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs index ea13062e..b47d250f 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/ComplexTypeQueryLibRedTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; @@ -1060,7 +1061,7 @@ public override async Task Union_of_same_nested_complex_type_projected_twice_wit FROM `Customer` AS `c1`, `Customer` AS `c2` ) AS `u` -ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_FullName0` +ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0` """); } @@ -1089,7 +1090,7 @@ public override async Task Union_of_same_nested_complex_type_projected_twice_wit ORDER BY `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_ZipCode0` ) AS `u0` ) AS `u1` -ORDER BY `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_FullName0` +ORDER BY `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_ZipCode0` """); } @@ -1246,6 +1247,359 @@ ORDER BY `c1`.`Id` DESC """); } + #region Non-shared test resources + + public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() + { + await base.Complex_type_equals_parameter_with_nested_types_with_property_of_same_name(); + + AssertSql( + """ +@entity_equality_container_Id='1' (Nullable = true) +@entity_equality_container_Containee1_Id='2' (Nullable = true) +@entity_equality_container_Containee2_Id='3' (Nullable = true) + +SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` +FROM `EntityType` AS `e` +WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id +"""); + } + + public override async Task Projecting_complex_property_does_not_auto_include_owned_types() + { + await base.Projecting_complex_property_does_not_auto_include_owned_types(); + + AssertSql( + """ +SELECT `e`.`Complex_Name`, `e`.`Complex_Number` +FROM `EntityType` AS `e` +"""); + } + + #region 36837 + + #region 35025 + + public override async Task Select_TPC_base_with_ComplexType() + { + await base.Select_TPC_base_with_ComplexType(); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`ChildProperty`, NULL AS `ChildProperty1`, `t`.`PropertyInsideComplexThing`, `t`.`ChildComplexProperty_PropertyInsideComplexThing`, NULL AS `ChildComplexProperty_PropertyInsideComplexThing1`, 'TpcChild1' AS `Discriminator` +FROM `TpcChild1` AS `t` +UNION ALL +SELECT `t0`.`Id`, CVar(NULL) AS `ChildProperty`, `t0`.`ChildProperty` AS `ChildProperty1`, `t0`.`PropertyInsideComplexThing`, CVar(NULL) AS `ChildComplexProperty_PropertyInsideComplexThing`, `t0`.`ChildComplexProperty_PropertyInsideComplexThing` AS `ChildComplexProperty_PropertyInsideComplexThing1`, 'TpcChild2' AS `Discriminator` +FROM `TpcChild2` AS `t0` +"""); + } + + #endregion 35025 + + #region 34706 + + public override async Task Complex_type_on_an_entity_mapped_to_view_and_table() + { + await base.Complex_type_on_an_entity_mapped_to_view_and_table(); + + AssertSql( + """ +SELECT TOP 2 `b`.`Id`, `b`.`ComplexThing_Prop1`, `b`.`ComplexThing_Prop2` +FROM `BlogsView` AS `b` +"""); + } + + #endregion 34706 + + #region 38077 + + public override async Task Complex_property_on_split_entity() + { + await base.Complex_property_on_split_entity(); + + AssertSql( + """ +SELECT `h`.`Id`, `h`.`CreatedOn`, `h0`.`IsTestHook`, `h0`.`Weight`, `h`.`Number_Parsed`, `h`.`Number_Raw` +FROM `Hook` AS `h` +INNER JOIN `HookMetadata` AS `h0` ON `h`.`Id` = `h0`.`HookId` +"""); + } + + #endregion 38077 + + [Fact] + public virtual async Task Complex_type_equality_with_non_default_type_mapping() + { + var contextFactory = await InitializeNonSharedTest( + seed: context => + { + context.AddRange( + new Context36837.EntityType { ComplexThing = new Context36837.ComplexThing { DateTime = new DateTime(2020, 1, 1) } }); + return context.SaveChangesAsync(); + }); + + await using var context = contextFactory.CreateDbContext(); + + var count = await context.Set() + .CountAsync(b => b.ComplexThing == new Context36837.ComplexThing { DateTime = new DateTime(2020, 1, 1, 1, 1, 1, 999, 999) }); + Assert.Equal(0, count); + + AssertSql( + """ +SELECT COUNT(*) +FROM `EntityType` AS `e` +WHERE `e`.`ComplexThing_DateTime` = #2020-01-01 01:01:01.999# +"""); + } + + private class Context36837(DbContextOptions options) : DbContext(options) + { + protected override void OnModelCreating(ModelBuilder modelBuilder) + => modelBuilder.Entity().ComplexProperty(b => b.ComplexThing); + + public class EntityType + { + public int Id { get; set; } + public ComplexThing ComplexThing { get; set; } = null!; + } + + public class ComplexThing + { + [Column(TypeName = "datetime")] // Non-default type mapping + public DateTime DateTime { get; set; } + } + } + + #endregion 36837 + + + public override async Task Optional_complex_type_with_discriminator() + { + await base.Optional_complex_type_with_discriminator(); + + AssertSql( + """ +SELECT TOP 2 `e`.`Id`, `e`.`AllOptionalsComplexType_Discriminator`, `e`.`AllOptionalsComplexType_OptionalProperty` +FROM `EntityType` AS `e` +WHERE `e`.`AllOptionalsComplexType_Discriminator` IS NULL +""", + // + """ +@p2='3' +@p0='AllOptionalsComplexType' (Size = 255) +@p1='New thing' (Size = 255) + +UPDATE `EntityType` SET `AllOptionalsComplexType_Discriminator` = @p0, `AllOptionalsComplexType_OptionalProperty` = @p1 +WHERE `Id` = @p2; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT `e`.`Id`, `e`.`AllOptionalsComplexType_Discriminator`, `e`.`AllOptionalsComplexType_OptionalProperty` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Non_optional_complex_type_with_all_nullable_properties() + { + await base.Non_optional_complex_type_with_all_nullable_properties(); + + AssertSql( + """ +SELECT TOP 2 `e`.`Id`, `e`.`NonOptionalComplexType_NullableDateTime`, `e`.`NonOptionalComplexType_NullableString` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Non_optional_complex_type_with_all_nullable_properties_via_left_join() + { + await base.Non_optional_complex_type_with_all_nullable_properties_via_left_join(); + + AssertSql( + """ +SELECT `p0`.`Id`, `c`.`Id`, `c`.`ParentId`, `c`.`ComplexType_NullableDateTime`, `c`.`ComplexType_NullableString` +FROM ( + SELECT TOP 2 `p`.`Id` + FROM `Parent` AS `p` +) AS `p0` +LEFT JOIN `Child` AS `c` ON `p0`.`Id` = `c`.`ParentId` +ORDER BY `p0`.`Id` +"""); + } + + public override async Task Nullable_complex_type_with_discriminator_and_shadow_property() + { + await base.Nullable_complex_type_with_discriminator_and_shadow_property(); + + AssertSql( + """ +SELECT `e`.`Id`, `e`.`CreatedBy`, `e`.`Prop_Discriminator`, `e`.`Prop_OptionalValue` +FROM `EntityType` AS `e` +"""); + } + + public override async Task Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_null_to_non_null_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_non_null_to_null_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip() + { + await base.Nullable_complex_type_with_discriminator_update_non_null_entity_roundtrip(); + } + + public override async Task Nullable_complex_type_with_discriminator_set_to_different_value() + { + await base.Nullable_complex_type_with_discriminator_set_to_different_value(); + } + + public override async Task Nullable_complex_type_with_discriminator_set_to_null() + { + await base.Nullable_complex_type_with_discriminator_set_to_null(); + } + + public override async Task Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip() + { + await base.Nested_nullable_complex_type_with_discriminator_null_to_non_null_roundtrip(); + } + + public override async Task Update_entity_with_nullable_complex_type_and_discriminator_does_not_throw() + { + await base.Update_entity_with_nullable_complex_type_and_discriminator_does_not_throw(); + } + + public override async Task Can_query_by_complex_type_property_with_index() + { + await base.Can_query_by_complex_type_property_with_index(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +WHERE `p`.`Address_City` = 'Seattle' +"""); + } + + public override async Task Can_update_entity_with_index_on_complex_type_property() + { + await base.Can_update_entity_with_index_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +""", + // + """ +@p1='1' +@p0='98102' (Nullable = false) (Size = 255) + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +"""); + } + + public override async Task Can_delete_entity_with_index_on_complex_type_property() + { + await base.Can_delete_entity_with_index_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +""", + // + """ +@p0='1' + +DELETE FROM `Person` +WHERE `Id_Id` = @p0; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT COUNT(*) +FROM `Person` AS `p` +"""); + } + + public override async Task Can_query_by_alternate_key_on_complex_type_property() + { + await base.Can_query_by_alternate_key_on_complex_type_property(); + + AssertSql( + """ +SELECT TOP 2 `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +WHERE `p`.`Address_City` = 'Redmond' +"""); + } + + public override async Task Can_save_batch_swapping_alternate_key_values_on_complex_type_property() + { + await base.Can_save_batch_swapping_alternate_key_values_on_complex_type_property(); + + AssertSql( + """ +SELECT `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +ORDER BY `p`.`Id_Id` +""", + // + """ +@p1='1' +@p0='98103' (Nullable = false) (Size = 255) + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +@p1='2' +@p0='98054' (Nullable = false) (Size = 255) + +UPDATE `Person` SET `Address_PostalCode` = @p0 +WHERE `Id_Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +SELECT `p`.`Id_Id`, `p`.`Address_City`, `p`.`Address_PostalCode` +FROM `Person` AS `p` +ORDER BY `p`.`Id_Id` +"""); + } + + public override async Task Complex_json_collection_inside_left_join_subquery() + { + await base.Complex_json_collection_inside_left_join_subquery(); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`ChildId`, `c0`.`Id`, `c0`.`IsPublic`, `c0`.`c` +FROM `Parent` AS `p` +LEFT JOIN ( + SELECT `c`.`Id`, `c`.`IsPublic`, `c`.`CareNeeds` AS `c` + FROM `Child` AS `c` + WHERE `c`.`IsPublic` +) AS `c0` ON `p`.`ChildId` = `c0`.`Id` +"""); + } + + #endregion Non-shared test resources + [Fact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.LibRed.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs index c6318b5e..71c9973b 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/CompositeKeysQueryLibRedTest.cs @@ -28,7 +28,7 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1` """); } @@ -42,7 +42,7 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1` DESC, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1` DESC, `c0`.`Id1`, `c0`.`Id2`, `c1`.`Id1` """); } @@ -56,7 +56,7 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id1`, `c`.`Id2`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id1`, `c`.`Id2`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1` """); } @@ -70,7 +70,7 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le FROM (`CompositeOnes` AS `c` LEFT JOIN `CompositeTwos` AS `c0` ON `c`.`Id1` = `c0`.`OneToMany_Optional_Inverse2Id1` AND `c`.`Id2` = `c0`.`OneToMany_Optional_Inverse2Id2`) LEFT JOIN `CompositeTwos` AS `c1` ON `c`.`Id1` = `c1`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `c1`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1`, `c1`.`Id2` +ORDER BY `c`.`Id2`, `c`.`Id1`, `c0`.`Id2`, `c0`.`Id1`, `c1`.`Name` DESC, `c1`.`Id1` """); } @@ -131,7 +131,7 @@ LEFT JOIN ( LEFT JOIN `CompositeFours` AS `c13` ON `c11`.`Id1` = `c13`.`OneToMany_Required_Inverse4Id1` AND `c11`.`Id2` = `c13`.`OneToMany_Required_Inverse4Id2` ) AS `s3` ON `c7`.`Id1` = `s3`.`OneToMany_Optional_Inverse3Id1` AND `c7`.`Id2` = `s3`.`OneToMany_Optional_Inverse3Id2` ) AS `s4` ON `c`.`Id1` = `s4`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `s4`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id10`, `s1`.`Id20`, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`Id110`, `s4`.`Id210` +ORDER BY `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id10`, `s1`.`Id20`, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`Id110` """); } @@ -175,7 +175,7 @@ LEFT JOIN ( LEFT JOIN `CompositeFours` AS `c13` ON `c11`.`Id1` = `c13`.`OneToMany_Required_Inverse4Id1` AND `c11`.`Id2` = `c13`.`OneToMany_Required_Inverse4Id2` ) AS `s3` ON `c7`.`Id1` = `s3`.`OneToMany_Optional_Inverse3Id1` AND `c7`.`Id2` = `s3`.`OneToMany_Optional_Inverse3Id2` ) AS `s4` ON `c`.`Id1` = `s4`.`OneToMany_Required_Inverse2Id1` AND `c`.`Id2` = `s4`.`OneToMany_Required_Inverse2Id2` -ORDER BY `c`.`Name`, `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id20` DESC, `s1`.`Id10` DESC, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`c`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`c0` DESC, `s4`.`Id110`, `s4`.`Id210` +ORDER BY `c`.`Name`, `c`.`Id1`, `c`.`Id2`, `s1`.`Id1`, `s1`.`Id2`, `s1`.`Id20` DESC, `s1`.`Id10` DESC, `s1`.`Id100`, `s1`.`Id200`, `s1`.`Id11`, `s1`.`Id21`, `s1`.`Id12`, `s1`.`Id22`, `s1`.`Id101`, `s1`.`Id201`, `s1`.`Id110`, `s1`.`Id210`, `s4`.`c`, `s4`.`Id1`, `s4`.`Id2`, `s4`.`Id10`, `s4`.`Id20`, `s4`.`Id100`, `s4`.`Id200`, `s4`.`Id11`, `s4`.`Id21`, `s4`.`Id12`, `s4`.`Id22`, `s4`.`Id101`, `s4`.`Id201`, `s4`.`c0` DESC, `s4`.`Id110` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Ef6GroupByLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Ef6GroupByLibRedTest.cs index 529500f7..9a4ed096 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Ef6GroupByLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Ef6GroupByLibRedTest.cs @@ -490,7 +490,7 @@ LEFT JOIN ( FROM `OrderForLinq` AS `o` LEFT JOIN `CustomerForLinq` AS `c0` ON `o`.`CustomerId` = `c0`.`Id` ) AS `s` ON `c`.`Id` = `s`.`Id0` -ORDER BY `c`.`Id`, `s`.`Id` +ORDER BY `c`.`Id` """); } @@ -500,7 +500,7 @@ public override async Task Whats_new_2021_sample_3(bool async) AssertSql( """ -SELECT `p2`.`c`, `p2`.`c0`, `p2`.`LastName` +SELECT `p2`.`c`, `p2`.`c0` FROM ( SELECT ( SELECT TOP 1 `p0`.`LastName` @@ -513,7 +513,7 @@ SELECT TOP 1 `p0`.`LastName` WHERE `p`.`MiddleInitial` = 'Q' AND `p`.`Age` = 20 GROUP BY `p`.`LastName` ) AS `p2` -ORDER BY `p2`.`c0`, `p2`.`LastName` +ORDER BY `p2`.`c0` """); } @@ -523,7 +523,7 @@ public override async Task Whats_new_2021_sample_5(bool async) AssertSql( """ -SELECT `p2`.`c`, `p2`.`FirstName` +SELECT `p2`.`c` FROM ( SELECT ( SELECT TOP 1 `p0`.`LastName` @@ -532,7 +532,7 @@ SELECT TOP 1 `p0`.`LastName` FROM `Person` AS `p` GROUP BY `p`.`FirstName` ) AS `p2` -ORDER BY `p2`.`c`, `p2`.`FirstName` +ORDER BY `p2`.`c` """); } @@ -542,7 +542,7 @@ public override async Task Whats_new_2021_sample_6(bool async) AssertSql( """ -SELECT `p2`.`c`, `p2`.`Id` +SELECT `p2`.`c` FROM ( SELECT ( SELECT TOP 1 `p0`.`MiddleInitial` @@ -552,7 +552,7 @@ SELECT TOP 1 `p0`.`MiddleInitial` WHERE `p`.`Age` = 20 GROUP BY `p`.`Id` ) AS `p2` -ORDER BY `p2`.`c`, `p2`.`Id` +ORDER BY `p2`.`c` """); } @@ -652,7 +652,7 @@ LEFT JOIN ( FROM `Person` AS `p0` LEFT JOIN `Shoes` AS `s` ON `p0`.`Id` = `s`.`PersonId` ) AS `s0` ON `p1`.`FirstName` = `s0`.`FirstName` -ORDER BY `p1`.`FirstName`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `p1`.`FirstName`, `s0`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs index aa2aff24..d039a556 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/EntitySplittingQueryLibRedTest.cs @@ -125,7 +125,7 @@ LEFT JOIN ( INNER JOIN `SplitEntityOnePart3` AS `s` ON `e0`.`Id` = `s`.`Id`) INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e0`.`Id` = `s0`.`Id` ) AS `s1` ON `e`.`Id` = `s1`.`EntityThreeId` -ORDER BY `e`.`Id`, `s1`.`Id` +ORDER BY `e`.`Id` """); } @@ -162,7 +162,7 @@ LEFT JOIN ( INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e0`.`Id` = `s0`.`Id`) LEFT JOIN `EntityTwo` AS `e1` ON `e0`.`Id` = `e1`.`EntityOneId` ) AS `s1` ON `e`.`Id` = `s1`.`EntityThreeId` -ORDER BY `e`.`Id`, `s1`.`Id`, `s1`.`Id0` +ORDER BY `e`.`Id`, `s1`.`Id` """); } @@ -191,7 +191,7 @@ public override async Task Include_collection_on_split_entity(bool async) INNER JOIN `SplitEntityOnePart3` AS `s` ON `e`.`Id` = `s`.`Id`) INNER JOIN `SplitEntityOnePart2` AS `s0` ON `e`.`Id` = `s0`.`Id`) LEFT JOIN `EntityTwo` AS `e0` ON `e`.`Id` = `e0`.`EntityOneId` -ORDER BY `e`.`Id`, `e0`.`Id` +ORDER BY `e`.`Id` """); } @@ -709,7 +709,7 @@ LEFT JOIN ( INNER JOIN `OwnedReferencePart4` AS `o0` ON `o`.`BaseEntityId` = `o0`.`BaseEntityId` AND `o`.`Id` = `o0`.`Id`) INNER JOIN `OwnedReferencePart3` AS `o1` ON `o`.`BaseEntityId` = `o1`.`BaseEntityId` AND `o`.`Id` = `o1`.`Id` ) AS `s0` ON `u`.`Id` = `s0`.`BaseEntityId` -ORDER BY `u`.`Id`, `s0`.`BaseEntityId` +ORDER BY `u`.`Id`, `s0`.`BaseEntityId`, `s0`.`Id` """); } @@ -755,7 +755,7 @@ LEFT JOIN ( INNER JOIN `OwnedReferencePart4` AS `o0` ON `o`.`MiddleEntityId` = `o0`.`MiddleEntityId` AND `o`.`Id` = `o0`.`Id`) INNER JOIN `OwnedReferencePart3` AS `o1` ON `o`.`MiddleEntityId` = `o1`.`MiddleEntityId` AND `o`.`Id` = `o1`.`Id` ) AS `s0` ON `u`.`Id` = `s0`.`MiddleEntityId` -ORDER BY `u`.`Id`, `s0`.`MiddleEntityId` +ORDER BY `u`.`Id`, `s0`.`MiddleEntityId`, `s0`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/FromSqlQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/FromSqlQueryLibRedTest.cs index b5858bf7..fbcdb66e 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/FromSqlQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/FromSqlQueryLibRedTest.cs @@ -537,7 +537,7 @@ public override async Task FromSqlRaw_queryable_simple_include(bool async) SELECT * FROM `Customers` ) AS `m` LEFT JOIN `Orders` AS `o` ON `m`.`CustomerID` = `o`.`CustomerID` -ORDER BY `m`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID` """); } @@ -553,7 +553,7 @@ public override async Task FromSqlRaw_queryable_simple_composed_include(bool asy ) AS `m` LEFT JOIN `Orders` AS `o` ON `m`.`CustomerID` = `o`.`CustomerID` WHERE `m`.`City` = 'London' -ORDER BY `m`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID` """); } @@ -662,7 +662,7 @@ public override async Task FromSqlRaw_with_SelectMany_and_include(bool async) SELECT * FROM `Customers` WHERE `CustomerID` = 'AROUT' ) AS `m0` LEFT JOIN `Orders` AS `o` ON `m0`.`CustomerID` = `o`.`CustomerID`) -ORDER BY `m`.`CustomerID`, `m0`.`CustomerID`, `o`.`OrderID` +ORDER BY `m`.`CustomerID`, `m0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs index 986ceec7..25ba8bc9 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/GearsOfWarQueryLibRedTest.cs @@ -51,7 +51,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool isAs FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -78,7 +78,7 @@ public override async Task Include_multiple_circular(bool isAsync) FROM (`Gears` AS `g` INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -93,7 +93,7 @@ public override async Task Include_multiple_circular_with_filter(bool isAsync) INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -107,7 +107,7 @@ public override async Task Include_using_alternate_key(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -121,7 +121,7 @@ public override async Task Include_navigation_on_derived_type(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -135,7 +135,7 @@ public override async Task String_based_Include_navigation_on_derived_type(bool FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -189,7 +189,7 @@ public override async Task Include_with_join_collection1(bool isAsync) FROM (`Gears` AS `g` INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -203,7 +203,7 @@ public override async Task Include_with_join_collection2(bool isAsync) FROM (`Tags` AS `t` INNER JOIN `Gears` AS `g` ON `t`.`GearSquadId` = `g`.`SquadId` AND `t`.`GearNickName` = `g`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -306,7 +306,7 @@ public override async Task Include_with_join_multi_level(bool isAsync) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Gears` AS `g0` ON `c`.`Name` = `g0`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `g0`.`Nickname` """); } @@ -342,7 +342,7 @@ INNER JOIN ( WHERE `g`.`Discriminator` = 'Officer' ) AS `g0` ON `t`.`GearSquadId` = `g0`.`SquadId` AND `t`.`GearNickName` = `g0`.`Nickname`) LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` -ORDER BY NOT (`g0`.`HasSoulPatch`), `g0`.`Nickname` DESC, `t`.`Id`, `g0`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY NOT (`g0`.`HasSoulPatch`), `g0`.`Nickname` DESC, `t`.`Id`, `g0`.`SquadId`, `g1`.`Nickname` """); } @@ -357,7 +357,7 @@ public override async Task Include_with_join_and_inheritance2(bool isAsync) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -375,7 +375,7 @@ INNER JOIN ( WHERE `g`.`Discriminator` = 'Officer' ) AS `g0` ON `t`.`GearSquadId` = `g0`.`SquadId` AND `t`.`GearNickName` = `g0`.`Nickname`) LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` -ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g1`.`Nickname` """); } @@ -702,7 +702,7 @@ public override async Task Select_null_propagation_negative3(bool isAsync) SELECT `g0`.`Nickname`, IIF(`g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `g0`.`LeaderNickname` IS NOT NULL, NULL) AS `Condition` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`HasSoulPatch` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g0`.`Nickname` """); } @@ -715,7 +715,7 @@ public override async Task Select_null_propagation_negative4(bool isAsync) SELECT `g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `g0`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`HasSoulPatch` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g0`.`Nickname` """); } @@ -728,7 +728,7 @@ public override async Task Select_null_propagation_negative5(bool isAsync) SELECT `g0`.`Nickname` IS NOT NULL AND `g0`.`SquadId` IS NOT NULL, `g0`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`HasSoulPatch` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g0`.`Nickname` """); } @@ -814,7 +814,7 @@ public override async Task Select_conditional_with_anonymous_type_and_null_const """ SELECT `g`.`LeaderNickname` IS NOT NULL, `g`.`HasSoulPatch` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -826,7 +826,7 @@ public override async Task Select_conditional_with_anonymous_types(bool isAsync) """ SELECT `g`.`LeaderNickname` IS NOT NULL, `g`.`Nickname`, `g`.`FullName` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -839,7 +839,7 @@ public override async Task Where_conditional_equality_1(bool async) SELECT `g`.`Nickname` FROM `Gears` AS `g` WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -852,7 +852,7 @@ public override async Task Where_conditional_equality_2(bool async) SELECT `g`.`Nickname` FROM `Gears` AS `g` WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -864,7 +864,7 @@ public override async Task Where_conditional_equality_3(bool async) """ SELECT `g`.`Nickname` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -876,7 +876,7 @@ public override async Task Select_coalesce_with_anonymous_types(bool isAsync) """ SELECT `g`.`LeaderNickname`, `g`.`FullName` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1173,7 +1173,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1198,7 +1198,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`)) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1217,7 +1217,7 @@ SELECT TOP 1 `w`.`IsAutomatic` SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1236,7 +1236,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1256,7 +1256,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC)) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1276,7 +1276,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1788,7 +1788,7 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -1802,7 +1802,7 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -1817,7 +1817,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -1834,7 +1834,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Weapons` AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `g0`.`FullName` = `w1`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } @@ -1853,7 +1853,7 @@ LEFT JOIN ( ) AS `g1` ON `g`.`LeaderNickname` = `g1`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g1`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId`, `w`.`Id` """); } @@ -1868,7 +1868,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -1887,7 +1887,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w3` ON `g0`.`FullName` = `w3`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w4` ON `g`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id`, `w4`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } @@ -2079,7 +2079,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -2105,7 +2105,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `g`.`SquadId`, `t`.`Id` +ORDER BY `g`.`SquadId` """); } @@ -2181,7 +2181,7 @@ LEFT JOIN ( WHERE `w`.`Name` <> 'Lancer' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `c`.`Name` IN ('Ephyra', 'Hanover') -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -2199,7 +2199,7 @@ LEFT JOIN ( WHERE `g0`.`Nickname` <> 'Dom' ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -2421,7 +2421,7 @@ public override async Task Unnecessary_include_doesnt_get_added_complex_when_pro SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`Rank`, `g`.`SquadId` +ORDER BY `g`.`Rank` """); } @@ -2434,7 +2434,7 @@ public override async Task Multiple_order_bys_are_properly_lifted_from_subquery_ SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2447,7 +2447,7 @@ public override async Task Order_by_is_properly_lifted_from_subquery_with_same_o SELECT `g`.`FullName` FROM `Gears` AS `g` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2461,7 +2461,7 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE `g`.`FullName` <> 'Augustus Cole' AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2475,7 +2475,7 @@ public override async Task Subquery_is_lifted_from_main_from_clause_of_SelectMan FROM `Gears` AS `g`, `Gears` AS `g0` WHERE `g`.`HasSoulPatch` AND NOT (`g0`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g0`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2488,7 +2488,7 @@ public override async Task Subquery_containing_SelectMany_projecting_main_from_c FROM `Gears` AS `g`, `Tags` AS `t` WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`FullName`, `t`.`Id` +ORDER BY `g`.`FullName` """); } @@ -2500,7 +2500,7 @@ public override async Task Subquery_containing_join_projecting_main_from_clause_ SELECT `g`.`Nickname` FROM `Gears` AS `g` INNER JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` -ORDER BY `g`.`Nickname`, `t`.`Id` +ORDER BY `g`.`Nickname` """); } @@ -2512,7 +2512,7 @@ public override async Task Subquery_containing_left_join_projecting_main_from_cl SELECT `g`.`Nickname` FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` -ORDER BY `g`.`Nickname`, `t`.`Id` +ORDER BY `g`.`Nickname` """); } @@ -2543,7 +2543,7 @@ WHERE EXISTS ( SELECT 1 FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName`) AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -2557,7 +2557,7 @@ public override async Task Subquery_is_lifted_from_additional_from_clause(bool i FROM `Gears` AS `g`, `Gears` AS `g0` WHERE `g`.`HasSoulPatch` AND NOT (`g0`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g0`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2680,7 +2680,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool isAsy """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2692,7 +2692,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca """ SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2704,7 +2704,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2716,7 +2716,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool isA """ SELECT `f`.`Name`, `f`.`Eradicated` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2799,7 +2799,7 @@ SELECT COUNT(*) FROM `LocustLeaders` AS `l` WHERE `f`.`Id` = `l`.`LocustHordeId`) AS `LeadersCount` FROM `Factions` AS `f` -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -2830,7 +2830,7 @@ LEFT JOIN ( WHERE `l`.`Discriminator` = 'LocustCommander' ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name`) LEFT JOIN `LocustLeaders` AS `l1` ON `f`.`Id` = `l1`.`LocustHordeId` -ORDER BY `f`.`Name`, `f`.`Id`, `l1`.`Name` +ORDER BY `f`.`Name`, `f`.`Id` """); } @@ -2966,7 +2966,7 @@ public override async Task Comparing_two_collection_navigations_composite_key(bo FROM `Gears` AS `g`, `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`Nickname` AND `g`.`SquadId` = `g0`.`SquadId` -ORDER BY `g`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3163,7 +3163,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` INNER JOIN `Cities` AS `c` ON `g0`.`CityOfBirthName` = `c`.`Name` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `l`.`Name`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `l`.`Name`, `s`.`Nickname` """); } @@ -3212,7 +3212,7 @@ public override async Task Include_collection_on_derived_type_using_string(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3225,7 +3225,7 @@ public override async Task Include_collection_on_derived_type_using_lambda(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3238,7 +3238,7 @@ public override async Task Include_collection_on_derived_type_using_lambda_with_ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -3252,7 +3252,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool isAsyn FROM (`Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3266,7 +3266,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -3285,7 +3285,7 @@ LEFT JOIN ( ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name`) LEFT JOIN `Gears` AS `g` ON `l0`.`DefeatedByNickname` = `g`.`Nickname` AND `l0`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `f`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `f`.`Id`, `g0`.`Nickname` """); } @@ -3302,7 +3302,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Gears` AS `g1` ON `g0`.`Nickname` = `g1`.`LeaderNickname` AND `g0`.`SquadId` = `g1`.`LeaderSquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -3319,7 +3319,7 @@ LEFT JOIN ( FROM `LocustLeaders` AS `l` LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId` ) AS `s` ON `f`.`Id` = `s`.`LocustHordeId` -ORDER BY `f`.`Id`, `s`.`Name` +ORDER BY `f`.`Id` """); } @@ -3338,7 +3338,7 @@ LEFT JOIN ( ) AS `l0` ON `f`.`CommanderName` = `l0`.`Name`) LEFT JOIN `Gears` AS `g` ON `l0`.`DefeatedByNickname` = `g`.`Nickname` AND `l0`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `f`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `f`.`Id`, `g0`.`Nickname` """); } @@ -3472,7 +3472,7 @@ public override async Task Correlated_collections_naked_navigation_with_ToList(b FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3488,7 +3488,7 @@ SELECT COUNT(*) WHERE `g`.`FullName` = `w`.`OwnerFullName`) FROM `Gears` AS `g` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3502,7 +3502,7 @@ public override async Task Correlated_collections_naked_navigation_with_ToArray( FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3520,7 +3520,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3538,7 +3538,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3556,7 +3556,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3574,7 +3574,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` DESC, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Name` DESC """); } @@ -3592,7 +3592,7 @@ LEFT JOIN ( WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' AND `g`.`Nickname` <> 'Foo' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g1`.`Nickname` """); } @@ -3610,7 +3610,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3628,7 +3628,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3646,7 +3646,7 @@ LEFT JOIN ( WHERE `w`.`IsAutomatic` OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3679,7 +3679,7 @@ public override async Task Correlated_collections_project_anonymous_collection_r FROM `Squads` AS `s` LEFT JOIN `Gears` AS `g` ON `s`.`Id` = `g`.`SquadId` WHERE `s`.`Id` < 20 -ORDER BY `s`.`Id`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `s`.`Id`, `g`.`Nickname` """); } @@ -3702,7 +3702,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3725,7 +3725,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3748,7 +3748,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -3771,7 +3771,7 @@ LEFT JOIN ( WHERE `g0`.`FullName` <> 'Foo' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `g`.`Nickname`, `g`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `g`.`Nickname`, `g`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`) """); } @@ -3793,7 +3793,7 @@ LEFT JOIN ( FROM `Weapons` AS `w0` WHERE `w0`.`IsAutomatic` ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w1`.`Id` """); } @@ -3815,7 +3815,7 @@ LEFT JOIN ( FROM `Weapons` AS `w0` WHERE NOT (`w0`.`IsAutomatic`) ) AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`), `w2`.`Id` +ORDER BY `g`.`Rank`, `g`.`Nickname`, `g`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`) """); } @@ -3834,7 +3834,7 @@ LEFT JOIN ( ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `g0`.`FullName`, `g0`.`Nickname` """); } @@ -3851,7 +3851,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`SquadId` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note` """); } @@ -3874,7 +3874,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC """); } @@ -3898,7 +3898,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC """); } @@ -3962,7 +3962,7 @@ LEFT JOIN ( SELECT 1 FROM `Gears` AS `g0` WHERE `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId`) -ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Id0`, `s1`.`Nickname0`, `s1`.`SquadId0`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC, `s2`.`Id` +ORDER BY NOT (`g`.`HasSoulPatch`) DESC, `t`.`Note`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Id0`, `s1`.`Nickname0`, `s1`.`SquadId0`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC """); } @@ -4068,7 +4068,7 @@ LEFT JOIN ( WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `s`.`Id` = `g1`.`SquadId`) WHERE `g`.`HasSoulPatch` -ORDER BY `g`.`Nickname`, `s`.`Id` DESC, `g`.`SquadId`, `w0`.`Id`, `g1`.`Nickname`, `g1`.`SquadId` +ORDER BY `g`.`Nickname`, `s`.`Id` DESC, `g`.`SquadId`, `w0`.`Id`, `g1`.`Nickname` """); } @@ -4163,7 +4163,7 @@ SELECT TOP 1 `g`.`FullName` WHERE `s`.`Id` = `g`.`SquadId` ORDER BY `g`.`Nickname`) FROM `Squads` AS `s` -ORDER BY `s`.`Name`, `s`.`Id` +ORDER BY `s`.`Name` """); } @@ -4178,7 +4178,7 @@ public override async Task Correlated_collections_on_left_join_with_predicate(bo LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -4193,7 +4193,7 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo RIGHT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -4207,7 +4207,7 @@ public override async Task Correlated_collections_on_left_join_with_null_value(b FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Note`, `t`.`Id`, `g`.`Nickname`, `g`.`SquadId` """); } @@ -4249,7 +4249,7 @@ LEFT JOIN ( ) AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName` WHERE `g0`.`HasSoulPatch` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `t`.`Note`, `g`.`Nickname` DESC, `t`.`Id`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `t`.`Note`, `g`.`Nickname` DESC, `t`.`Id`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -4291,7 +4291,7 @@ LEFT JOIN ( LEFT JOIN `Squads` AS `s` ON `g0`.`SquadId` = `s`.`Id`) LEFT JOIN `Gears` AS `g1` ON `s`.`Id` = `g1`.`SquadId` ) AS `s0` ON `g`.`FullName` = `s0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname` """); } @@ -4315,7 +4315,7 @@ LEFT JOIN ( ) AS `s0` ON `g0`.`FullName` = `s0`.`OwnerFullName` ) AS `s1` ON `g`.`Nickname` = `s1`.`LeaderNickname` AND `g`.`SquadId` = `s1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`Id`, `s1`.`Nickname0` """); } @@ -4334,7 +4334,7 @@ LEFT JOIN ( LEFT JOIN `Squads` AS `s` ON `g0`.`SquadId` = `s`.`Id`) LEFT JOIN `Gears` AS `g1` ON `s`.`Id` = `g1`.`SquadId` ) AS `s0` ON `g`.`FullName` = `s0`.`OwnerFullName` -ORDER BY `g`.`FullName`, `g`.`Nickname` DESC, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname` DESC, `g`.`SquadId`, `s0`.`Id`, `s0`.`Nickname` """); } @@ -4358,7 +4358,7 @@ LEFT JOIN ( ) AS `s0` ON `g0`.`FullName` = `s0`.`OwnerFullName` ) AS `s1` ON `g`.`Nickname` = `s1`.`LeaderNickname` AND `g`.`SquadId` = `s1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY NOT (`g`.`HasSoulPatch`), `g`.`LeaderNickname`, `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0` +ORDER BY NOT (`g`.`HasSoulPatch`), `g`.`LeaderNickname`, `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0` """); } @@ -4375,7 +4375,7 @@ public override async Task Correlated_collection_with_top_level_FirstOrDefault(b ORDER BY `g`.`Nickname` ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -4403,7 +4403,7 @@ public override async Task Correlated_collection_with_top_level_Last_with_orderb ORDER BY `g`.`FullName` ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g0`.`FullName`, `g0`.`Nickname`, `g0`.`SquadId` """); } @@ -4420,7 +4420,7 @@ public override async Task Correlated_collection_with_top_level_Last_with_order_ ORDER BY `g`.`FullName` DESC ) AS `g0` LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g0`.`FullName` DESC, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Name`, `w`.`Id` +ORDER BY `g0`.`FullName` DESC, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Name` """); } @@ -4475,7 +4475,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool ORDER BY `t`.`Note` ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Note`, `s`.`Name`, `w`.`Id` +ORDER BY `s`.`Note`, `s`.`Name` """); } @@ -4602,7 +4602,7 @@ public override async Task Order_by_entity_qsre(bool isAsync) SELECT `g`.`FullName` FROM `Gears` AS `g` LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name` -ORDER BY `c`.`Name`, `g`.`Nickname` DESC, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` DESC """); } @@ -4643,7 +4643,7 @@ public override async Task Order_by_entity_qsre_with_other_orderbys(bool isAsync FROM (`Weapons` AS `w` LEFT JOIN `Gears` AS `g` ON `w`.`OwnerFullName` = `g`.`FullName`) LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w`.`IsAutomatic`), `g`.`Nickname` DESC, `g`.`SquadId` DESC, `w0`.`Id`, `w`.`Name`, `w`.`Id` +ORDER BY NOT (`w`.`IsAutomatic`), `g`.`Nickname` DESC, `g`.`SquadId` DESC, `w0`.`Id`, `w`.`Name` """); } @@ -4954,7 +4954,7 @@ public override async Task Include_with_order_by_constant(bool isAsync) SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Squads` AS `s` LEFT JOIN `Gears` AS `g` ON `s`.`Id` = `g`.`SquadId` -ORDER BY `s`.`Id`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `s`.`Id`, `g`.`Nickname` """); } @@ -4967,7 +4967,7 @@ public override async Task Correlated_collection_order_by_constant(bool isAsync) SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5027,7 +5027,7 @@ SELECT COUNT(*) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5048,7 +5048,7 @@ SELECT TOP 1 `w`.`IsAutomatic` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5073,7 +5073,7 @@ SELECT TOP 1 `w`.`IsAutomatic` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5097,7 +5097,7 @@ WHERE NOT (`g0`.`HasSoulPatch`) ) AS `g1` ON `g`.`Nickname` = `g1`.`LeaderNickname` AND `g`.`SquadId` = `g1`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5127,7 +5127,7 @@ WHERE NOT (`g1`.`HasSoulPatch`) ) AS `g2` ON `g`.`Nickname` = `g2`.`LeaderNickname` AND `g`.`SquadId` = `g2`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } @@ -5416,7 +5416,7 @@ public override async Task Cast_subquery_to_base_type_using_typed_ToList(bool is FROM `Cities` AS `c` LEFT JOIN `Gears` AS `g` ON `c`.`Name` = `g`.`AssignedCityName` WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `g`.`Nickname`, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` """); } @@ -5430,7 +5430,7 @@ public override async Task Cast_ordered_subquery_to_base_type_using_typed_ToArra FROM `Cities` AS `c` LEFT JOIN `Gears` AS `g` ON `c`.`Name` = `g`.`AssignedCityName` WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `g`.`Nickname` DESC, `g`.`SquadId` +ORDER BY `c`.`Name`, `g`.`Nickname` DESC """); } @@ -5443,7 +5443,7 @@ public override async Task Correlated_collection_with_complex_order_by_funcletiz SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Name`, `w`.`Id` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5456,7 +5456,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -5469,7 +5469,7 @@ public override async Task Double_order_by_on_Like(bool isAsync) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -5482,7 +5482,7 @@ public override async Task Double_order_by_on_is_null(bool isAsync) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -5504,12 +5504,12 @@ public override async Task Double_order_by_binary_expression(bool isAsync) AssertSql( """ -SELECT `w0`.`Binary`, `w0`.`Id` +SELECT `w0`.`Binary` FROM ( - SELECT `w`.`Id` + 2 AS `Binary`, `w`.`Id` + SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` ) AS `w0` -ORDER BY `w0`.`Binary`, `w0`.`Id` +ORDER BY `w0`.`Binary` """); } @@ -5522,7 +5522,7 @@ public override async Task String_compare_with_null_conditional_argument(bool is SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -5535,7 +5535,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool i SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -5548,7 +5548,7 @@ public override async Task String_concat_with_null_conditional_argument(bool isA SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & ''), `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } @@ -5561,7 +5561,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool is SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer', `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } @@ -5701,7 +5701,7 @@ public override async Task Include_collection_with_Cast_to_base(bool isAsync) FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5726,7 +5726,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -5744,7 +5744,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -5756,7 +5756,7 @@ public override async Task OrderBy_same_expression_containing_IsNull_correctly_d """ SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, LEN(`g`.`Nickname`) = 5, NULL) FROM `Gears` AS `g` -ORDER BY NOT (IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)), `g`.`SquadId` +ORDER BY NOT (IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)) """); } @@ -6037,7 +6037,7 @@ SELECT TOP 1 `w`.`Name` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -6161,7 +6161,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `t`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `t`.`Id`, `g0`.`Nickname` """); } @@ -6492,7 +6492,7 @@ LEFT JOIN ( FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` ) AS `s` ON `g`.`FullName` = `s`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6506,7 +6506,7 @@ public override async Task Reference_include_chain_loads_correctly_when_middle_i FROM (`Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId`) LEFT JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id` -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -6524,7 +6524,7 @@ LEFT JOIN ( FROM `Weapons` AS `w` LEFT JOIN `Gears` AS `g0` ON `w`.`OwnerFullName` = `g0`.`FullName` ) AS `s` ON `g`.`FullName` = `s`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `s`.`Id` +ORDER BY `t`.`Note`, `t`.`Id` """); } @@ -6557,7 +6557,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para FROM `Gears` AS `g` WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `g0` -ORDER BY `g0`.`FullName`, `g0`.`SquadId` +ORDER BY `g0`.`FullName` """); } @@ -6627,7 +6627,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -6810,7 +6810,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -6822,7 +6822,6 @@ public override async Task OrderBy_Contains_empty_list(bool async) """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -ORDER BY `g`.`SquadId` """); } @@ -6903,7 +6902,7 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n """ @ranks='134' -SELECT (`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`g`.`Rank` BOR `g`.`Rank`) BOR @ranks) BOR `g`.`Rank`) BOR @ranks) = @ranks FROM `Gears` AS `g` """); } @@ -7122,7 +7121,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -7418,7 +7417,7 @@ public override async Task Constant_enum_with_same_underlying_value_as_previousl SELECT TOP @p `g`.`Rank` BAND 1 FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -7570,7 +7569,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` < `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7583,7 +7582,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` <= `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7596,7 +7595,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ SELECT `g`.`Nickname`, `g`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` AND `g`.`SquadId` >= `w`.`Id` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -7940,7 +7939,7 @@ SELECT IIF(`t`.`GearNickName` IS NOT NULL, LEN(`g`.`Nickname`), NULL), IIF(`t`.` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7954,7 +7953,7 @@ SELECT IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL) AS `Id` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7968,7 +7967,7 @@ SELECT IIF(`t`.`GearNickName` IS NOT NULL, LEN(`g`.`Nickname`), NULL), IIF(`t`.` FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7982,7 +7981,7 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL AND NOT (IIF(`t`.`GearNickName` IS NOT NULL, `g`.`HasSoulPatch`, NULL)) -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7996,7 +7995,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE DATEPART('m', `t`.`IssueDate`) <> 5 -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -8010,7 +8009,7 @@ public override async Task Projecting_property_converted_to_nullable_and_use_it_ FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), `t`.`Note`, `t`.`Id` +ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), `t`.`Note` """); } @@ -8043,7 +8042,7 @@ LEFT JOIN ( SELECT DISTINCT `w`.`Id`, `w`.`Name`, `w`.`OwnerFullName` FROM `Weapons` AS `w` ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -8059,7 +8058,7 @@ LEFT JOIN ( SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` ) AS `g0` ON `s`.`Id` = `g0`.`SquadId` -ORDER BY `s`.`Id`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `s`.`Id`, `g0`.`Nickname` """); } @@ -8321,7 +8320,7 @@ ORDER BY `g`.`Nickname` ORDER BY `s`.`Nickname` DESC ) AS `s0` LEFT JOIN `Weapons` AS `w` ON `s0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s0`.`Nickname`, `s0`.`SquadId`, NOT (`s0`.`HasSoulPatch0`), `w`.`Id` +ORDER BY `s0`.`Nickname`, `s0`.`SquadId`, NOT (`s0`.`HasSoulPatch0`) """); } @@ -8379,7 +8378,7 @@ public override async Task Enum_matching_take_value_gets_different_type_mapping( SELECT TOP @p `g`.`Rank` BAND @value FROM `Gears` AS `g` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -8487,7 +8486,7 @@ public override async Task Cast_to_derived_followed_by_multiple_includes(bool as LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `l`.`Name` LIKE '%Queen%' -ORDER BY `l`.`Name`, `w`.`Id` +ORDER BY `l`.`Name` """); } @@ -8893,7 +8892,7 @@ public override async Task Include_collection_on_derived_type_using_EF_Property( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -8907,7 +8906,7 @@ public override async Task EF_Property_based_Include_navigation_on_derived_type( FROM `Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`Nickname` = `g0`.`LeaderNickname` AND `g`.`SquadId` = `g0`.`LeaderSquadId` WHERE `g`.`Discriminator` = 'Officer' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname` """); } @@ -8929,7 +8928,7 @@ ORDER BY `g`.`FullName` ) AS `g0` ORDER BY `g0`.`FullName` DESC ) AS `g1` -ORDER BY `g1`.`FullName`, `g1`.`SquadId` +ORDER BY `g1`.`FullName` """); } @@ -8951,7 +8950,7 @@ ORDER BY `g`.`FullName` ) AS `g0` ORDER BY `g0`.`FullName` DESC ) AS `g1` -ORDER BY `g1`.`FullName`, `g1`.`SquadId` +ORDER BY `g1`.`FullName` """); } @@ -8973,7 +8972,7 @@ ORDER BY `g`.`FullName` ) AS `g0` ORDER BY `g0`.`FullName` DESC ) AS `g1` -ORDER BY `g1`.`FullName`, `g1`.`SquadId` +ORDER BY `g1`.`FullName` """); } @@ -9146,7 +9145,7 @@ public override async Task Include_one_to_many_on_composite_key_then_orderby_key SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Gears` AS `g` LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`SquadId`, `g`.`Nickname`, `w`.`Id` +ORDER BY `g`.`SquadId`, `g`.`Nickname` """); } @@ -9176,7 +9175,7 @@ public override async Task Join_include_coalesce_simple(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9184,7 +9183,7 @@ public override async Task Join_include_coalesce_simple(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9193,7 +9192,7 @@ public override async Task Join_include_coalesce_simple(bool async) LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` """); } @@ -9207,7 +9206,7 @@ public override async Task Join_include_coalesce_nested(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """, // """ @@ -9217,7 +9216,7 @@ public override async Task Join_include_coalesce_nested(bool async) LEFT JOIN `Weapons` AS `w` ON `g0`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g0`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `g0`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id`, `w0`.`Id` """); } @@ -9231,7 +9230,7 @@ public override async Task Join_include_conditional(bool async) FROM (`Gears` AS `g` LEFT JOIN `Gears` AS `g0` ON `g`.`LeaderNickname` = `g0`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `g0`.`Nickname`, `g0`.`SquadId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedFixture.cs similarity index 56% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedFixture.cs index 59e7e0f6..3ddb3919 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedFixture.cs @@ -1,9 +1,6 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore.Query; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCFiltersInheritanceQueryLibRedFixture : TPCInheritanceQueryLibRedFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedTest.cs index 2b6d1732..a87e5767 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCFiltersInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCFiltersInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCFiltersInheritanceQueryLibRedTest : TPCFiltersInheritanceQueryTestBase { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCGearsOfWarQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedFixture.cs similarity index 95% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCGearsOfWarQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedFixture.cs index 69f5bcb7..4eb1aaee 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCGearsOfWarQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCGearsOfWarQueryLibRedFixture : TPCGearsOfWarQueryRelationalFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCGearsOfWarQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCGearsOfWarQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedTest.cs index fdf4ad5e..acd02eeb 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCGearsOfWarQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel; @@ -13,7 +10,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCGearsOfWarQueryLibRedTest : TPCGearsOfWarQueryRelationalTestBase { @@ -3115,7 +3112,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` -ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname` +ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } @@ -3769,7 +3766,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool async """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3781,7 +3778,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca """ SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3793,7 +3790,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3805,7 +3802,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool asy """ SELECT `l`.`Name`, `l`.`Eradicated` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3818,7 +3815,7 @@ public override async Task Navigation_access_on_derived_entity_using_cast(bool a SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3831,7 +3828,7 @@ public override async Task Navigation_access_on_derived_materialized_entity_usin SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3844,7 +3841,7 @@ public override async Task Navigation_access_via_EFProperty_on_derived_entity_us SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -3857,7 +3854,7 @@ public override async Task Navigation_access_fk_on_derived_entity_using_cast(boo SELECT `l`.`Name`, `l0`.`Name` AS `CommanderName` FROM `LocustHordes` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name`, `l`.`Id` +ORDER BY `l`.`Name` """); } @@ -4532,7 +4529,7 @@ UNION ALL FROM `Officers` AS `o` ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` ) AS `s` ON `l`.`Id` = `s`.`LocustHordeId` -ORDER BY `l`.`Id`, `s`.`Name` +ORDER BY `l`.`Id` """); } @@ -4589,7 +4586,7 @@ UNION ALL INNER JOIN `Squads` AS `s` ON `u0`.`SquadId` = `s`.`Id`) LEFT JOIN `SquadMissions` AS `s0` ON `s`.`Id` = `s0`.`SquadId` ) AS `s1` ON `u`.`Nickname` = `s1`.`LeaderNickname` AND `u`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`SquadId0` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`SquadId0`, `s1`.`MissionId` """); } @@ -4941,7 +4938,7 @@ LEFT JOIN ( WHERE `s0`.`MissionId` <> 17 ) AS `s1` ON `s`.`Id` = `s1`.`SquadId` WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`SquadId` +ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`SquadId`, `s1`.`MissionId` """); } @@ -4984,7 +4981,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -5007,7 +5004,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -5030,7 +5027,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -6115,7 +6112,7 @@ UNION ALL ORDER BY `t`.`Note` ) AS `s` LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s`.`Note`, `s`.`Name`, `w`.`Id` +ORDER BY `s`.`Note`, `s`.`Name` """); } @@ -7469,7 +7466,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -7482,7 +7479,7 @@ public override async Task Double_order_by_on_Like(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -7495,7 +7492,7 @@ public override async Task Double_order_by_on_is_null(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -7517,12 +7514,12 @@ public override async Task Double_order_by_binary_expression(bool async) AssertSql( """ -SELECT `w0`.`Binary`, `w0`.`Id` +SELECT `w0`.`Binary` FROM ( - SELECT `w`.`Id` + 2 AS `Binary`, `w`.`Id` + SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` ) AS `w0` -ORDER BY `w0`.`Binary`, `w0`.`Id` +ORDER BY `w0`.`Binary` """); } @@ -7535,7 +7532,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -7548,7 +7545,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -7561,7 +7558,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & ''), `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } @@ -7574,7 +7571,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer', `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } @@ -7870,7 +7867,7 @@ UNION ALL LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -8424,7 +8421,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` AND `t`.`Note` IS NOT NULL -ORDER BY `t`.`Id`, `u`.`Nickname` +ORDER BY `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } @@ -8812,7 +8809,7 @@ UNION ALL ) AS `u` WHERE `u`.`Nickname` <> @prm_Inner_Nickname ) AS `u0` -ORDER BY `u0`.`FullName`, `u0`.`SquadId` +ORDER BY `u0`.`FullName` """); } @@ -8906,7 +8903,7 @@ UNION ALL ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -9326,7 +9323,7 @@ UNION ALL """ @ranks='134' -SELECT (`u`.`Rank` BOR (`u`.`Rank` BOR (@ranks BOR (`u`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`u`.`Rank` BOR `u`.`Rank`) BOR @ranks) BOR `u`.`Rank`) BOR @ranks) = @ranks FROM ( SELECT `g`.`Rank` FROM `Gears` AS `g` @@ -9580,7 +9577,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -12077,7 +12074,7 @@ ORDER BY `u`.`FullName` ) AS `u0` ORDER BY `u0`.`FullName` DESC ) AS `u1` -ORDER BY `u1`.`FullName`, `u1`.`SquadId` +ORDER BY `u1`.`FullName` """); } @@ -12105,7 +12102,7 @@ ORDER BY `u`.`FullName` ) AS `u0` ORDER BY `u0`.`FullName` DESC ) AS `u1` -ORDER BY `u1`.`FullName`, `u1`.`SquadId` +ORDER BY `u1`.`FullName` """); } @@ -12133,7 +12130,7 @@ ORDER BY `u`.`FullName` ) AS `u0` ORDER BY `u0`.`FullName` DESC ) AS `u1` -ORDER BY `u1`.`FullName`, `u1`.`SquadId` +ORDER BY `u1`.`FullName` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs new file mode 100644 index 00000000..4c8c5430 --- /dev/null +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixture.cs @@ -0,0 +1,5 @@ +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; + +public class TPCInheritanceQueryLibRedFixture : TPCInheritanceQueryLibRedFixtureBase +{ +} diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixtureBase.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixtureBase.cs similarity index 72% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixtureBase.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixtureBase.cs index 0dd1cc27..8536e502 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixtureBase.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedFixtureBase.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public abstract class TPCInheritanceQueryLibRedFixtureBase : TPCInheritanceQueryFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTest.cs similarity index 61% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTest.cs index 53b125e1..93130695 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTest.cs @@ -1,12 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - // ReSharper disable InconsistentNaming using Microsoft.EntityFrameworkCore.Query; using Xunit; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCInheritanceQueryLibRedTest(TPCInheritanceQueryLibRedFixture fixture, ITestOutputHelper testOutputHelper) : TPCInheritanceQueryLibRedTestBase(fixture, testOutputHelper); diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedTestBase.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTestBase.cs similarity index 99% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedTestBase.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTestBase.cs index f6cd3793..7f56d52b 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedTestBase.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCInheritanceQueryLibRedTestBase.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -8,7 +5,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public abstract class TPCInheritanceQueryLibRedTestBase(TFixture fixture, ITestOutputHelper testOutputHelper) : TPCInheritanceQueryTestBase(fixture, testOutputHelper) @@ -444,7 +441,7 @@ public override async Task Member_access_on_intermediate_type_works() """ SELECT `k`.`Name` FROM `Kiwi` AS `k` -ORDER BY `k`.`Name`, `k`.`Id` +ORDER BY `k`.`Name` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyNoTrackingQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryLibRedTest.cs index 8c238ac8..18cbdae9 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCManyToManyNoTrackingQueryLibRedTest : TPCManyToManyNoTrackingQueryRelationalTestBase { @@ -411,7 +408,7 @@ LEFT JOIN ( FROM `JoinCompositeKeyToLeaf` AS `j` INNER JOIN `Leaves` AS `l` ON `j`.`LeafId` = `l`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -653,7 +650,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -680,7 +677,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -730,7 +727,7 @@ UNION ALL FROM `Leaf2s` AS `l0` ) AS `u` ON `e0`.`RootSkipSharedId` = `u`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -748,7 +745,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -811,7 +808,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -829,7 +826,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -1005,7 +1002,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `l`.`Id` = `s0`.`LeafId` -ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1081,7 +1078,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1143,7 +1140,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1166,7 +1163,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2282,7 +2279,7 @@ UNION ALL ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` WHERE `u1`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2442,7 +2439,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2468,7 +2465,7 @@ UNION ALL FROM `UnidirectionalLeaves` AS `u4` ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2486,7 +2483,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2567,7 +2564,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2669,7 +2666,7 @@ LEFT JOIN ( ) AS `s` ON `u1`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u1`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u1`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u1`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2689,7 +2686,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2805,6 +2802,94 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u`, +( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + FROM (SELECT COUNT(*) FROM `#Dual`) + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedFixture.cs similarity index 70% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedFixture.cs index 43f19974..32578126 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCManyToManyQueryLibRedFixture : TPCManyToManyQueryRelationalFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedTest.cs index 6cbd3420..c3e324bb 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCManyToManyQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCManyToManyQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCManyToManyQueryLibRedTest : TPCManyToManyQueryRelationalTestBase { @@ -411,7 +408,7 @@ LEFT JOIN ( FROM `JoinCompositeKeyToLeaf` AS `j` INNER JOIN `Leaves` AS `l` ON `j`.`LeafId` = `l`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -653,7 +650,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -680,7 +677,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -730,7 +727,7 @@ UNION ALL FROM `Leaf2s` AS `l0` ) AS `u` ON `e0`.`RootSkipSharedId` = `u`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -748,7 +745,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -811,7 +808,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -829,7 +826,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -1005,7 +1002,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `l`.`Id` = `s0`.`LeafId` -ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `l`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1081,7 +1078,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1143,7 +1140,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1166,7 +1163,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2283,7 +2280,7 @@ UNION ALL ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` WHERE `u1`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2442,7 +2439,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2468,7 +2465,7 @@ UNION ALL FROM `UnidirectionalLeaves` AS `u4` ) AS `u1` ON `u0`.`RootSkipSharedId` = `u1`.`Id` ) AS `s` ON `u`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2`, `s`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s`.`RootSkipSharedId`, `s`.`UnidirectionalEntityCompositeKeyKey1`, `s`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2486,7 +2483,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2589,7 +2586,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2692,7 +2689,7 @@ LEFT JOIN ( ) AS `s` ON `u1`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u1`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u1`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u1`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2712,7 +2709,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2829,6 +2826,94 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u`, +( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + FROM (SELECT COUNT(*) FROM `#Dual`) + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCRelationshipsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.FunctionalTests/Query/TPCRelationshipsQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryLibRedTest.cs index fa68ed07..3cf6b53e 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCRelationshipsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPCRelationshipsQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPCRelationshipsQueryLibRedTest : TPCRelationshipsQueryTestBase @@ -102,7 +99,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -150,7 +147,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `c`.`Name` <> 'Bar' OR `c`.`Name` IS NULL -ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `c`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -239,7 +236,7 @@ public override async Task Include_collection_with_inheritance_on_derived3(bool LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `d`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `DerivedCollectionsOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `d1`.`Id` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -261,7 +258,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d0`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -290,7 +287,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u0`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -350,7 +347,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -373,7 +370,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -444,7 +441,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d0` ON `u`.`Id` = `d0`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -468,7 +465,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -492,7 +489,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `u`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `r`.`Name` <> 'Bar' OR `r`.`Name` IS NULL -ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `r`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d0`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -521,7 +518,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -543,7 +540,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -565,7 +562,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -603,7 +600,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d0`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -626,7 +623,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `d`.`Name` <> 'Bar' OR `d`.`Name` IS NULL -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -649,7 +646,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `d`.`Name` <> 'Bar' OR `d`.`Name` IS NULL -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -689,7 +686,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `d0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d0`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -718,7 +715,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u0`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -748,7 +745,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -778,7 +775,7 @@ UNION ALL LEFT JOIN `OwnedCollections` AS `o0` ON `u0`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u0`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` WHERE `u`.`Name` <> 'Bar' OR `u`.`Name` IS NULL -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -804,7 +801,7 @@ UNION ALL LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o2` ON `d0`.`Id` = `o2`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d3` ON `d0`.`Id` = `d3`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId`, `d3`.`Id` """); } @@ -830,7 +827,7 @@ UNION ALL LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `d`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o2` ON `u`.`Id` = `o2`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d3` ON `u`.`Id` = `d3`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o1`.`BaseInheritanceRelationshipEntityId`, `o1`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id`, `o2`.`BaseInheritanceRelationshipEntityId`, `o2`.`Id`, `d3`.`DerivedInheritanceRelationshipEntityId`, `d3`.`Id` """); } @@ -847,7 +844,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -922,7 +919,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -997,7 +994,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1098,7 +1095,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1134,7 +1131,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } @@ -1163,7 +1160,7 @@ UNION ALL LEFT JOIN `OwnedReferences` AS `o` ON `d`.`Id` = `o`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `OwnedCollections` AS `o0` ON `d`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d1` ON `d`.`Id` = `d1`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `d`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -1199,7 +1196,7 @@ UNION ALL LEFT JOIN `DerivedEntities` AS `d1` ON `u1`.`Id` = `d1`.`Id`) LEFT JOIN `OwnedCollections` AS `o0` ON `u1`.`Id` = `o0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d2` ON `u1`.`Id` = `d2`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId` +ORDER BY `u`.`Id`, `o`.`BaseInheritanceRelationshipEntityId`, `d1`.`Id`, `o0`.`BaseInheritanceRelationshipEntityId`, `o0`.`Id`, `d2`.`DerivedInheritanceRelationshipEntityId`, `d2`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPHInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedFixture.cs similarity index 69% rename from test/EFCore.LibRed.FunctionalTests/Query/TPHInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedFixture.cs index 1b09ddda..1512e973 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPHInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPHInheritanceQueryLibRedFixture : TPHInheritanceQueryFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPHInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.FunctionalTests/Query/TPHInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedTest.cs index 37a58101..f42222c9 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPHInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPHInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; @@ -12,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Query.Inheritance; #nullable disable // ReSharper disable InconsistentNaming -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPHInheritanceQueryLibRedTest(TPHInheritanceQueryLibRedFixture fixture, ITestOutputHelper testOutputHelper) : TPHInheritanceQueryTestBase(fixture, testOutputHelper) @@ -107,7 +104,7 @@ public override async Task Can_use_of_type_animal(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -165,7 +162,7 @@ public override async Task Can_use_of_type_bird(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -178,7 +175,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` WHERE `a`.`CountryId` = 1 -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -240,7 +237,7 @@ public override async Task Can_query_all_animals(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -279,7 +276,7 @@ public override async Task Can_filter_all_animals(bool async) SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` WHERE `a`.`Name` = 'Great spotted kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -291,7 +288,7 @@ public override async Task Can_query_all_birds(bool async) """ SELECT `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Animals` AS `a` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -332,7 +329,7 @@ public override async Task Can_include_prey(bool async) WHERE `a`.`Discriminator` = 'Eagle' ) AS `a1` LEFT JOIN `Animals` AS `a0` ON `a1`.`Id` = `a0`.`EagleId` -ORDER BY `a1`.`Id`, `a0`.`Id` +ORDER BY `a1`.`Id` """); } @@ -345,7 +342,7 @@ public override async Task Can_include_animals(bool async) SELECT `c`.`Id`, `c`.`Name`, `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`Group`, `a`.`FoundOn` FROM `Countries` AS `c` LEFT JOIN `Animals` AS `a` ON `c`.`Id` = `a`.`CountryId` -ORDER BY `c`.`Name`, `c`.`Id`, `a`.`Id` +ORDER BY `c`.`Name`, `c`.`Id` """); } @@ -514,7 +511,7 @@ public override async Task Member_access_on_intermediate_type_works() SELECT `a`.`Name` FROM `Animals` AS `a` WHERE `a`.`Discriminator` = 'Kiwi' -ORDER BY `a`.`Name`, `a`.`Id` +ORDER BY `a`.`Name` """); } @@ -545,7 +542,7 @@ public override async Task Is_operator_on_result_of_FirstOrDefault(bool async) SELECT TOP 1 `a0`.`Discriminator` FROM `Animals` AS `a0` WHERE `a0`.`Name` = 'Great spotted kiwi') = 'Kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs new file mode 100644 index 00000000..b0893767 --- /dev/null +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedFixture.cs @@ -0,0 +1,9 @@ +using Microsoft.EntityFrameworkCore.Query; + +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; + +public class TPTFiltersInheritanceQueryLibRedFixture : TPTInheritanceQueryLibRedFixture +{ + public override bool EnableFilters + => true; +} diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedTest.cs similarity index 96% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedTest.cs index 23fc0e1f..e6f5b914 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTFiltersInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTFiltersInheritanceQueryLibRedTest : TPTFiltersInheritanceQueryTestBase { @@ -38,7 +35,7 @@ public override async Task Can_use_of_type_animal(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -97,7 +94,7 @@ public override async Task Can_use_of_type_bird(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -113,7 +110,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTGearsOfWarQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedFixture.cs similarity index 95% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTGearsOfWarQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedFixture.cs index c4a5aa78..9e3a1921 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTGearsOfWarQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTGearsOfWarQueryLibRedFixture : TPTGearsOfWarQueryRelationalFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTGearsOfWarQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTGearsOfWarQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedTest.cs index 616447a5..45e6bac4 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTGearsOfWarQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; @@ -13,7 +10,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTGearsOfWarQueryLibRedTest : TPTGearsOfWarQueryRelationalTestBase { @@ -68,7 +65,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -104,7 +101,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -124,7 +121,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -139,7 +136,7 @@ public override async Task Include_using_alternate_key(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `g`.`Nickname` = 'Marcus' -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -158,7 +155,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -177,7 +174,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -241,7 +238,7 @@ public override async Task Include_with_join_collection1(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -259,7 +256,7 @@ INNER JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearSquadId` = `s`.`SquadId` AND `t`.`GearNickName` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -370,7 +367,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `c`.`Name` = `s`.`AssignedCityName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `s`.`Nickname` """); } @@ -412,7 +409,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY NOT (`s`.`HasSoulPatch`), `s`.`Nickname` DESC, `t`.`Id`, `s`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY NOT (`s`.`HasSoulPatch`), `s`.`Nickname` DESC, `t`.`Id`, `s`.`SquadId`, `s0`.`Nickname` """); } @@ -428,7 +425,7 @@ public override async Task Include_with_join_and_inheritance2(bool async) INNER JOIN `Tags` AS `t` ON `g`.`SquadId` = `t`.`GearSquadId` AND `g`.`Nickname` = `t`.`GearNickName`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } @@ -451,7 +448,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `t`.`Id`, `s`.`Nickname`, `s`.`SquadId`, `s0`.`Nickname` """); } @@ -1337,7 +1334,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1363,7 +1360,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`)) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1383,7 +1380,7 @@ SELECT TOP 1 `w`.`IsAutomatic` SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1403,7 +1400,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%') ) AS `w0`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1424,7 +1421,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC)) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1445,7 +1442,7 @@ SELECT TOP 1 `w0`.`IsAutomatic` WHERE `g`.`FullName` = `w`.`OwnerFullName` ) AS `w0` ORDER BY `w0`.`Id` DESC) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -1991,7 +1988,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -2011,7 +2008,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -2032,7 +2029,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2055,7 +2052,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w0` ON `s`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `s`.`FullName` = `w1`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } @@ -2077,7 +2074,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2098,7 +2095,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -2122,7 +2119,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w2` ON `g`.`FullName` = `w2`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w3` ON `s`.`FullName` = `w3`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w4` ON `g`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id`, `w4`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } @@ -2496,7 +2493,7 @@ LEFT JOIN ( WHERE `g0`.`Nickname` <> 'Dom' ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -2778,7 +2775,7 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` WHERE `g`.`FullName` <> 'Augustus Cole' AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`FullName`, `g`.`SquadId` +ORDER BY `g`.`FullName` """); } @@ -2868,7 +2865,7 @@ WHERE EXISTS ( SELECT 1 FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName`) AND NOT (`g`.`HasSoulPatch`) -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -3010,7 +3007,7 @@ public override async Task Member_access_on_derived_entity_using_cast(bool async FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3024,7 +3021,7 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3038,7 +3035,7 @@ public override async Task Member_access_on_derived_entity_using_cast_and_let(bo FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3052,7 +3049,7 @@ public override async Task Property_access_on_derived_entity_using_cast(bool asy FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id` +ORDER BY `f`.`Name` """); } @@ -3185,7 +3182,7 @@ LEFT JOIN ( LEFT JOIN `LocustCommanders` AS `l3` ON `l2`.`Name` = `l3`.`Name` ) AS `s0` ON `f`.`Id` = `s0`.`LocustHordeId` WHERE `l`.`Id` IS NOT NULL -ORDER BY `f`.`Name`, `f`.`Id`, `s0`.`Name` +ORDER BY `f`.`Name`, `f`.`Id` """); } @@ -3483,7 +3480,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId`) INNER JOIN `Cities` AS `c` ON `g0`.`CityOfBirthName` = `c`.`Name` ) AS `s0` ON `s`.`Nickname` = `s0`.`LeaderNickname` AND `s`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `l`.`Name`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `l`.`Name`, `s0`.`Nickname` """); } @@ -3552,7 +3549,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3570,7 +3567,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3588,7 +3585,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -3603,7 +3600,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -3621,7 +3618,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Id`, `w`.`Id` +ORDER BY `t`.`Id` """); } @@ -3649,7 +3646,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s1` ON `s0`.`Nickname` = `s1`.`LeaderNickname` AND `s0`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `f`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `f`.`Id`, `s1`.`Nickname` """); } @@ -3672,7 +3669,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o1` ON `g1`.`Nickname` = `o1`.`Nickname` AND `g1`.`SquadId` = `o1`.`SquadId` ) AS `s` ON `g0`.`Nickname` = `s`.`LeaderNickname` AND `g0`.`SquadId` = `s`.`LeaderSquadId` ) AS `s0` ON `g`.`Nickname` = `s0`.`LeaderNickname` AND `g`.`SquadId` = `s0`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -3695,7 +3692,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `l1`.`DefeatedByNickname` = `s`.`Nickname` AND `l1`.`DefeatedBySquadId` = `s`.`SquadId` ) AS `s0` ON `f`.`Id` = `s0`.`LocustHordeId` -ORDER BY `f`.`Id`, `s0`.`Name` +ORDER BY `f`.`Id` """); } @@ -3723,7 +3720,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s1` ON `s0`.`Nickname` = `s1`.`LeaderNickname` AND `s0`.`SquadId` = `s1`.`LeaderSquadId` -ORDER BY `f`.`Id`, `s1`.`Nickname`, `s1`.`SquadId` +ORDER BY `f`.`Id`, `s1`.`Nickname` """); } @@ -4012,7 +4009,7 @@ LEFT JOIN ( WHERE `s0`.`MissionId` <> 17 ) AS `s1` ON `s`.`Id` = `s1`.`SquadId` WHERE `g`.`Nickname` <> 'Marcus' -ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`SquadId` +ORDER BY `g`.`FullName`, `g`.`Nickname`, `g`.`SquadId`, `s1`.`SquadId`, `s1`.`MissionId` """); } @@ -4052,7 +4049,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4075,7 +4072,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 3 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4098,7 +4095,7 @@ LEFT JOIN ( ) AS `s2` ON `m`.`Id` = `s2`.`MissionId` WHERE `s0`.`MissionId` < 42 ) AS `s3` ON `s`.`Id` = `s3`.`SquadId` -ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0`, `s3`.`MissionId0` +ORDER BY `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`SquadId0` """); } @@ -4911,7 +4908,7 @@ LEFT JOIN ( ORDER BY `t`.`Note` ) AS `s0` LEFT JOIN `Weapons` AS `w` ON `s0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `s0`.`Note`, `s0`.`Name`, `w`.`Id` +ORDER BY `s0`.`Note`, `s0`.`Name` """); } @@ -5422,7 +5419,7 @@ LEFT JOIN ( FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` +ORDER BY `s`.`Id`, `s0`.`Nickname` """); } @@ -5500,7 +5497,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5526,7 +5523,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5556,7 +5553,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY NOT (`s0`.`c`), `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5582,7 +5579,7 @@ WHERE NOT (`g0`.`HasSoulPatch`) ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL ) AS `s0` -ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0`, `s0`.`SquadId0` +ORDER BY `s0`.`c`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Nickname0` """); } @@ -5955,7 +5952,7 @@ public override async Task Double_order_by_on_nullable_bool_coming_from_optional SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id`, `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } @@ -5968,7 +5965,7 @@ public override async Task Double_order_by_on_Like(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL) """); } @@ -5981,7 +5978,7 @@ public override async Task Double_order_by_on_is_null(bool async) SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` IS NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` IS NULL) """); } @@ -6003,12 +6000,12 @@ public override async Task Double_order_by_binary_expression(bool async) AssertSql( """ -SELECT `w0`.`Binary`, `w0`.`Id` +SELECT `w0`.`Binary` FROM ( - SELECT `w`.`Id` + 2 AS `Binary`, `w`.`Id` + SELECT `w`.`Id` + 2 AS `Binary` FROM `Weapons` AS `w` ) AS `w0` -ORDER BY `w0`.`Binary`, `w0`.`Id` +ORDER BY `w0`.`Binary` """); } @@ -6021,7 +6018,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT (`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL) """); } @@ -6034,7 +6031,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL), `w`.`Id` +ORDER BY NOT ('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL) """); } @@ -6047,7 +6044,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & ''), `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } @@ -6060,7 +6057,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer', `w`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } @@ -6229,7 +6226,7 @@ public override async Task Include_collection_with_Cast_to_base(bool async) LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6256,7 +6253,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } @@ -6275,7 +6272,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` ) AS `s0` ON `s`.`Id` = `s0`.`SquadId` WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id` +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } @@ -6583,7 +6580,7 @@ SELECT TOP 1 `w`.`Name` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` ) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId` """); } @@ -7090,7 +7087,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) LEFT JOIN `Squads` AS `s0` ON `s`.`SquadId` = `s0`.`Id` -ORDER BY `t`.`Note`, `t`.`Id` +ORDER BY `t`.`Note` """); } @@ -7149,7 +7146,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `s` -ORDER BY `s`.`FullName`, `s`.`SquadId` +ORDER BY `s`.`FullName` """); } @@ -7222,7 +7219,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id -ORDER BY `s1`.`FullName`, `s1`.`SquadId` +ORDER BY `s1`.`FullName` """); } @@ -7412,7 +7409,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId` +ORDER BY `g`.`Nickname` """); } @@ -7425,7 +7422,6 @@ public override async Task OrderBy_Contains_empty_list(bool async) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -ORDER BY `g`.`SquadId` """); } @@ -7511,7 +7507,7 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n """ @ranks='134' -SELECT (`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) = @ranks +SELECT ((((`g`.`Rank` BOR `g`.`Rank`) BOR @ranks) BOR `g`.`Rank`) BOR @ranks) = @ranks FROM `Gears` AS `g` """); } @@ -7703,7 +7699,7 @@ public override async Task OrderBy_bool_coming_from_optional_navigation(bool asy SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM `Weapons` AS `w` LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) """); } @@ -9027,7 +9023,7 @@ LEFT JOIN ( ) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` WHERE `l`.`Name` LIKE '%Queen%' -ORDER BY `l`.`Name`, `w`.`Id` +ORDER BY `l`.`Name` """); } @@ -9648,7 +9644,7 @@ LEFT JOIN ( FROM `Gears` AS `g0` LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -9667,7 +9663,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`Nickname` = `s`.`LeaderNickname` AND `g`.`SquadId` = `s`.`LeaderSquadId` WHERE `o`.`Nickname` IS NOT NULL -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname` """); } @@ -9690,7 +9686,7 @@ ORDER BY `g`.`FullName` ) AS `s` ORDER BY `s`.`FullName` DESC ) AS `s0` -ORDER BY `s0`.`FullName`, `s0`.`SquadId` +ORDER BY `s0`.`FullName` """); } @@ -9713,7 +9709,7 @@ ORDER BY `g`.`FullName` ) AS `s` ORDER BY `s`.`FullName` DESC ) AS `s0` -ORDER BY `s0`.`FullName`, `s0`.`SquadId` +ORDER BY `s0`.`FullName` """); } @@ -9736,7 +9732,7 @@ ORDER BY `g`.`FullName` ) AS `s` ORDER BY `s`.`FullName` DESC ) AS `s0` -ORDER BY `s0`.`FullName`, `s0`.`SquadId` +ORDER BY `s0`.`FullName` """); } @@ -9914,7 +9910,7 @@ public override async Task Include_one_to_many_on_composite_key_then_orderby_key FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`SquadId`, `g`.`Nickname`, `w`.`Id` +ORDER BY `g`.`SquadId`, `g`.`Nickname` """); } @@ -9950,7 +9946,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -9963,7 +9959,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -9977,7 +9973,7 @@ LEFT JOIN ( ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` """); } @@ -9996,7 +9992,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """, // """ @@ -10011,7 +10007,7 @@ LEFT JOIN ( LEFT JOIN `Weapons` AS `w` ON `s`.`FullName` = `w`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w0` ON `s`.`FullName` = `w0`.`OwnerFullName`) LEFT JOIN `Weapons` AS `w1` ON `s`.`FullName` = `w1`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id`, `w0`.`Id` """); } @@ -10030,7 +10026,7 @@ LEFT JOIN ( LEFT JOIN `Officers` AS `o0` ON `g0`.`Nickname` = `o0`.`Nickname` AND `g0`.`SquadId` = `o0`.`SquadId` ) AS `s` ON `g`.`LeaderNickname` = `s`.`Nickname`) LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `w`.`Id` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Nickname`, `s`.`SquadId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedFixture.cs similarity index 77% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTInheritanceQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedFixture.cs index f30ce7cd..2b0a2447 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTInheritanceQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedFixture.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; @@ -8,7 +5,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTInheritanceQueryLibRedFixture : TPTInheritanceQueryFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTInheritanceQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedTest.cs similarity index 98% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTInheritanceQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedTest.cs index a4b6bb9a..a6564474 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTInheritanceQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTInheritanceQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - // ReSharper disable InconsistentNaming using System.Threading.Tasks; @@ -11,7 +8,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTInheritanceQueryLibRedTest(TPTInheritanceQueryLibRedFixture fixture, ITestOutputHelper testOutputHelper) : TPTInheritanceQueryTestBase(fixture, testOutputHelper) @@ -45,7 +42,7 @@ public override async Task Can_filter_all_animals(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`Name` = 'Great spotted kiwi' -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -64,7 +61,7 @@ LEFT JOIN ( LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` ) AS `s` ON `c`.`Id` = `s`.`CountryId` -ORDER BY `c`.`Name`, `c`.`Id`, `s`.`Id` +ORDER BY `c`.`Name`, `c`.`Id` """); } @@ -88,7 +85,7 @@ LEFT JOIN ( LEFT JOIN `Eagle` AS `e0` ON `a0`.`Id` = `e0`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a0`.`Id` = `k`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`EagleId` -ORDER BY `s`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id` """); } @@ -106,7 +103,7 @@ public override async Task Can_query_all_animals(bool async) LEFT JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -121,7 +118,7 @@ public override async Task Can_query_all_birds(bool async) INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -294,7 +291,7 @@ public override async Task Can_use_of_type_animal(bool async) LEFT JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -310,7 +307,7 @@ public override async Task Can_use_of_type_bird(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -342,7 +339,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` WHERE `a`.`CountryId` = 1 AND (`k`.`Id` IS NOT NULL OR `e`.`Id` IS NOT NULL) -ORDER BY `a`.`Species`, `a`.`Id` +ORDER BY `a`.`Species` """); } @@ -426,7 +423,7 @@ public override async Task Member_access_on_intermediate_type_works() FROM (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -ORDER BY `a`.`Name`, `a`.`Id` +ORDER BY `a`.`Name` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyNoTrackingQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryLibRedTest.cs index 76045956..beb6f8aa 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTManyToManyNoTrackingQueryLibRedTest : TPTManyToManyNoTrackingQueryRelationalTestBase< TPTManyToManyQueryLibRedFixture> @@ -391,7 +388,7 @@ INNER JOIN ( INNER JOIN `Leaves` AS `l` ON `r`.`Id` = `l`.`Id` ) AS `s` ON `j`.`LeafId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2` """); } @@ -608,7 +605,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -635,7 +632,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -680,7 +677,7 @@ INNER JOIN ( LEFT JOIN `Leaf2s` AS `l0` ON `r`.`Id` = `l0`.`Id` ) AS `s` ON `e0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -698,7 +695,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -766,7 +763,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -784,7 +781,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -891,7 +888,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s` ON `e0`.`Id` = `s`.`ThreeId` ) AS `s0` ON `r`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -950,7 +947,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `r`.`Id` = `s0`.`LeafId` -ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1026,7 +1023,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1089,7 +1086,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1112,7 +1109,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2219,7 +2216,7 @@ INNER JOIN ( ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` WHERE `s`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2369,7 +2366,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2391,7 +2388,7 @@ INNER JOIN ( LEFT JOIN `UnidirectionalLeaves` AS `u3` ON `u1`.`Id` = `u3`.`Id` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2409,7 +2406,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2495,7 +2492,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2598,7 +2595,7 @@ LEFT JOIN ( ) AS `s` ON `u3`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u3`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u3`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u3`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2618,7 +2615,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2726,6 +2723,94 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u`, +( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + FROM (SELECT COUNT(*) FROM `#Dual`) + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedFixture.cs similarity index 70% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyQueryLibRedFixture.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedFixture.cs index caabb121..5d129f07 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyQueryLibRedFixture.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedFixture.cs @@ -1,13 +1,10 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTManyToManyQueryLibRedFixture : TPTManyToManyQueryRelationalFixture { diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedTest.cs similarity index 97% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedTest.cs index ac93f141..74d82fec 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTManyToManyQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTManyToManyQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTManyToManyQueryLibRedTest : TPTManyToManyQueryRelationalTestBase { @@ -390,7 +387,7 @@ INNER JOIN ( INNER JOIN `Leaves` AS `l` ON `r`.`Id` = `l`.`Id` ) AS `s` ON `j`.`LeafId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeId1` AND `e`.`Key2` = `s0`.`CompositeId2` AND `e`.`Key3` = `s0`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2` """); } @@ -607,7 +604,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -634,7 +631,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -679,7 +676,7 @@ INNER JOIN ( LEFT JOIN `Leaf2s` AS `l0` ON `r`.`Id` = `l0`.`Id` ) AS `s` ON `e0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `e`.`Key1` = `s0`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s0`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s0`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -697,7 +694,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -765,7 +762,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -783,7 +780,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -890,7 +887,7 @@ LEFT JOIN ( WHERE `e1`.`Id` < 10 ) AS `s` ON `e0`.`Id` = `s`.`ThreeId` ) AS `s0` ON `r`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `r`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -949,7 +946,7 @@ LEFT JOIN ( ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` WHERE `e`.`Key1` < 5 ) AS `s0` ON `r`.`Id` = `s0`.`LeafId` -ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `r`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -1025,7 +1022,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1088,7 +1085,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1111,7 +1108,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -2219,7 +2216,7 @@ INNER JOIN ( ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` WHERE `s`.`Discriminator` = 'UnidirectionalEntityLeaf' ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2369,7 +2366,7 @@ LEFT JOIN ( FROM `UnidirectionalJoinOneSelfPayload` AS `u0` INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`LeftId` = `u1`.`Id` ) AS `s` ON `u`.`Id` = `s`.`RightId` -ORDER BY `u`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `u`.`Id`, `s`.`LeftId` """); } @@ -2391,7 +2388,7 @@ INNER JOIN ( LEFT JOIN `UnidirectionalLeaves` AS `u3` ON `u1`.`Id` = `u3`.`Id` ) AS `s` ON `u0`.`RootSkipSharedId` = `s`.`Id` ) AS `s0` ON `u`.`Key1` = `s0`.`UnidirectionalEntityCompositeKeyKey1` AND `u`.`Key2` = `s0`.`UnidirectionalEntityCompositeKeyKey2` AND `u`.`Key3` = `s0`.`UnidirectionalEntityCompositeKeyKey3` -ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Key1`, `u`.`Key2`, `u`.`Key3`, `s0`.`RootSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2409,7 +2406,7 @@ LEFT JOIN ( INNER JOIN `UnidirectionalEntityOnes` AS `u1` ON `u0`.`OneId` = `u1`.`Id`) LEFT JOIN `UnidirectionalEntityTwos` AS `u2` ON `u1`.`Id` = `u2`.`ReferenceInverseId` ) AS `s` ON `u`.`Id` = `s`.`TwoId` -ORDER BY `u`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `u`.`Id`, `s`.`OneId` """); } @@ -2517,7 +2514,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -2622,7 +2619,7 @@ LEFT JOIN ( ) AS `s` ON `u3`.`Key1` = `s`.`UnidirectionalEntityCompositeKeyKey1` AND `u3`.`Key2` = `s`.`UnidirectionalEntityCompositeKeyKey2` AND `u3`.`Key3` = `s`.`UnidirectionalEntityCompositeKeyKey3` WHERE `u3`.`Key1` < 5 ) AS `s0` ON `u`.`Id` = `s0`.`LeafId` -ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2`, `s0`.`UnidirectionalEntityCompositeKeyKey3` +ORDER BY `u`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`UnidirectionalEntityCompositeKeyKey1`, `s0`.`UnidirectionalEntityCompositeKeyKey2` """); } @@ -2642,7 +2639,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -2749,6 +2746,94 @@ WHERE FALSE """); } + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u`, +( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + FROM (SELECT COUNT(*) FROM `#Dual`) + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTRelationshipsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryLibRedTest.cs similarity index 99% rename from test/EFCore.LibRed.FunctionalTests/Query/TPTRelationshipsQueryLibRedTest.cs rename to test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryLibRedTest.cs index 554ae021..4ab994d5 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTRelationshipsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Inheritance/TPTRelationshipsQueryLibRedTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System.Threading.Tasks; using EntityFrameworkCore.LibRed.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; @@ -9,7 +6,7 @@ using Microsoft.EntityFrameworkCore.BulkUpdates.Inheritance; using Microsoft.EntityFrameworkCore.Query.Inheritance; -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; +namespace EntityFrameworkCore.LibRed.FunctionalTests.Query.Inheritance; public class TPTRelationshipsQueryLibRedTest : TPTRelationshipsQueryTestBase @@ -47,7 +44,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`BaseParentId` -ORDER BY `s`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` +ORDER BY `s`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -63,7 +60,7 @@ public override async Task Include_collection_without_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `b`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -99,7 +96,7 @@ public override async Task Include_collection_without_inheritance_with_filter(bo LEFT JOIN `DerivedEntities_OwnedCollectionOnDerived` AS `d0` ON `b`.`Id` = `d0`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -139,7 +136,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -159,7 +156,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b1` LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -179,7 +176,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnDerived` AS `b1` LEFT JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -199,7 +196,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnDerived` AS `b1` INNER JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`DerivedInheritanceRelationshipEntityId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -260,7 +257,7 @@ LEFT JOIN ( LEFT JOIN `DerivedCollectionsOnBase` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -711,7 +708,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -736,7 +733,7 @@ LEFT JOIN ( LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s` ON `b1`.`Id` = `s`.`ParentCollectionId` ) AS `s0` ON `b`.`Id` = `s0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id`, `s0`.`Id0` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` """); } @@ -786,7 +783,7 @@ LEFT JOIN ( LEFT JOIN `NestedReferencesDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s` ON `b1`.`Id` = `s`.`ParentCollectionId` ) AS `s0` ON `b`.`Id` = `s0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } @@ -836,7 +833,7 @@ LEFT JOIN ( FROM `NestedCollections` AS `n` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -861,7 +858,7 @@ LEFT JOIN ( FROM `NestedCollections` AS `n` LEFT JOIN `NestedCollectionsDerived` AS `n0` ON `n`.`Id` = `n0`.`Id` ) AS `s0` ON `s`.`Id` = `s0`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id`, `s0`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `d1`.`DerivedInheritanceRelationshipEntityId`, `d1`.`Id` """); } @@ -999,7 +996,7 @@ LEFT JOIN ( INNER JOIN `DerivedCollectionsOnDerived` AS `d1` ON `b1`.`Id` = `d1`.`Id` ) AS `s` ON `b`.`Id` = `s`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Id` >= 4 -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `d0`.`DerivedInheritanceRelationshipEntityId`, `d0`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs index 7a02fed8..59069ebe 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/InheritanceRelationshipsQueryLibRedTest.cs @@ -196,7 +196,7 @@ public override async Task Include_collection_with_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -227,7 +227,7 @@ public override async Task Include_collection_with_inheritance_with_filter(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -258,7 +258,7 @@ public override async Task Include_collection_without_inheritance(bool async) LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -289,7 +289,7 @@ public override async Task Include_collection_without_inheritance_with_filter(bo LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `CollectionsOnBase` AS `c` ON `b`.`Id` = `c`.`ParentId` WHERE `b`.`Name` <> 'Bar' OR `b`.`Name` IS NULL -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `c`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -515,7 +515,7 @@ public override async Task Include_collection_with_inheritance_on_derived1(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b`.`Id` = `b2`.`BaseParentId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -531,7 +531,7 @@ public override async Task Include_collection_with_inheritance_on_derived2(bool LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnDerived` AS `b2` ON `b`.`Id` = `b2`.`ParentId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -551,7 +551,7 @@ LEFT JOIN ( WHERE `b2`.`Discriminator` = 'DerivedCollectionOnDerived' ) AS `b3` ON `b`.`Id` = `b3`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b3`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -635,7 +635,7 @@ public override async Task Nested_include_with_inheritance_reference_collection( LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b1` ON `b`.`Id` = `b1`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b2` ON `b`.`Id` = `b2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `NestedCollections` AS `n` ON `b0`.`Id` = `n`.`ParentReferenceId` -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id`, `n`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id` """); } @@ -652,7 +652,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b2` ON `b`.`Id` = `b2`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `NestedCollections` AS `n` ON `b0`.`Id` = `n`.`ParentReferenceId` WHERE `b`.`Discriminator` = 'DerivedInheritanceRelationshipEntity' -ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id`, `n`.`Id` +ORDER BY `b`.`Id`, `b1`.`BaseInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`DerivedInheritanceRelationshipEntityId`, `b2`.`Id` """); } @@ -687,7 +687,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b2` LEFT JOIN `NestedReferences` AS `n` ON `b2`.`Id` = `n`.`ParentCollectionId` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -722,7 +722,7 @@ LEFT JOIN ( FROM `BaseCollectionsOnBase` AS `b2` LEFT JOIN `NestedCollections` AS `n` ON `b2`.`Id` = `n`.`ParentCollectionId` ) AS `s` ON `b`.`Id` = `s`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id`, `s`.`Id0` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `s`.`Id` """); } @@ -755,7 +755,7 @@ LEFT JOIN ( FROM `PrincipalEntities` AS `p` LEFT JOIN `ReferencedEntities` AS `r0` ON `p`.`ReferenceId` = `r0`.`Id` ) AS `s` ON `r`.`Id` = `s`.`ReferencedEntityId` -ORDER BY `r`.`Id`, `s`.`Id` +ORDER BY `r`.`Id` """); } @@ -768,7 +768,7 @@ public override async Task Collection_projection_on_base_type(bool async) SELECT `b`.`Id`, `b0`.`Id`, `b0`.`BaseParentId`, `b0`.`Discriminator`, `b0`.`Name`, `b0`.`DerivedProperty` FROM `BaseEntities` AS `b` LEFT JOIN `BaseCollectionsOnBase` AS `b0` ON `b`.`Id` = `b0`.`BaseParentId` -ORDER BY `b`.`Id`, `b0`.`Id` +ORDER BY `b`.`Id` """); } @@ -788,7 +788,7 @@ LEFT JOIN ( WHERE `b2`.`Discriminator` = 'DerivedCollectionOnDerived' ) AS `b3` ON `b`.`Id` = `b3`.`DerivedInheritanceRelationshipEntityId` WHERE `b`.`Id` >= 4 -ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b3`.`Id` +ORDER BY `b`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } @@ -1570,7 +1570,7 @@ public override void Changes_in_derived_related_entities_are_detected() LEFT JOIN `BaseEntities_OwnedCollectionOnBase` AS `b0` ON `b3`.`Id` = `b0`.`BaseInheritanceRelationshipEntityId`) LEFT JOIN `BaseEntities_OwnedCollectionOnDerived` AS `b1` ON `b3`.`Id` = `b1`.`DerivedInheritanceRelationshipEntityId`) LEFT JOIN `BaseCollectionsOnBase` AS `b2` ON `b3`.`Id` = `b2`.`BaseParentId` -ORDER BY `b3`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id`, `b2`.`Id` +ORDER BY `b3`.`Id`, `b0`.`BaseInheritanceRelationshipEntityId`, `b0`.`Id`, `b1`.`DerivedInheritanceRelationshipEntityId`, `b1`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs index dce66a7c..fbdbf232 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyNoTrackingQueryLibRedTest.cs @@ -378,7 +378,7 @@ INNER JOIN ( WHERE `e0`.`Discriminator` = 'EntityLeaf' ) AS `e1` ON `j`.`LeafId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -396,7 +396,7 @@ LEFT JOIN ( INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` WHERE `e1`.`Discriminator` = 'EntityLeaf' ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -582,7 +582,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -609,7 +609,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -647,7 +647,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityRoot` AS `e0` INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -665,7 +665,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -732,7 +732,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -750,7 +750,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -853,7 +853,7 @@ LEFT JOIN ( WHERE `e2`.`Id` < 10 ) AS `s` ON `e1`.`Id` = `s`.`ThreeId` ) AS `s0` ON `e`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -903,7 +903,7 @@ LEFT JOIN ( WHERE `e0`.`Key1` < 5 ) AS `s0` ON `e`.`Id` = `s0`.`LeafId` WHERE `e`.`Discriminator` = 'EntityLeaf' -ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -979,7 +979,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1039,7 +1039,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1062,7 +1062,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs index 57fcc586..889ac0e6 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/ManyToManyQueryLibRedTest.cs @@ -378,7 +378,7 @@ INNER JOIN ( WHERE `e0`.`Discriminator` = 'EntityLeaf' ) AS `e1` ON `j`.`LeafId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeId1` AND `e`.`Key2` = `s`.`CompositeId2` AND `e`.`Key3` = `s`.`CompositeId3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2`, `s`.`CompositeId3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`LeafId`, `s`.`CompositeId1`, `s`.`CompositeId2` """); } @@ -396,7 +396,7 @@ LEFT JOIN ( INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` WHERE `e1`.`Discriminator` = 'EntityLeaf' ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -582,7 +582,7 @@ LEFT JOIN ( FROM `JoinOneSelfPayload` AS `j` INNER JOIN `EntityOnes` AS `e0` ON `j`.`LeftId` = `e0`.`Id` ) AS `s` ON `e`.`Id` = `s`.`RightId` -ORDER BY `e`.`Id`, `s`.`LeftId`, `s`.`RightId` +ORDER BY `e`.`Id`, `s`.`LeftId` """); } @@ -609,7 +609,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityTwo` AS `e3` INNER JOIN `EntityCompositeKeys` AS `e4` ON `e3`.`CompositeKeySkipSharedKey1` = `e4`.`Key1` AND `e3`.`CompositeKeySkipSharedKey2` = `e4`.`Key2` AND `e3`.`CompositeKeySkipSharedKey3` = `e4`.`Key3` ) AS `s1` ON `e`.`Id` = `s1`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2`, `s1`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s`.`ThreeId`, `s`.`TwoId`, `s0`.`SelfSkipSharedLeftId`, `s0`.`SelfSkipSharedRightId`, `s1`.`TwoSkipSharedId`, `s1`.`CompositeKeySkipSharedKey1`, `s1`.`CompositeKeySkipSharedKey2` """); } @@ -647,7 +647,7 @@ LEFT JOIN ( FROM `EntityCompositeKeyEntityRoot` AS `e0` INNER JOIN `EntityRoots` AS `e1` ON `e0`.`RootSkipSharedId` = `e1`.`Id` ) AS `s` ON `e`.`Key1` = `s`.`CompositeKeySkipSharedKey1` AND `e`.`Key2` = `s`.`CompositeKeySkipSharedKey2` AND `e`.`Key3` = `s`.`CompositeKeySkipSharedKey3` -ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2`, `s`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Key1`, `e`.`Key2`, `e`.`Key3`, `s`.`RootSkipSharedId`, `s`.`CompositeKeySkipSharedKey1`, `s`.`CompositeKeySkipSharedKey2` """); } @@ -665,7 +665,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id`) LEFT JOIN `EntityTwos` AS `e1` ON `e0`.`Id` = `e1`.`ReferenceInverseId` ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -732,7 +732,7 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e1` INNER JOIN `EntityOnes` AS `e2` ON `e1`.`OneSkipSharedId` = `e2`.`Id` ) AS `s` ON `e`.`Id` = `s`.`TwoSkipSharedId` -ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId` +ORDER BY `e`.`Id`, `s`.`OneSkipSharedId` """); } @@ -750,7 +750,7 @@ LEFT JOIN ( INNER JOIN `EntityOnes` AS `e0` ON `j`.`OneId` = `e0`.`Id` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` +ORDER BY `e`.`Id`, `s`.`OneId` """); } @@ -853,7 +853,7 @@ LEFT JOIN ( WHERE `e2`.`Id` < 10 ) AS `s` ON `e1`.`Id` = `s`.`ThreeId` ) AS `s0` ON `e`.`Id` = `s0`.`RootSkipSharedId` -ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId`, `s0`.`ThreeId` +ORDER BY `e`.`Id`, `s0`.`RootSkipSharedId`, `s0`.`ThreeSkipSharedId`, `s0`.`OneId` """); } @@ -903,7 +903,7 @@ LEFT JOIN ( WHERE `e0`.`Key1` < 5 ) AS `s0` ON `e`.`Id` = `s0`.`LeafId` WHERE `e`.`Discriminator` = 'EntityLeaf' -ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2`, `s0`.`CompositeKeySkipSharedKey3` +ORDER BY `e`.`Id`, `s0`.`LeafId`, `s0`.`CompositeId1`, `s0`.`CompositeId2`, `s0`.`CompositeId3`, `s0`.`TwoSkipSharedId`, `s0`.`CompositeKeySkipSharedKey1`, `s0`.`CompositeKeySkipSharedKey2` """); } @@ -979,7 +979,7 @@ LEFT JOIN ( LEFT JOIN `EntityTwos` AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` < 10 ) AS `s` ON `e`.`Id` = `s`.`TwoId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id1` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId` """); } @@ -1039,7 +1039,7 @@ LEFT JOIN ( ) AS `e2` ON `e0`.`Id` = `e2`.`CollectionInverseId` WHERE `e0`.`Id` > 15 ) AS `s` ON `e`.`Id` = `s`.`ThreeId` -ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId`, `s`.`Id0` +ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`ThreeId` """); } @@ -1062,7 +1062,7 @@ LEFT JOIN ( ) AS `s` ON `e0`.`Id` = `s`.`TwoId` WHERE `e0`.`Id` > 15 ) AS `s0` ON `e`.`Id` = `s0`.`CollectionInverseId` -ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId`, `s0`.`TwoId` +ORDER BY `e`.`Id`, `s0`.`Id`, `s0`.`ThreeId` """); } @@ -1812,6 +1812,98 @@ SELECT 1 """); } + #region Non-shared tests + + public override async Task SelectMany_with_collection_selector_having_subquery() + { + await base.SelectMany_with_collection_selector_having_subquery(); + + AssertSql( + """ +SELECT `u`.`Id` AS `UserId`, `s`.`Id` AS `OrgId` +FROM `Users` AS `u`, +( + SELECT `o1`.`Id` + FROM ( + SELECT 1 + FROM (SELECT COUNT(*) FROM `#Dual`) + ) AS `e` + LEFT JOIN ( + SELECT `o`.`Id` + FROM `Organisations` AS `o` + WHERE EXISTS ( + SELECT 1 + FROM `OrganisationUser` AS `o0` + WHERE `o`.`Id` = `o0`.`OrganisationId`) + ) AS `o1` ON TRUE +) AS `s` +"""); + } + + public override async Task Many_to_many_load_works_when_join_entity_has_custom_key(bool async) + { + await base.Many_to_many_load_works_when_join_entity_has_custom_key(async); + + AssertSql( + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyM_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyM_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyM_Id` + FROM `ManyMN_DB` AS `m0` + LEFT JOIN `ManyN_DB` AS `m1` ON `m0`.`ManyN_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyM_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +""", + // + """ +@p='1' + +SELECT TOP 1 `m`.`Id` +FROM `ManyN_DB` AS `m` +WHERE `m`.`Id` = @p +""", + // + """ +@p='1' + +SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` +FROM (`ManyN_DB` AS `m` +INNER JOIN ( + SELECT `m1`.`Id`, `m0`.`Id` AS `Id0`, `m0`.`ManyN_Id` + FROM `ManyMN_DB` AS `m0` + INNER JOIN `ManyM_DB` AS `m1` ON `m0`.`ManyM_Id` = `m1`.`Id` +) AS `s` ON `m`.`Id` = `s`.`ManyN_Id`) +LEFT JOIN ( + SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` + FROM `ManyMN_DB` AS `m2` + INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` + WHERE `m3`.`Id` = @p +) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` +WHERE `m`.`Id` = @p +ORDER BY `m`.`Id`, `s`.`Id0` +"""); + } + + #endregion Non-shared tests + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs index e2e2458e..7473bc46 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindAggregateOperatorsQueryLibRedTest.ResultOperators.cs @@ -926,7 +926,7 @@ public override async Task OrderBy_client_Take(bool async) SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -ORDER BY 1, `e`.`EmployeeID` +ORDER BY 1 """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs index 19656574..59038669 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindCompiledQueryLibRedTest.cs @@ -58,14 +58,14 @@ public override void Query_ending_with_include() SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -275,7 +275,7 @@ public override async Task Compiled_query_with_max_parameters() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -343,7 +343,7 @@ SELECT COUNT(*) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -794,7 +794,7 @@ public override void Query_with_single_parameter_with_include() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @customerID -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """, // """ @@ -804,7 +804,7 @@ public override void Query_with_single_parameter_with_include() FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = @customerID -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs index 6d3b5e39..210eec8e 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryLibRedTest.cs @@ -45,7 +45,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -62,7 +62,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -77,7 +77,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -91,7 +91,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -130,7 +130,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -228,7 +228,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -243,7 +243,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -261,7 +261,7 @@ public override async Task Include_collection_on_additional_from_clause_with_fil WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID`) -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -296,7 +296,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -315,7 +315,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -354,7 +354,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -377,7 +377,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -461,7 +461,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -496,7 +496,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -511,7 +511,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -540,7 +540,7 @@ ORDER BY `c0`.`CustomerID` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID`) -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } @@ -554,7 +554,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -632,7 +632,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -734,7 +734,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -782,7 +782,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -827,7 +827,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -845,7 +845,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -859,7 +859,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -898,7 +898,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -921,7 +921,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1043,7 +1043,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1208,7 +1208,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1224,7 +1224,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1308,7 +1308,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1499,7 +1499,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1571,7 +1571,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1587,7 +1587,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1687,7 +1687,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1730,7 +1730,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1778,7 +1778,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1824,7 +1824,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1870,7 +1870,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1986,7 +1986,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -2001,7 +2001,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2083,7 +2083,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2100,7 +2100,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2144,7 +2144,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -2176,7 +2176,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -2205,7 +2205,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2219,7 +2219,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs index 55e48785..dd313851 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindFunctionsQueryLibRedTest.Functions.cs @@ -136,7 +136,7 @@ public override async Task Order_by_length_twice_followed_by_projection_of_naked SELECT `c`.`CustomerID`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY LEN(`c`.`CustomerID`), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY LEN(`c`.`CustomerID`), `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs index 96285ad6..3cd392e9 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindGroupByQueryLibRedTest.cs @@ -2518,7 +2518,7 @@ public override async Task GroupBy_select_grouping_list(bool async) GROUP BY `c`.`City` ) AS `c1` LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -2535,7 +2535,7 @@ public override async Task GroupBy_select_grouping_array(bool async) GROUP BY `c`.`City` ) AS `c1` LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -2556,7 +2556,7 @@ LEFT JOIN ( FROM `Customers` AS `c0` WHERE `c0`.`CustomerID` LIKE 'A%' ) AS `c2` ON `c1`.`City` = `c2`.`City` -ORDER BY `c1`.`City`, `c2`.`CustomerID` +ORDER BY `c1`.`City` """); } @@ -3629,7 +3629,7 @@ public override async Task GroupBy_selecting_grouping_key_list(bool async) GROUP BY `o`.`CustomerID` ) AS `o1` LEFT JOIN `Orders` AS `o0` ON `o1`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o1`.`CustomerID`, `o0`.`OrderID` +ORDER BY `o1`.`CustomerID` """); } @@ -3966,7 +3966,7 @@ GROUP BY `c`.`CustomerID` HAVING `c`.`CustomerID` LIKE 'F%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -3984,7 +3984,7 @@ GROUP BY `o`.`CustomerID` HAVING `o`.`CustomerID` LIKE 'F%' ) AS `o1` LEFT JOIN `Orders` AS `o0` ON `o1`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o1`.`CustomerID`, `o0`.`OrderID` +ORDER BY `o1`.`CustomerID` """); } @@ -4062,7 +4062,7 @@ public override async Task Final_GroupBy_property_entity(bool async) """ SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4076,7 +4076,7 @@ public override async Task Final_GroupBy_entity(bool async) FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` WHERE `o`.`OrderID` < 10500 -ORDER BY `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` """); } @@ -4089,7 +4089,7 @@ public override async Task Final_GroupBy_property_entity_non_nullable(bool async SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` FROM `Order Details` AS `o` WHERE `o`.`OrderID` < 10500 -ORDER BY `o`.`OrderID`, `o`.`ProductID` +ORDER BY `o`.`OrderID` """); } @@ -4101,7 +4101,7 @@ public override async Task Final_GroupBy_property_anonymous_type(bool async) """ SELECT `c`.`City`, `c`.`ContactName`, `c`.`ContactTitle` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4113,7 +4113,7 @@ public override async Task Final_GroupBy_multiple_properties_entity(bool async) """ SELECT `c`.`City`, `c`.`Region`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`Region`, `c`.`CustomerID` +ORDER BY `c`.`City`, `c`.`Region` """); } @@ -4128,7 +4128,7 @@ public override async Task Final_GroupBy_complex_key_entity(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, 1 AS `Constant` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`City`, `c0`.`Region`, `c0`.`Constant`, `c0`.`CustomerID` +ORDER BY `c0`.`City`, `c0`.`Region`, `c0`.`Constant` """); } @@ -4143,7 +4143,7 @@ public override async Task Final_GroupBy_nominal_type_entity(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, 1 AS `Constant` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`City`, `c0`.`Constant`, `c0`.`CustomerID` +ORDER BY `c0`.`City`, `c0`.`Constant` """); } @@ -4155,7 +4155,7 @@ public override async Task Final_GroupBy_property_anonymous_type_element_selecto """ SELECT `c`.`City`, `c`.`ContactName`, `c`.`ContactTitle` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -4169,7 +4169,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection(bool FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4183,7 +4183,7 @@ public override async Task Final_GroupBy_property_entity_projecting_collection(b FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4201,7 +4201,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` < 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`Country` = 'USA' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` """); } @@ -4241,7 +4241,7 @@ public override async Task Final_GroupBy_TagWith(bool async) SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs index a32f109f..7ca08bd5 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryLibRedTest.cs @@ -63,7 +63,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -106,7 +106,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -120,7 +120,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } @@ -426,7 +426,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -445,7 +445,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -519,7 +519,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -701,7 +701,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -764,7 +764,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -938,7 +938,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -957,7 +957,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -980,7 +980,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1088,7 +1088,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1102,7 +1102,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1127,7 +1127,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -1189,7 +1189,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1229,7 +1229,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1347,7 +1347,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -1361,7 +1361,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1418,7 +1418,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -1441,7 +1441,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1459,7 +1459,7 @@ public override async Task Include_collection_on_additional_from_clause_with_fil WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID`) -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -1478,7 +1478,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1559,7 +1559,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1604,7 +1604,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1675,7 +1675,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1738,7 +1738,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1781,7 +1781,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1810,7 +1810,7 @@ ORDER BY `c0`.`CustomerID` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID`) -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } @@ -1853,7 +1853,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -1868,7 +1868,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -1883,7 +1883,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs index 4725c343..58e0089b 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindIncludeQueryLibRedTest.cs @@ -38,7 +38,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -78,7 +78,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -95,7 +95,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -138,7 +138,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } } @@ -239,7 +239,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -257,7 +257,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -317,7 +317,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -331,7 +331,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -345,7 +345,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -364,7 +364,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -404,7 +404,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -429,7 +429,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -452,7 +452,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -466,7 +466,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -480,7 +480,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -546,7 +546,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -561,7 +561,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -576,7 +576,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -653,7 +653,7 @@ public override async Task Include_collection_on_additional_from_clause_with_fil WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID`) -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -708,7 +708,7 @@ ORDER BY `c0`.`CustomerID` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID`) -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } } @@ -759,7 +759,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -798,7 +798,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -925,7 +925,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } } @@ -963,7 +963,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } } @@ -1001,7 +1001,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } } @@ -1062,7 +1062,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1131,7 +1131,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -1220,7 +1220,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } @@ -1532,7 +1532,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1848,7 +1848,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1870,7 +1870,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1915,7 +1915,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1933,7 +1933,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -1962,7 +1962,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1978,7 +1978,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2024,7 +2024,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2039,7 +2039,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2056,7 +2056,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2092,7 +2092,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2122,7 +2122,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2139,7 +2139,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2155,7 +2155,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2171,7 +2171,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2189,7 +2189,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2234,7 +2234,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs index f4e1c7d7..f89f2cff 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindJoinQueryLibRedTest.cs @@ -366,7 +366,7 @@ public override async Task GroupJoin_simple_ordering(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`City`, `o`.`OrderID` +ORDER BY `c`.`City` """); } @@ -398,7 +398,7 @@ public override async Task GroupJoin_as_final_operator(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -412,7 +412,7 @@ public override async Task Unflattened_GroupJoin_composed(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE (`c`.`CustomerID` LIKE 'F%') AND `c`.`City` = 'Lisboa' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -431,7 +431,7 @@ INNER JOIN ( ) AS `c1` ON `c`.`CustomerID` = `c1`.`CustomerID`) LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -520,7 +520,7 @@ public override async Task GroupJoin_Where_OrderBy(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `o`.`CustomerID` = 'ALFKI' OR `c`.`CustomerID` = 'ANATR' -ORDER BY `c`.`City`, `o`.`OrderID` +ORDER BY `c`.`City` """); } @@ -817,7 +817,7 @@ INNER JOIN ( ) AS `o1` ON `o`.`OrderID` = `o1`.`OrderID` ) AS `s` ON `c`.`CustomerID` = `s`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `s`.`OrderID0`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `c`.`CustomerID`, `s`.`OrderID0`, `s`.`OrderID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs index 2626b0b6..3f3b5355 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindMiscellaneousQueryLibRedTest.cs @@ -397,7 +397,7 @@ SELECT TOP 1 `o`.`OrderID` WHERE `c`.`CustomerID` = `o`.`CustomerID`) AS `c` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`c`, `c0`.`CustomerID` +ORDER BY `c0`.`c` """); } @@ -418,7 +418,7 @@ SELECT TOP 1 `o1`.`ProductID` WHERE `o`.`OrderID` = `o1`.`OrderID`) AS `c0` FROM `Orders` AS `o` ) AS `o4` -ORDER BY `o4`.`c` DESC, `o4`.`c0` DESC, `o4`.`OrderID` +ORDER BY `o4`.`c` DESC, `o4`.`c0` DESC """); } @@ -990,7 +990,7 @@ ORDER BY `e`.`EmployeeID` ORDER BY `o`.`OrderID` ) AS `o0` WHERE `e0`.`EmployeeID` = `o0`.`EmployeeID` -ORDER BY `e0`.`EmployeeID`, `o0`.`OrderID` +ORDER BY `e0`.`EmployeeID` """); } @@ -1019,7 +1019,7 @@ ORDER BY `o`.`OrderID` ORDER BY `c`.`CustomerID` ) AS `c0` WHERE `e0`.`City` = 'Seattle' -ORDER BY `e0`.`EmployeeID`, `c0`.`CustomerID` +ORDER BY `e0`.`EmployeeID` """); } @@ -1065,7 +1065,7 @@ public override async Task OrderBy_arithmetic(bool isAsync) """ SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -ORDER BY `e`.`EmployeeID` - `e`.`EmployeeID`, `e`.`EmployeeID` +ORDER BY `e`.`EmployeeID` - `e`.`EmployeeID` """); } @@ -1177,7 +1177,7 @@ ORDER BY `c`.`ContactName` ) AS `c0` ORDER BY `c0`.`ContactName` DESC ) AS `c1` -ORDER BY `c1`.`ContactName`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactName` """); } @@ -2145,7 +2145,7 @@ public override async Task Where_orderby_join_select(bool isAsync) FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` <> 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2160,7 +2160,7 @@ public override async Task Where_join_orderby_join_select(bool isAsync) INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` WHERE (`c`.`CustomerID` <> 'ALFKI') AND (`o`.`OrderID` IS NOT NULL AND `o0`.`OrderID` IS NOT NULL) -ORDER BY `c`.`CustomerID`, `o0`.`ProductID` +ORDER BY `c`.`CustomerID` """); } @@ -2187,7 +2187,7 @@ public override async Task Where_orderby_select_many(bool isAsync) FROM `Customers` AS `c`, `Orders` AS `o` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2201,7 +2201,7 @@ public override async Task SelectMany_cartesian_product_with_ordering(bool isAsy FROM `Customers` AS `c`, `Employees` AS `e` WHERE `c`.`City` = `e`.`City` OR (`c`.`City` IS NULL AND `e`.`City` IS NULL) -ORDER BY `e`.`City`, `c`.`CustomerID` DESC, `e`.`EmployeeID` +ORDER BY `e`.`City`, `c`.`CustomerID` DESC """); } @@ -2344,7 +2344,7 @@ ORDER BY `c0`.`ContactName` ) AS `c1` ORDER BY `c1`.`ContactName` DESC ) AS `c2` -ORDER BY `c2`.`ContactName`, `c2`.`CustomerID` +ORDER BY `c2`.`ContactName` """); } @@ -2535,7 +2535,6 @@ public override async Task OrderBy_true(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2547,7 +2546,6 @@ public override async Task OrderBy_integer(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2559,7 +2557,6 @@ public override async Task OrderBy_parameter(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -2641,7 +2638,7 @@ public override async Task OrderBy_multiple(bool isAsync) SELECT `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`Country`, `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`Country`, `c`.`City` """); } @@ -2775,7 +2772,7 @@ SELECT DISTINCT `o`.`CustomerID` WHERE `o`.`OrderID` < 10300 ) AS `o0` LEFT JOIN `Orders` AS `o1` ON `o0`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `o0`.`CustomerID`, `o1`.`OrderID` +ORDER BY `o0`.`CustomerID` """); } @@ -2795,7 +2792,7 @@ SELECT DISTINCT `o`.`CustomerID` WHERE `o`.`OrderID` < 10300 ) AS `o0` LEFT JOIN `Orders` AS `o1` ON `o0`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `o0`.`CustomerID`, `o1`.`OrderID` +ORDER BY `o0`.`CustomerID` """); } @@ -2884,7 +2881,7 @@ public override async Task Select_correlated_subquery_filtered(bool isAsync) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -3064,7 +3061,7 @@ public override async Task OrderBy_conditional_operator_where_condition_false(bo """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`City`, `c`.`CustomerID` +ORDER BY `c`.`City` """); } @@ -3076,7 +3073,7 @@ public override async Task OrderBy_comparison_operator(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY NOT (`c`.`Region` = 'ASK' AND `c`.`Region` IS NOT NULL), `c`.`CustomerID` +ORDER BY NOT (`c`.`Region` = 'ASK' AND `c`.`Region` IS NOT NULL) """); } @@ -3211,7 +3208,7 @@ public override async Task Selected_column_can_coalesce(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY IIF(`c`.`Region` IS NULL, 'ZZ', `c`.`Region`), `c`.`CustomerID` +ORDER BY IIF(`c`.`Region` IS NULL, 'ZZ', `c`.`Region`) """); } @@ -3765,7 +3762,7 @@ public override async Task OrderBy_skip_take(bool isAsync) ) AS `c0` ORDER BY `c0`.`ContactTitle` DESC, `c0`.`ContactName` DESC ) AS `c1` -ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName` """); } @@ -3813,7 +3810,7 @@ public override async Task OrderBy_skip_take_take(bool isAsync) ) AS `c1` ORDER BY `c1`.`ContactTitle` DESC, `c1`.`ContactName` DESC ) AS `c0` -ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName`, `c0`.`CustomerID` +ORDER BY `c0`.`ContactTitle`, `c0`.`ContactName` """); } @@ -3846,7 +3843,7 @@ public override async Task OrderBy_skip_take_take_take_take(bool isAsync) ) AS `c1` ORDER BY `c1`.`ContactTitle`, `c1`.`ContactName` ) AS `c2` -ORDER BY `c2`.`ContactTitle`, `c2`.`ContactName`, `c2`.`CustomerID` +ORDER BY `c2`.`ContactTitle`, `c2`.`ContactName` """); } @@ -4009,7 +4006,7 @@ public override async Task OrderBy_skip_take_distinct_orderby_take(bool isAsync) ORDER BY `c3`.`ContactTitle`, `c3`.`ContactName` ) AS `c0` ) AS `c1` -ORDER BY `c1`.`ContactTitle`, `c1`.`CustomerID` +ORDER BY `c1`.`ContactTitle` """); } @@ -4226,12 +4223,12 @@ public override async Task Anonymous_complex_orderby(bool isAsync) AssertSql( """ -SELECT `c0`.`A`, `c0`.`CustomerID` +SELECT `c0`.`A` FROM ( - SELECT `c`.`CustomerID` & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `A`, `c`.`CustomerID` + SELECT `c`.`CustomerID` & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `A` FROM `Customers` AS `c` ) AS `c0` -ORDER BY `c0`.`A`, `c0`.`CustomerID` +ORDER BY `c0`.`A` """); } @@ -4241,7 +4238,7 @@ public override async Task Anonymous_subquery_orderby(bool isAsync) AssertSql( """ -SELECT `c0`.`A`, `c0`.`c`, `c0`.`CustomerID` +SELECT `c0`.`A`, `c0`.`c` FROM ( SELECT ( SELECT TOP 1 `o1`.`OrderDate` @@ -4251,14 +4248,14 @@ SELECT TOP 1 `o1`.`OrderDate` SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` WHERE `c`.`CustomerID` = `o0`.`CustomerID` - ORDER BY `o0`.`OrderID` DESC) AS `c`, `c`.`CustomerID` + ORDER BY `o0`.`OrderID` DESC) AS `c` FROM `Customers` AS `c` WHERE ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID`) > 1 ) AS `c0` -ORDER BY `c0`.`c`, `c0`.`CustomerID` +ORDER BY `c0`.`c` """); } @@ -4363,7 +4360,7 @@ public override async Task DTO_subquery_orderby(bool isAsync) AssertSql( """ -SELECT `c0`.`Property`, `c0`.`c`, `c0`.`CustomerID` +SELECT `c0`.`Property`, `c0`.`c` FROM ( SELECT ( SELECT TOP 1 `o1`.`OrderDate` @@ -4373,14 +4370,14 @@ SELECT TOP 1 `o1`.`OrderDate` SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` WHERE `c`.`CustomerID` = `o0`.`CustomerID` - ORDER BY `o0`.`OrderID` DESC) AS `c`, `c`.`CustomerID` + ORDER BY `o0`.`OrderID` DESC) AS `c` FROM `Customers` AS `c` WHERE ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID`) > 1 ) AS `c0` -ORDER BY `c0`.`c`, `c0`.`CustomerID` +ORDER BY `c0`.`c` """); } @@ -4405,7 +4402,7 @@ public override async Task Include_with_orderby_skip_preserves_ordering(bool isA ORDER BY `c0`.`City` DESC, `c0`.`CustomerID` DESC ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c1`.`City`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c1`.`City`, `c1`.`CustomerID` """); } @@ -4833,7 +4830,7 @@ public override async Task Comparing_entities_using_Equals(bool isAsync) FROM `Customers` AS `c`, `Customers` AS `c0` WHERE (`c`.`CustomerID` LIKE 'ALFKI%') AND `c`.`CustomerID` = `c0`.`CustomerID` -ORDER BY `c`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -5125,7 +5122,6 @@ public override async Task OrderBy_empty_list_contains(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -5137,7 +5133,6 @@ public override async Task OrderBy_empty_list_does_not_contains(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -5656,7 +5651,7 @@ public override async Task Checked_context_with_arithmetic_does_not_fail(bool is SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` FROM `Order Details` AS `o` WHERE (`o`.`Quantity` + CINT(1)) = CINT(5) AND (`o`.`Quantity` - CINT(1)) = CINT(3) AND (`o`.`Quantity` * CINT(1)) = `o`.`Quantity` -ORDER BY `o`.`OrderID`, `o`.`ProductID` +ORDER BY `o`.`OrderID` """); } @@ -6227,7 +6222,7 @@ SELECT DISTINCT `o0`.`CustomerID` FROM `Orders` AS `o0` ) AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o1`.`CustomerID` +ORDER BY `c`.`CustomerID` """); } @@ -6449,7 +6444,7 @@ public override async Task OrderBy_Join(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -7309,7 +7304,7 @@ SELECT MAX(`o1`.`OrderDate`) WHERE `o`.`OrderID` IN (@ids1, @ids2) GROUP BY `o`.`Quantity` ) AS `o3` -ORDER BY `o3`.`MaxTimestamp`, `o3`.`Key` +ORDER BY `o3`.`MaxTimestamp` """); } @@ -7541,7 +7536,6 @@ public override async Task Cast_to_object_over_parameter_directly_in_lambda(bool """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -ORDER BY `o`.`OrderID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs index 2fe6d0b8..81fd2cb6 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindNavigationsQueryLibRedTest.cs @@ -446,7 +446,7 @@ public override async Task Select_collection_navigation_simple(bool isAsync) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -476,7 +476,7 @@ public override async Task Select_collection_navigation_simple_followed_by_order FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -491,7 +491,7 @@ public override async Task Select_collection_navigation_multi_part(bool isAsync) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` = 'ALFKI' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -507,7 +507,7 @@ public override async Task Select_collection_navigation_multi_part2(bool isAsync LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o0`.`CustomerID` IN ('ALFKI', 'ANTON') -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs index 2f2f782e..9878c70e 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryFiltersQueryLibRedTest.cs @@ -165,7 +165,7 @@ public override async Task Include_query_opt_out(bool async) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs index cd7e1774..2ce10abe 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindQueryTaggingQueryLibRedTest.cs @@ -98,7 +98,7 @@ public override void Tag_on_include_query() ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs index 51f5dcf3..73d27cbb 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSelectQueryLibRedTest.cs @@ -67,7 +67,7 @@ ORDER BY `o`.`OrderID` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` -ORDER BY `o0`.`OrderID`, `e0`.`EmployeeID` +ORDER BY `o0`.`OrderID` """); } @@ -91,7 +91,7 @@ public override async Task Projection_when_client_evald_subquery(bool isAsync) SELECT `c`.`CustomerID`, `o`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -168,7 +168,6 @@ public override async Task Select_bool_closure_with_order_parameter_with_cast_to SELECT CBOOL(@boolean) FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` """); } @@ -1153,7 +1152,7 @@ public override async Task Anonymous_projection_with_repeated_property_being_ord SELECT `c`.`CustomerID` AS `A`, `o`.`CustomerID` AS `B` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` -ORDER BY `o`.`CustomerID`, `o`.`OrderID` +ORDER BY `o`.`CustomerID` """); } @@ -1492,7 +1491,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` > 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1510,7 +1509,7 @@ LEFT JOIN ( WHERE `o`.`OrderID` > 11000 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'A%' -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1565,7 +1564,7 @@ public override async Task Select_chained_entity_navigation_doesnt_materialize_i FROM (`Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1706,7 +1705,7 @@ public override async Task Collection_projection_AsNoTracking_OrderBy(bool async SELECT `c`.`CustomerID`, `o`.`OrderDate`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1852,7 +1851,7 @@ public override async Task Reverse_in_join_outer(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`City`, `c`.`CustomerID` DESC, `o`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID` DESC """); } @@ -1884,7 +1883,7 @@ public override async Task Reverse_in_join_inner(bool async) SELECT `c`.`CustomerID`, `o`.`OrderID` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1917,7 +1916,7 @@ public override async Task Reverse_in_SelectMany(bool async) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID` DESC, `o`.`OrderID` +ORDER BY `c`.`CustomerID` DESC """); } @@ -2010,7 +2009,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` AND `o`.`OrderID` < 11000) > 0 -ORDER BY `c`.`CustomerID`, `o1`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2037,7 +2036,7 @@ public override async Task Projecting_multiple_collection_with_same_constant_wor LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -2108,7 +2107,7 @@ public override async Task Projecting_count_of_navigation_which_is_generic_colle SELECT `c`.`CustomerID`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2494,7 +2493,7 @@ SELECT COUNT(*) WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2523,7 +2522,7 @@ public override async Task MemberInit_in_projection_without_arguments(bool async FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -2580,7 +2579,7 @@ ORDER BY `o`.`OrderID` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` -ORDER BY `o0`.`OrderID`, `e0`.`EmployeeID` +ORDER BY `o0`.`OrderID` """); } @@ -2798,7 +2797,7 @@ SELECT TOP 1 `c`.`CustomerID` ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -2815,7 +2814,7 @@ SELECT TOP 1 `c`.`CustomerID` ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs index 2b60cf12..996f598b 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSetOperationsQueryLibRedTest.cs @@ -118,7 +118,7 @@ ORDER BY `u`.`ContactName` ) AS `u0` ORDER BY `u0`.`ContactName` DESC ) AS `u1` -ORDER BY `u1`.`ContactName`, `u1`.`CustomerID` +ORDER BY `u1`.`ContactName` """); } @@ -386,7 +386,7 @@ ORDER BY `u`.`Foo` ORDER BY `u1`.`Foo` DESC ) AS `u0` WHERE `u0`.`Foo` = 'Berlin' -ORDER BY `u0`.`Foo`, `u0`.`CustomerID` +ORDER BY `u0`.`Foo` """); } @@ -407,7 +407,7 @@ public override async Task Union_Include(bool isAsync) WHERE `c0`.`City` = 'London' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -428,7 +428,7 @@ public override async Task Include_Union(bool isAsync) WHERE `c0`.`City` = 'London' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1162,7 +1162,7 @@ public override async Task Collection_projection_after_set_operation(bool async) WHERE `c0`.`CustomerID` LIKE 'F%' ) AS `u` LEFT JOIN `Orders` AS `o` ON `u`.`CustomerID` = `o`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1202,7 +1202,7 @@ public override async Task Union_on_entity_with_correlated_collection(bool async WHERE `o0`.`OrderID` < 10250 ) AS `u` LEFT JOIN `Orders` AS `o1` ON `u`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `u`.`CustomerID`, `o1`.`OrderID` +ORDER BY `u`.`CustomerID` """); } @@ -1225,7 +1225,7 @@ public override async Task Union_on_entity_plus_other_column_with_correlated_col WHERE `o0`.`OrderID` < 10250 ) AS `u` LEFT JOIN `Orders` AS `o1` ON `u`.`CustomerID` = `o1`.`CustomerID` -ORDER BY `u`.`CustomerID`, `u`.`OrderDate`, `o1`.`OrderID` +ORDER BY `u`.`CustomerID`, `u`.`OrderDate` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs index 87521a64..e71c858f 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryLibRedTest.cs @@ -220,7 +220,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -449,7 +449,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1296,7 +1296,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1356,7 +1356,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs index 41277d55..8282e0d9 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindSplitIncludeQueryLibRedTest.cs @@ -1159,7 +1159,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -1302,7 +1302,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -1337,7 +1337,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1372,7 +1372,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs index cc809353..ebe230ee 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindStringIncludeQueryLibRedTest.cs @@ -46,7 +46,7 @@ public override async Task Include_collection_with_filter_reordered(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -63,7 +63,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -78,7 +78,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -92,7 +92,7 @@ public override async Task Include_collection_with_filter(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -131,7 +131,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` DESC ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` """); } @@ -229,7 +229,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -244,7 +244,7 @@ public override async Task Include_references_then_include_collection(bool async LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -262,7 +262,7 @@ public override async Task Include_collection_on_additional_from_clause_with_fil WHERE `c0`.`CustomerID` = 'ALFKI' ) AS `c1` LEFT JOIN `Orders` AS `o` ON `c1`.`CustomerID` = `o`.`CustomerID`) -ORDER BY `c`.`CustomerID`, `c1`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID`, `c1`.`CustomerID` """); } @@ -297,7 +297,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID0` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -316,7 +316,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as ORDER BY `c`.`ContactTitle` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` """); } @@ -355,7 +355,7 @@ public override async Task Include_collection_take_no_order_by(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -378,7 +378,7 @@ public override async Task Include_collection_principal_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -462,7 +462,7 @@ public override async Task Include_collection_single_or_default_no_result(bool a WHERE `c`.`CustomerID` = 'ALFKI ?' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -497,7 +497,7 @@ public override async Task Include_collection_with_left_join_clause_with_filter( LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -512,7 +512,7 @@ public override async Task Include_collection_with_right_join_clause_with_filter RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -541,7 +541,7 @@ ORDER BY `c0`.`CustomerID` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` LEFT JOIN `Orders` AS `o0` ON `c2`.`CustomerID` = `o0`.`CustomerID`) -ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID`, `o`.`OrderID` """); } @@ -555,7 +555,7 @@ public override async Task Include_collection(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -633,7 +633,7 @@ public override async Task Include_collection_with_join_clause_with_filter(bool INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } @@ -728,7 +728,7 @@ public override async Task Include_duplicate_reference(bool async) ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Customers` AS `c0` ON `s`.`CustomerID0` = `c0`.`CustomerID` -ORDER BY `s`.`CustomerID`, `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`CustomerID`, `s`.`OrderID` """); } @@ -776,7 +776,7 @@ public override async Task Include_collection_on_join_clause_with_order_by_and_f INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `c`.`CustomerID` = 'ALFKI' -ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `c`.`City`, `c`.`CustomerID`, `o`.`OrderID` """); } @@ -821,7 +821,7 @@ public override async Task Include_multiple_references_then_include_collection_m LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -839,7 +839,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -853,7 +853,7 @@ public override async Task Include_collection_order_by_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -892,7 +892,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as ORDER BY `c`.`CustomerID` ) AS `c1`, `Customers` AS `c0` -ORDER BY `c1`.`CustomerID`, `c0`.`CustomerID` +ORDER BY `c1`.`CustomerID` """); } @@ -915,7 +915,7 @@ public override async Task Include_collection_dependent_already_tracked(bool asy WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1024,7 +1024,7 @@ public override async Task Include_references_and_collection_multi_level(bool as LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1189,7 +1189,7 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`OrderID` < 10800 -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -1205,7 +1205,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`ProductID` MOD 23) = 17 AND `o`.`Quantity` < CINT(10) -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1289,7 +1289,7 @@ public override async Task Include_multiple_references_then_include_collection_m INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1473,7 +1473,7 @@ public override async Task Include_collection_distinct_is_server_evaluated(bool WHERE `c`.`CustomerID` LIKE 'A%' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1545,7 +1545,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1561,7 +1561,7 @@ public override async Task Include_closes_reader(bool async) FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1661,7 +1661,7 @@ public override async Task Include_collection_orderby_take(bool async) ORDER BY `c`.`CustomerID` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """); } @@ -1704,7 +1704,7 @@ public override async Task Include_collection_order_by_non_key(bool async) FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY `c`.`PostalCode`, `c`.`CustomerID`, `o`.`OrderID` +ORDER BY `c`.`PostalCode`, `c`.`CustomerID` """); } @@ -1752,7 +1752,7 @@ ORDER BY `o4`.`OrderID` ) AS `o2` ) AS `s` LEFT JOIN `Customers` AS `c` ON `s`.`CustomerID` = `c`.`CustomerID` -ORDER BY `s`.`OrderID`, `s`.`OrderID0` +ORDER BY `s`.`OrderID` """); } @@ -1798,7 +1798,7 @@ public override async Task Include_references_and_collection_multi_level_predica LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -1844,7 +1844,7 @@ public override async Task Include_collection_with_last(bool async) ORDER BY `c`.`CompanyName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` """); } @@ -1947,7 +1947,7 @@ SELECT TOP 1 `o`.`OrderDate` ORDER BY `c1`.`c` ) AS `c0` LEFT JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` -ORDER BY `c0`.`c`, `c0`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c0`.`c`, `c0`.`CustomerID` """); } @@ -1962,7 +1962,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` WHERE `o`.`CustomerID` LIKE 'F%' -ORDER BY `o`.`OrderID`, `o0`.`OrderID` +ORDER BY `o`.`OrderID` """); } @@ -2044,7 +2044,7 @@ public override async Task Include_multi_level_reference_then_include_collection WHERE `o`.`OrderID` = 10248 ) AS `s` LEFT JOIN `Orders` AS `o0` ON `s`.`CustomerID0` = `o0`.`CustomerID` -ORDER BY `s`.`OrderID`, `o0`.`OrderID` +ORDER BY `s`.`OrderID` """); } @@ -2061,7 +2061,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE (`o`.`OrderID` MOD 23) = 13 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2105,7 +2105,7 @@ public override async Task Include_with_take(bool async) ORDER BY `c`.`ContactName` DESC ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` """); } @@ -2137,7 +2137,7 @@ LEFT JOIN ( INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` ) AS `s` ON `p`.`ProductID` = `s`.`ProductID` WHERE (`p`.`ProductID` MOD 17) = 5 AND `p`.`UnitPrice` < 20.0 -ORDER BY `p`.`ProductID`, `s`.`OrderID`, `s`.`ProductID` +ORDER BY `p`.`ProductID`, `s`.`OrderID` """); } @@ -2166,7 +2166,7 @@ public override async Task Include_references_then_include_collection_multi_leve LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` WHERE `o`.`OrderID` = 10248 -ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o1`.`OrderID` +ORDER BY `o`.`OrderID`, `o`.`ProductID` """); } @@ -2180,7 +2180,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` WHERE `c`.`CustomerID` LIKE 'F%' -ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID`, `o`.`OrderID` +ORDER BY IIF(`c`.`CustomerID` LIKE 'S%', 1, 2), `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs index 7849884d..17285653 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NorthwindWhereQueryLibRedTest.cs @@ -1440,7 +1440,7 @@ public override async Task Where_navigation_contains(bool isAsync) WHERE `c`.`CustomerID` = 'ALFKI' ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` -ORDER BY `c0`.`CustomerID`, `o`.`OrderID` +ORDER BY `c0`.`CustomerID` """, // """ @@ -1726,7 +1726,7 @@ public override async Task Where_Queryable_ToList_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1744,7 +1744,7 @@ public override async Task Where_Queryable_ToList_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1761,7 +1761,7 @@ public override async Task Where_Queryable_ToArray_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1779,7 +1779,7 @@ public override async Task Where_Queryable_ToArray_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1796,7 +1796,7 @@ public override async Task Where_Queryable_AsEnumerable_Count(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1814,7 +1814,7 @@ public override async Task Where_Queryable_AsEnumerable_Contains(bool async) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1836,7 +1836,7 @@ WHERE NOT (IIF('ALFKI' IN ( FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID` ))) -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1853,7 +1853,7 @@ public override async Task Where_Queryable_ToList_Count_member(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } @@ -1870,7 +1870,7 @@ public override async Task Where_Queryable_ToArray_Length_member(bool async) SELECT COUNT(*) FROM `Orders` AS `o` WHERE `o`.`CustomerID` = `c`.`CustomerID`) = 0 -ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs index 480d6422..ef9efcc8 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/NullSemanticsQueryLibRedTest.cs @@ -2676,7 +2676,7 @@ public override async Task Null_comparison_in_order_by_with_relational_nulls(boo """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -ORDER BY NOT (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL), NOT (`e`.`NullableIntB` <> 10 OR `e`.`NullableIntB` IS NULL), `e`.`Id` +ORDER BY NOT (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL), NOT (`e`.`NullableIntB` <> 10 OR `e`.`NullableIntB` IS NULL) """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs index faf240d0..00b01e8c 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/OwnedEntityQueryLibRedTest.cs @@ -131,7 +131,7 @@ public override async Task Owned_reference_mapped_to_different_table_updated_cor LEFT JOIN `CustomerData` AS `c0` ON `c`.`Id` = `c0`.`CompanyId`) LEFT JOIN `SupplierData` AS `s` ON `c`.`Id` = `s`.`CompanyId` WHERE `c0`.`CompanyId` IS NOT NULL -ORDER BY `c`.`Id`, `s`.`CompanyId` +ORDER BY `c`.`Id` """); } @@ -149,7 +149,7 @@ public override async Task Owned_reference_mapped_to_different_table_nested_upda LEFT JOIN `IM_CustomerData` AS `i0` ON `i`.`OwnerId` = `i0`.`IntermediateOwnedEntityOwnerId`) LEFT JOIN `IM_SupplierData` AS `i1` ON `i`.`OwnerId` = `i1`.`IntermediateOwnedEntityOwnerId` WHERE `i0`.`IntermediateOwnedEntityOwnerId` IS NOT NULL -ORDER BY `o`.`Id`, `i1`.`IntermediateOwnedEntityOwnerId` +ORDER BY `o`.`Id` """); } @@ -161,7 +161,7 @@ public override async Task Owned_entity_with_all_null_properties_materializes_wh """ SELECT `r`.`Id`, `r`.`Buyer`, `r`.`Rot_ApartmentNo`, `r`.`Rot_ServiceType`, `r`.`Rut_Value` FROM `RotRutCases` AS `r` -ORDER BY `r`.`Buyer`, `r`.`Id` +ORDER BY `r`.`Buyer` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/OwnedQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/OwnedQueryLibRedTest.cs index 562c52a4..4a02af62 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/OwnedQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/OwnedQueryLibRedTest.cs @@ -36,7 +36,7 @@ LEFT JOIN ( WHERE `o0`.`Discriminator` = 'LeafB' ) AS `o1` WHERE FALSE -ORDER BY `o`.`Id`, `o1`.`Id`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderClientId`, `s`.`OrderId` +ORDER BY `o`.`Id`, `o1`.`Id`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderClientId`, `s`.`OrderId`, `s`.`Id0` """); } @@ -358,7 +358,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg FROM (`OwnedPerson` AS `o` LEFT JOIN `Planet` AS `p` ON `o`.`PersonAddress_Country_PlanetId` = `p`.`Id`) LEFT JOIN `Moon` AS `m` ON `p`.`Id` = `m`.`PlanetId` -ORDER BY `o`.`Id`, `m`.`Id` +ORDER BY `o`.`Id` """); } @@ -402,7 +402,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg LEFT JOIN `Planet` AS `p` ON `o`.`PersonAddress_Country_PlanetId` = `p`.`Id`) LEFT JOIN `Star` AS `s` ON `p`.`StarId` = `s`.`Id`) LEFT JOIN `Element` AS `e` ON `s`.`Id` = `e`.`StarId` -ORDER BY `o`.`Id`, `e`.`Id` +ORDER BY `o`.`Id` """); } @@ -434,7 +434,7 @@ await base.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_ LEFT JOIN `Star` AS `s` ON `p`.`StarId` = `s`.`Id`) LEFT JOIN `Element` AS `e` ON `s`.`Id` = `e`.`StarId` WHERE `s`.`Name` = 'Sol' -ORDER BY `o`.`Id`, `e`.`Id` +ORDER BY `o`.`Id` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs index 425b37cb..0fcefc7a 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledQueryLibRedTest.cs @@ -295,7 +295,7 @@ public override async Task OrderBy() """ SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -339,7 +339,7 @@ public override async Task Take_with_constant() SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -353,7 +353,7 @@ public override async Task Take_with_parameter() SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } @@ -389,7 +389,7 @@ public override async Task Include_single() FROM `Blogs` AS `b` LEFT JOIN `Posts` AS `p` ON `b`.`Id` = `p`.`BlogId` WHERE `b`.`Id` > 8 -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -420,7 +420,7 @@ public override async Task Final_GroupBy() """ SELECT `b`.`Name`, `b`.`Id`, `b`.`Json` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs index 57f26ad9..fef77eb0 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/PrecompiledSqlPregenerationQueryLibRedTest.cs @@ -197,7 +197,7 @@ public override async Task Include_single_query() SELECT `b`.`Id`, `b`.`Name`, `p`.`Id`, `p`.`BlogId`, `p`.`Title` FROM `Blogs` AS `b` LEFT JOIN `Post` AS `p` ON `b`.`Id` = `p`.`BlogId` -ORDER BY `b`.`Id`, `p`.`Id` +ORDER BY `b`.`Id` """); } @@ -228,7 +228,7 @@ public override async Task Final_GroupBy() """ SELECT `b`.`Name`, `b`.`Id` FROM `Blogs` AS `b` -ORDER BY `b`.`Name`, `b`.`Id` +ORDER BY `b`.`Name` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs deleted file mode 100644 index e2670d87..00000000 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPCInheritanceQueryLibRedFixture.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; - -public class TPCInheritanceQueryLibRedFixture : TPCInheritanceQueryLibRedFixtureBase -{ -} diff --git a/test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs b/test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs deleted file mode 100644 index f6325da2..00000000 --- a/test/EFCore.LibRed.FunctionalTests/Query/TPTFiltersInheritanceQueryLibRedFixture.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.EntityFrameworkCore.Query; - -namespace EntityFrameworkCore.LibRed.FunctionalTests.Query; - -public class TPTFiltersInheritanceQueryLibRedFixture : TPTInheritanceQueryLibRedFixture -{ - public override bool EnableFilters - => true; -} diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs index 2a6390eb..f17e5d6b 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Translations/MathTranslationsLibRedTest.cs @@ -293,12 +293,12 @@ public override async Task Truncate_project_and_order_by_it_twice() AssertSql( """ -SELECT `b0`.`A`, `b0`.`Id` +SELECT `b0`.`A` FROM ( - SELECT FIX(`b`.`Double`) AS `A`, `b`.`Id` + SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` ) AS `b0` -ORDER BY `b0`.`A`, `b0`.`Id` +ORDER BY `b0`.`A` """); } @@ -314,12 +314,12 @@ public override async Task Truncate_project_and_order_by_it_twice2() AssertSql( """ -SELECT `b0`.`A`, `b0`.`Id` +SELECT `b0`.`A` FROM ( - SELECT FIX(`b`.`Double`) AS `A`, `b`.`Id` + SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` ) AS `b0` -ORDER BY `b0`.`A` DESC, `b0`.`Id` +ORDER BY `b0`.`A` DESC """); } @@ -335,12 +335,12 @@ public override async Task Truncate_project_and_order_by_it_twice3() AssertSql( """ -SELECT `b0`.`A`, `b0`.`Id` +SELECT `b0`.`A` FROM ( - SELECT FIX(`b`.`Double`) AS `A`, `b`.`Id` + SELECT FIX(`b`.`Double`) AS `A` FROM `BasicTypesEntities` AS `b` ) AS `b0` -ORDER BY `b0`.`A` DESC, `b0`.`Id` +ORDER BY `b0`.`A` DESC """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs index f104f778..ec95acc4 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Translations/StringTranslationsLibRedTest.cs @@ -22,9 +22,9 @@ protected override bool IsCaseSensitive #region Equals - public override async Task Equals() + public override async Task Instance_Equals() { - await base.Equals(); + await base.Instance_Equals(); AssertSql( """ @@ -1324,7 +1324,7 @@ public override async Task Join_over_non_nullable_column() GROUP BY `b`.`Int` ) AS `b1` LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` -ORDER BY `b1`.`Int`, `b0`.`Id` +ORDER BY `b1`.`Int` """); } @@ -1368,7 +1368,7 @@ LEFT JOIN ( FROM `BasicTypesEntities` AS `b0` WHERE LEN(`b0`.`String`) > 6 ) AS `b2` ON `b1`.`Int` = `b2`.`Int` -ORDER BY `b1`.`Int`, `b2`.`Id` +ORDER BY `b1`.`Int` """); } @@ -1432,7 +1432,7 @@ public override async Task Concat_aggregate() GROUP BY `b`.`Int` ) AS `b1` LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` -ORDER BY `b1`.`Int`, `b0`.`Id` +ORDER BY `b1`.`Int` """); } diff --git a/test/EFCore.LibRed.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs index 04b14a23..43eb7ae8 100644 --- a/test/EFCore.LibRed.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsLibRedTest.cs @@ -211,7 +211,7 @@ public override async Task Order_by_FromTimeSpan() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -ORDER BY TIMEVALUE(`b`.`TimeSpan`), `b`.`Id` +ORDER BY TIMEVALUE(`b`.`TimeSpan`) """); } diff --git a/test/LibRed.Ado.Tests/TestAssembly.cs b/test/LibRed.Ado.Tests/TestAssembly.cs index 9f4b4e02..2b5cb74c 100644 --- a/test/LibRed.Ado.Tests/TestAssembly.cs +++ b/test/LibRed.Ado.Tests/TestAssembly.cs @@ -1,6 +1,7 @@ -using Xunit; +using Xunit.Sdk; +using Xunit.v3; // Several tests copy the shared Northwind fixture while other tests open it read/write. File.Copy's source // handle does not share writes, so cross-class parallelism makes otherwise unrelated tests race at startup. // Explicit multi-connection behavior is covered by dedicated tests; keep this fixture-based project ordered. -[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: Parallelization(Mode = ParallelMode.None)] From 2604f64b5382a4b4cd7533efddbc64293adef09c Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Thu, 10 Sep 2026 22:09:25 +0800 Subject: [PATCH 03/13] Support calculated columns end to end, and refuse what ACE cannot read back MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LibRed could read a calculated column's cached value; it now creates, evaluates, writes, recomputes and alters them, with a SQL surface of its own since Access SQL has none. The measured format and semantics go in docs/format/page-02e-calculated-columns.md and §3.4a of page-02b-columns.md, added here; the notes below are only what changed. Two latent bugs, both invisible from LibRed's own side: - Text compression was applied to a calculated Memo as well as a calculated Text, because StoredType folds Memo onto Text. That shrank a 36-character result from 95 bytes to 61 and so back under the inline limit, meaning a value ACE puts on a long-value page never left the row. - RenameColumn left every expression that READ the renamed column naming the old one, after which ACE failed every read of the calculated column -- a table broken by an operation that named a different column entirely. New refusals. Reading a cached ERROR now throws rather than reporting Null, the envelope's leading field being a status rather than padding. Writing is refused for an explicit value, for CDbl over Null, for dropping a column an expression reads, and for indexing one. Only the first matches ACE; page-02e records why each of the others is worth diverging for, the short version being that ACE accepts them and produces a file it cannot then use, twice in a way nothing can repair. Indexing is the odd one out -- refusing matches Access's designer and storage engine, and diverges only from its SQL layer, which is the only place the state is reachable from. The SQL surface is `name type AS (expression)`. The parentheses are required, unlike SQL Server's, because the grammar does not parse the expression -- it captures raw text for a separate parser, so the delimiter is what says where it ends. Backtick quoting is translated to brackets on the way in, and the same translation now covers CHECK constraints, which carried the identical latent bug. Co-Authored-By: Claude Opus 5 --- src/LibRed/LibRed.Core/Catalog/ColumnDef.cs | 12 + src/LibRed/LibRed.Core/Catalog/JetCatalog.cs | 6 + .../LibRed.Core/Catalog/PropertyBlob.cs | 34 +- src/LibRed/LibRed.Core/Catalog/TdefBuilder.cs | 56 +- .../LibRed.Core/Formats/LongValueFormat.cs | 4 + src/LibRed/LibRed.Core/JetDatabase.cs | 40 +- .../Storage/Calculated/CalculatedEvaluator.cs | 583 ++++ .../Calculated/CalculatedExpression.cs | 533 ++++ .../LibRed.Core/Storage/CalculatedValue.cs | 181 +- src/LibRed/LibRed.Core/Storage/RowDecoder.cs | 18 + src/LibRed/LibRed.Core/Storage/RowEncoder.cs | 76 +- src/LibRed/LibRed.Core/Storage/RowInserter.cs | 70 +- .../LibRed.Core/Storage/TableCreator.cs | 142 +- .../LibRed.Core/Storage/Types/JetTypeCodec.cs | 12 +- .../LibRedMigrationsSqlGenerator.cs | 29 + .../Internal/LibRedDatabaseModelFactory.cs | 12 +- .../Execution/AccessTypeMapper.cs | 33 +- src/LibRed/LibRed.Sql/Ast/Statements.cs | 6 +- src/LibRed/LibRed.Sql/Grammar/AccessSql.g4 | 12 +- .../Grammar/Generated/AccessSqlBaseVisitor.cs | 10 + .../Grammar/Generated/AccessSqlParser.cs | 2504 +++++++++-------- .../Grammar/Generated/AccessSqlVisitor.cs | 6 + src/LibRed/LibRed.Sql/Parsing/AstBuilder.cs | 6 +- src/LibRed/docs/format/README.md | 9 +- src/LibRed/docs/format/page-02b-columns.md | 50 +- .../docs/format/page-02c-default-values.md | 10 + .../format/page-02e-calculated-columns.md | 446 +++ .../Migrations/MigrationsLibRedTest.cs | 105 +- .../LibRedDatabaseModelFactoryTest.cs | 6 +- .../Migrations/MigrationsLibRedTest.cs | 82 +- .../CalculatedColumnAccessTests.cs | 1376 ++++++++- .../CalculatedEvaluatorTests.cs | 301 ++ .../CalculatedColumnSqlAccessTests.cs | 200 ++ 33 files changed, 5524 insertions(+), 1446 deletions(-) create mode 100644 src/LibRed/LibRed.Core/Storage/Calculated/CalculatedEvaluator.cs create mode 100644 src/LibRed/LibRed.Core/Storage/Calculated/CalculatedExpression.cs create mode 100644 src/LibRed/docs/format/page-02e-calculated-columns.md create mode 100644 test/LibRed.Core.Tests/CalculatedEvaluatorTests.cs create mode 100644 test/LibRed.Engine.AccessTests/CalculatedColumnSqlAccessTests.cs diff --git a/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs b/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs index ac1b3db2..dd7684ff 100644 --- a/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs +++ b/src/LibRed/LibRed.Core/Catalog/ColumnDef.cs @@ -64,6 +64,18 @@ public sealed class ColumnDef /// result can outgrow the row, which ACE gives a map whatever the column's declared type. public bool HasLongValueMap { get; internal set; } + /// A calculated column's expression, from the table's LvProp blob. ACE evaluates this + /// text on every write that touches a column it references; the value in the row is only a cache of the + /// last result. Null when the column is not calculated (or the blob is missing). + public string? CalculatedExpression { get; internal set; } + + /// The type a calculated column's stored payload is really encoded in — the ResultType + /// property of the LvProp blob, which is the type the column was DECLARED with. It is not + /// : that is the promoted storage type of the *expression*, and the two part company + /// (a CDbl expression on a column declared LONG reads Double here and Int32 there). Null when the + /// column is not calculated, or when the blob did not carry the property. + public JetDataType? CalculatedResultType { get; internal set; } + /// AutoNumber (COUNTER) seed and increment. The increment is read from the TDEF header (0x18); /// the seed is the header's last-assigned value (0x14) plus the increment — which equals the original /// seed on a freshly created table (before any inserts advance the last value). Default 1/1. diff --git a/src/LibRed/LibRed.Core/Catalog/JetCatalog.cs b/src/LibRed/LibRed.Core/Catalog/JetCatalog.cs index 93aea5ca..5a0c3a01 100644 --- a/src/LibRed/LibRed.Core/Catalog/JetCatalog.cs +++ b/src/LibRed/LibRed.Core/Catalog/JetCatalog.cs @@ -132,6 +132,12 @@ private List LoadTables() if (required.Contains(column.Name)) column.IsNullable = false; (column.ValidationRule, column.ValidationText) = PropertyBlob.ReadValidation(blob, column.Name); + // A calculated column's expression and REAL result type live here, not in the descriptor + // (§3.4a). Without them the stored payload can only be guessed from its width, which is + // wrong whenever the declared and expression types differ. + if (column.IsCalculated) + (column.CalculatedExpression, column.CalculatedResultType) = + PropertyBlob.ReadCalculated(blob, column.Name); } var checks = PropertyBlob.ReadCheckConstraints(blob); diff --git a/src/LibRed/LibRed.Core/Catalog/PropertyBlob.cs b/src/LibRed/LibRed.Core/Catalog/PropertyBlob.cs index 83720e07..3e83283e 100644 --- a/src/LibRed/LibRed.Core/Catalog/PropertyBlob.cs +++ b/src/LibRed/LibRed.Core/Catalog/PropertyBlob.cs @@ -29,6 +29,12 @@ public static class PropertyBlob public const string ValidationRuleProperty = "ValidationRule"; public const string ValidationTextProperty = "ValidationText"; + /// A calculated column's expression text (§3.4a). + public const string ExpressionProperty = "Expression"; + + /// A calculated column's real result type, as a one-byte Jet type code (§3.4a). + public const string ResultTypeProperty = "ResultType"; + /// A single property: the owning column (or "" for the table), the property name, its value /// (text; for a boolean, "1"/"0"), and its stored type. The type is an ordinary /// code — the same byte used by column descriptors and MSysQueries — so Access @@ -259,6 +265,24 @@ public static (string? Rule, string? Text) ReadValidation(ReadOnlySpan blo return (rule, text); } + /// Extracts a calculated column's Expression and ResultType properties for the + /// given column; each is null if absent. ResultType is a single byte holding the Jet type code + /// the payload is encoded in — the type the column was declared with, which is NOT the descriptor's + /// type (see page-02b §3.4a). + public static (string? Expression, JetDataType? ResultType) ReadCalculated(ReadOnlySpan blob, string owner) + { + string? expression = null; + JetDataType? resultType = null; + foreach (Property p in Read(blob)) + { + if (!string.Equals(p.Owner, owner, StringComparison.OrdinalIgnoreCase)) continue; + if (p.Name == ExpressionProperty) expression = p.Value.Length > 0 ? p.Value : null; + else if (p.Name == ResultTypeProperty && p.RawValue is { Length: > 0 } raw) + resultType = (JetDataType)raw[0]; + } + return (expression, resultType); + } + /// Extracts the table's CHECK constraints (name, expression) from a blob. The /// CheckConstraints table property stores them as a name\0expression\0 list, terminated /// by an empty entry. @@ -272,10 +296,18 @@ public static (string? Rule, string? Text) ReadValidation(ReadOnlySpan blo /// Serialises CHECK constraints into the CheckConstraints property value: each is /// name\0expression\0, then a trailing \0 terminator. + /// Identifier quoting is normalised on the way in. A CHECK is evaluated by the Access + /// expression service, which does not understand SQL's `backtick` quoting — measured, it + /// reads `Qty` as a field whose name includes the backticks and fails "Could not find field". The + /// DDL parser accepts such a constraint quite happily and stores it, so the table is created and then + /// refuses every INSERT. This is the single point where check text becomes stored bytes, so normalising + /// here is what stops any route reaching the blob with SQL-flavoured quoting. public static string WriteCheckList(IReadOnlyList<(string Name, string Expression)> checks) { var sb = new StringBuilder(); - foreach (var (name, expr) in checks) sb.Append(name).Append('\0').Append(expr).Append('\0'); + foreach (var (name, expr) in checks) + sb.Append(name).Append('\0') + .Append(Storage.Calculated.CalculatedExpression.NormaliseIdentifierQuoting(expr)).Append('\0'); sb.Append('\0'); return sb.ToString(); } diff --git a/src/LibRed/LibRed.Core/Catalog/TdefBuilder.cs b/src/LibRed/LibRed.Core/Catalog/TdefBuilder.cs index 2fec23f5..a35a85f2 100644 --- a/src/LibRed/LibRed.Core/Catalog/TdefBuilder.cs +++ b/src/LibRed/LibRed.Core/Catalog/TdefBuilder.cs @@ -30,7 +30,50 @@ public sealed record ColumnSpec( byte SystemFlags = 0, // WITH COMPRESSION on a Text/Memo column: the 0x10 extended flag bit 0x01. Off unless asked for, which // is what ACE does for a column declared without it (LongTextStorageAccessTests). - bool SupportsCompressedUnicode = false); + bool SupportsCompressedUnicode = false, + // A calculated column (§3.4a): the expression, and the type the caller DECLARED for it. Both null for an + // ordinary column. They are separate from Type because Type carries the descriptor's *promoted* storage + // type, which need not be the result type at all — build one with Calculated() rather than by hand. + string? CalculatedExpression = null, + JetDataType? CalculatedResultType = null) +{ + /// A calculated column of computing . + /// ACE stores one **always variable-length**, with the descriptor carrying the *promoted* type and a + /// constant declared length, and the real result type living in the table's property blob — get any of + /// those wrong and Access reads the payload at the wrong width, so this is the only supported way to + /// build one. + public static ColumnSpec Calculated(string name, JetDataType resultType, string expression) => + new(name, PromotedType(resultType), CalculatedLength(resultType), IsFixedLength: false, + // `Backtick` quoting is SQL's, not the expression service's, and ACE cannot read it — normalise + // here so every route in (SQL, or a direct caller) stores something ACE can evaluate. + CalculatedExpression: Storage.Calculated.CalculatedExpression.NormaliseIdentifierQuoting(expression), + CalculatedResultType: resultType); + + /// The descriptor's storage type: ACE widens the result type to the next in its family, which is + /// why the payload's own length is what says how to decode it (§3.4a). + internal static JetDataType PromotedType(JetDataType resultType) => resultType switch + { + JetDataType.Boolean => JetDataType.Int16, + JetDataType.Byte or JetDataType.Int16 => JetDataType.Int32, + JetDataType.Single => JetDataType.Double, + // Memo, Guid and Binary all land on Text — only their declared LENGTH tells them apart. + JetDataType.Memo or JetDataType.Guid or JetDataType.Binary => JetDataType.Text, + _ => resultType, + }; + + /// ACE's constant declared length for a calculated column, measured across every type DAO will + /// create: 0 for a Memo result, whose value lives on long-value pages; 509 for Text + /// whatever size was asked for; 510 for Binary; and 39 for everything else, GUID included. + /// None is a payload ceiling — the requested size is discarded and ACE does not truncate — and nothing + /// moves them: not the requested size, not the length of the expression. + internal static int CalculatedLength(JetDataType resultType) => resultType switch + { + JetDataType.Memo => 0, + JetDataType.Text => 509, + JetDataType.Binary => 510, + _ => 39, + }; +} /// An index to create over the named columns, anchored at an already-allocated root page. public sealed record IndexSpec( @@ -258,8 +301,12 @@ private static void ValidateIndexAndLongValueSpecs( { if (!seen.Add(value.ColumnId)) throw new NotSupportedException($"Long-value column id {value.ColumnId} has more than one usage-map entry."); + // A calculated column with a Memo result is the exception: ACE declares it Text with length 0 and + // still gives it long-value maps, so the declared type does not decide this. The reader had to + // drop the same assumption — a guard that kept it rejected the TDEF, and since the catalog loads + // every TDEF that made the whole database unopenable (§3.4a). if (!columnById.TryGetValue(value.ColumnId, out ColumnDef? column) - || column.Type is not (JetDataType.Memo or JetDataType.Ole)) + || (column.Type is not (JetDataType.Memo or JetDataType.Ole) && !column.IsCalculated)) throw new NotSupportedException( $"Long-value usage-map entry {value.ColumnId} does not identify a Memo/OLE column."); ValidateUsageMapPointer(value.UsedRow, value.MapPage, $"long-value column '{column.Name}' owned map", allowNull: false); @@ -465,7 +512,10 @@ int VarTableIndex(int i) => IsHyperlink = (rawFlags & JetFormatBase.ColumnFlagHyperlink) != 0, SupportsCompressedUnicode = s.SupportsCompressedUnicode || (rawExt & JetFormatBase.ColumnExtFlagCompressedUnicode) != 0, - IsCalculated = (rawExt & JetFormatBase.ColumnExtFlagCalculated) != 0, + IsCalculated = s.CalculatedExpression is not null + || (rawExt & JetFormatBase.ColumnExtFlagCalculated) != 0, + CalculatedExpression = s.CalculatedExpression, + CalculatedResultType = s.CalculatedResultType, SystemFlags = s.SystemFlags, Precision = s.Precision, Scale = s.Scale, diff --git a/src/LibRed/LibRed.Core/Formats/LongValueFormat.cs b/src/LibRed/LibRed.Core/Formats/LongValueFormat.cs index 022e06e4..7782abba 100644 --- a/src/LibRed/LibRed.Core/Formats/LongValueFormat.cs +++ b/src/LibRed/LibRed.Core/Formats/LongValueFormat.cs @@ -29,6 +29,10 @@ internal static void ValidateLength(int length) /// compression is applied to whatever form results, and a chained value is never compressed. public const int MaxSinglePageValue = 3816; + /// The largest payload kept inline in the row (flag ) instead of being + /// written to a long-value page. + public const int MaxInlineValue = 64; + /// Bytes in an in-row long-value descriptor. Every consumer must have all of them before /// reading any field — the descriptor arrives as a row's variable chunk, so its width is whatever the /// offset table declared, not something the column guarantees. diff --git a/src/LibRed/LibRed.Core/JetDatabase.cs b/src/LibRed/LibRed.Core/JetDatabase.cs index 0063b3a2..f9a49241 100644 --- a/src/LibRed/LibRed.Core/JetDatabase.cs +++ b/src/LibRed/LibRed.Core/JetDatabase.cs @@ -248,6 +248,8 @@ public void CreateTable( IReadOnlyList<(string Name, string Expression)>? checkConstraints = null, string? primaryKeyName = null) { + ValidateCalculated(columns, [.. columns.Select(c => c.Name)]); + EnsureFormatForCalculated(columns); new Storage.TableCreator(_channel, Catalog, Collation) .Create(name, columns, primaryKey, relationships, uniqueConstraints, columnDefaults, checkConstraints, primaryKeyName); @@ -380,8 +382,42 @@ public bool DropColumn(string table, string column) => /// Adds a column — ALTER TABLE … ADD COLUMN. Appends the descriptor/name and bumps the counts; /// existing rows read it as NULL. Returns false if the column already exists; throws for memo/OLE. - public bool AddColumn(string table, Catalog.ColumnSpec column, string? defaultValue = null) => - new Storage.TableCreator(_channel, Catalog, Collation).AddColumn(table, column, defaultValue); + public bool AddColumn(string table, Catalog.ColumnSpec column, string? defaultValue = null) + { + if (column.CalculatedExpression is not null) + { + // An added column can read the ones already there, and itself is now among them. + List visible = [.. OpenTable(table).Definition.Columns.Select(c => c.Name), column.Name]; + ValidateCalculated([column], visible); + EnsureFormatForCalculated([column]); + } + return new Storage.TableCreator(_channel, Catalog, Collation).AddColumn(table, column, defaultValue); + } + + /// Raises the file to ACE 14 when a calculated column is being created — the floor its own + /// FCMinReadVer property declares. Raising rather than refusing is what ACE does for a feature the + /// file is too old for, and is how BIGINT and DATETIME2 are already handled; it joins the + /// caller's transaction, so a failed CREATE takes the version back down with it. + private void EnsureFormatForCalculated(IReadOnlyList columns) + { + foreach (Catalog.ColumnSpec column in columns) + if (column.CalculatedExpression is not null) + { + EnsureFormatAtLeast(JetVersion.Version14_2010); + return; + } + } + + /// Validates every calculated column in against + /// before any of it is written. Runs first because the failure it prevents is + /// unrecoverable in place: a column whose expression ACE rejects cannot be read or populated at all. + private static void ValidateCalculated( + IReadOnlyList columns, IReadOnlyCollection visible) + { + foreach (Catalog.ColumnSpec column in columns) + if (column.CalculatedExpression is { } expression) + Storage.Calculated.CalculatedExpression.ParseValidated(expression, visible, column.Name); + } /// Drops an index — DROP INDEX … ON table. Removes its TDEF blocks and frees its B-tree root. /// Returns false if the index doesn't exist; throws if it backs a relationship. diff --git a/src/LibRed/LibRed.Core/Storage/Calculated/CalculatedEvaluator.cs b/src/LibRed/LibRed.Core/Storage/Calculated/CalculatedEvaluator.cs new file mode 100644 index 00000000..0e80a2c4 --- /dev/null +++ b/src/LibRed/LibRed.Core/Storage/Calculated/CalculatedEvaluator.cs @@ -0,0 +1,583 @@ +using System.Globalization; +using LibRed.Catalog; + +namespace LibRed.Storage.Calculated; + +/// +/// Evaluates a parsed calculated-column expression against one row, the way ACE does. +/// +/// +/// Only the functions ACE actually permits are implemented, and an expression using anything else +/// throws rather than guessing — a wrong cached value is invisible, because neither engine re-derives it on +/// read (page-02b §3.4a). +/// Null semantics are the point. Access propagates Null through arithmetic and comparison but +/// not through &, which treats Null as the empty string. That asymmetry is the whole +/// mechanism behind the idiom MSDN uses to introduce the feature — +/// [First] & " " & ([Middle] + " ") & [Last] — where + makes the parenthesised +/// group Null when there is no middle initial and & then drops it, so no double space appears. +/// Get the two operators the same way round and that expression silently gains a space. +/// +internal static class CalculatedEvaluator +{ + /// Evaluates ; resolves a column by name. + public static object? Evaluate(CalcNode node, Func value) => node switch + { + CalcLiteral l => l.Value, + CalcColumn c => value(c.Name), + CalcUnary u => Unary(u, value), + CalcBinary b => Binary(b, value), + CalcIsNull i => Evaluate(i.Operand, value) is null != i.Negated, + CalcIn i => In(i, value), + CalcCall f => Call(f, value), + _ => throw new CalculatedExpressionException($"Unsupported expression node {node.GetType().Name}."), + }; + + private static object? Unary(CalcUnary node, Func value) + { + object? operand = Evaluate(node.Operand, value); + if (operand is null) return null; + return node.Operator switch + { + "-" => -ToNumber(operand), + "Not" => !ToBoolean(operand), + _ => throw new CalculatedExpressionException($"Unsupported unary operator '{node.Operator}'."), + }; + } + + private static object? Binary(CalcBinary node, Func value) + { + object? left = Evaluate(node.Left, value); + object? right = Evaluate(node.Right, value); + + // '&' is the one operator that does NOT propagate Null: it concatenates it as "". + if (node.Operator == "&") return ToText(left) + ToText(right); + + if (left is null || right is null) return null; + + switch (node.Operator) + { + case "+": + { + // '+' concatenates when BOTH sides are text, and adds otherwise — the overload that makes + // it the null-propagating sibling of '&'. Adding a number to a date yields a DATE, not the + // serial underneath it, so `[D] + 1` stays a date the way ACE stores it. + if (left is string a && right is string b) return a + b; + double sum = ToNumber(left) + ToNumber(right); + return left is DateTime ^ right is DateTime ? DateTime.FromOADate(sum) : sum; + } + case "-": + return left is DateTime && right is DateTime + ? ToNumber(left) - ToNumber(right) + : left is DateTime d ? d.AddDays(-ToNumber(right)) : (object)(ToNumber(left) - ToNumber(right)); + case "*": return ToNumber(left) * ToNumber(right); + case "/": return ToNumber(left) / ToNumber(right); + case "^": return Math.Pow(ToNumber(left), ToNumber(right)); + case "And": return ToBoolean(left) && ToBoolean(right); + case "Or": return ToBoolean(left) || ToBoolean(right); + case "Like": return Like(ToText(left), ToText(right)); + case "=": case "<>": case "<": case ">": case "<=": case ">=": + { + int c = Compare(left, right); + return node.Operator switch + { + "=" => c == 0, "<>" => c != 0, "<" => c < 0, + ">" => c > 0, "<=" => c <= 0, _ => c >= 0, + }; + } + default: + throw new CalculatedExpressionException($"Unsupported operator '{node.Operator}'."); + } + } + + private static object? In(CalcIn node, Func value) + { + object? operand = Evaluate(node.Operand, value); + if (operand is null) return null; + foreach (CalcNode candidate in node.Values) + { + object? other = Evaluate(candidate, value); + if (other is not null && Compare(operand, other) == 0) return true; + } + return false; + } + + private static object? Call(CalcCall node, Func value) + { + string name = node.Name; + + // Access's Expression Builder lists the '$' name variants (Left$, Trim$, UCase$, Mid$ …) and its + // designer accepts one in a calculated column — but ACE then fails EVERY insert into that table with + // "Error evaluating CHECK constraint", while the plain name works. The column is unusable in Access + // itself, so refusing is matching it, not falling short of it. + if (name.EndsWith('$')) + throw new CalculatedExpressionException( + $"'{name}' cannot be evaluated in a calculated column. Access offers the '$' name variants and " + + $"accepts them at design time, but ACE fails every insert into such a table; use '{name[..^1]}'."); + + // IIf and Choose SHORT-CIRCUIT: only the selected branch is evaluated, matching both the Access + // expression service and LibRed.Engine's own evaluator. (Access's VBA-side IIf famously does NOT + // short circuit, but VBA is not what computes a calculated column.) This is more than an + // optimisation now that an argument can THROW rather than merely be Null — + // IIf(IsNull([x]), 0, CDbl([x])) is the way to keep CDbl away from a Null, and it only works if the + // CDbl arm never runs. + switch (name.ToUpperInvariant()) + { + case "IIF": + { + if (node.Arguments.Count != 3) + throw new CalculatedExpressionException( + $"{name} takes 3 arguments, not {node.Arguments.Count}."); + object? condition = Evaluate(node.Arguments[0], value); + return Evaluate(node.Arguments[condition is not null && ToBoolean(condition) ? 1 : 2], value); + } + case "CHOOSE": + { + if (node.Arguments.Count < 2) + throw new CalculatedExpressionException($"{name} needs at least two arguments."); + object? selector = Evaluate(node.Arguments[0], value); + if (selector is null) return null; + int index = (int)Math.Round(ToNumber(selector), MidpointRounding.ToEven); + return index >= 1 && index < node.Arguments.Count + ? Evaluate(node.Arguments[index], value) + : null; + } + } + + object?[] args = [.. node.Arguments.Select(a => Evaluate(a, value))]; + + switch (name.ToUpperInvariant()) + { + case "ISNULL": + Arity(name, args, 1); + return args[0] is null; + // VBA's IsEmpty asks whether a Variant was never initialised, which a stored column value never + // is — measured against ACE, which returns False for a column holding a value AND for one + // holding Null. It is on the whitelist but is a constant here. + case "ISEMPTY": + Arity(name, args, 1); + return false; + } + + // The VBA conversions RAISE on a Null argument instead of propagating it, and CDbl is the only + // conversion a calculated column may contain. ACE caches that failure as VBA error 94 and its own + // reader then refuses the entire row; LibRed refuses the WRITE instead — a deliberate divergence, so + // that a row neither engine can read afterwards never reaches the file and no compact-and-repair is + // needed to get rid of it (page-02e-calculated-columns). + if (args.Length > 0 && args[0] is null && name.Equals("CDbl", StringComparison.OrdinalIgnoreCase)) + throw new CalculatedExpressionException( + "CDbl cannot convert Null — the VBA conversions raise on Null rather than propagating it, so " + + "this row's cached value would be an error ACE could not read back. Give the column a " + + "value, or guard the expression, e.g. IIf(IsNull([x]), 0, CDbl([x]))."); + + // Everything else propagates Null through any argument. + if (args.Any(a => a is null)) return null; + + return name.ToUpperInvariant() switch + { + "ABS" => Math.Abs(Num(name, args, 1)), + "SGN" => (double)Math.Sign(Num(name, args, 1)), + "INT" => Math.Floor(Num(name, args, 1)), + "FIX" => Math.Truncate(Num(name, args, 1)), + "SQR" => Math.Sqrt(Num(name, args, 1)), + "EXP" => Math.Exp(Num(name, args, 1)), + "LOG" => Math.Log(Num(name, args, 1)), + "SIN" => Math.Sin(Num(name, args, 1)), + "COS" => Math.Cos(Num(name, args, 1)), + "TAN" => Math.Tan(Num(name, args, 1)), + "ATN" => Math.Atan(Num(name, args, 1)), + "CDBL" => Num(name, args, 1), + // Round is banker's rounding in VBA, and its second argument is genuinely optional here. + "ROUND" => args.Length == 1 + ? Math.Round(ToNumber(args[0]!), MidpointRounding.ToEven) + : Math.Round(ToNumber(args[0]!), (int)ToNumber(args[1]!), MidpointRounding.ToEven), + + "LEN" => (double)ToText(args[0]).Length, + "LCASE" => ToText(Single(name, args)).ToLowerInvariant(), + "UCASE" => ToText(Single(name, args)).ToUpperInvariant(), + "TRIM" => ToText(Single(name, args)).Trim(' '), + "SPACE" => new string(' ', (int)Num(name, args, 1)), + "ASC" => ToText(Single(name, args)) is { Length: > 0 } s ? (double)s[0] + : throw new CalculatedExpressionException("Asc of an empty string."), + "STR" => Str(Num(name, args, 1)), + "STRING" => Repeat(args), + "LEFT" => Take(args, name, fromLeft: true), + "RIGHT" => Take(args, name, fromLeft: false), + // Mid needs all three arguments in a calculated column, optional in VBA or not; InStr needs three + // or four but not two. A wrong count is ACE's "Syntax error in expression", NOT its policy + // refusal — measured, and the reverse of what an unknown function name gets. + "MID" => Mid(args, name), + "INSTR" => InStr(args, name), + + "YEAR" => (double)ToDate(Single(name, args)).Year, + "MONTH" => (double)ToDate(Single(name, args)).Month, + "DAY" => (double)ToDate(Single(name, args)).Day, + "HOUR" => (double)ToDate(Single(name, args)).Hour, + "MINUTE" => (double)ToDate(Single(name, args)).Minute, + "SECOND" => (double)ToDate(Single(name, args)).Second, + "WEEKDAY" => (double)(((int)ToDate(args[0]!).DayOfWeek) + 1), + "DATESERIAL" => DateSerial(args, name), + "TIMESERIAL" => TimeSerial(args, name), + "MONTHNAME" => MonthName(args, name), + "WEEKDAYNAME" => WeekdayName(args, name), + + "PMT" => Pmt(args, name), + "FV" => Fv(args, name), + "PV" => Pv(args, name), + "NPER" => NPer(args, name), + "IPMT" => IPmt(args, name), + "PPMT" => PPmt(args, name), + "RATE" => Rate(args, name), + "SLN" => Sln(args, name), + "SYD" => Syd(args, name), + "DDB" => Ddb(args, name), + + _ => throw new CalculatedExpressionException( + $"LibRed cannot evaluate '{name}' in a calculated column yet."), + }; + } + + // ---------------------------------------------------------------- function helpers + + private static void Arity(string name, object?[] args, int expected) + { + if (args.Length != expected) + throw new CalculatedExpressionException($"{name} takes {expected} arguments, not {args.Length}."); + } + + /// Arity for a function whose optional arguments really may be omitted. Which functions those + /// are is per-function and measured, not a rule: Mid and InStr demand every argument while + /// Round, Weekday, MonthName and WeekdayName do not. + private static void Arity(string name, object?[] args, int min, int max) + { + if (args.Length < min || args.Length > max) + throw new CalculatedExpressionException( + $"{name} takes {min} to {max} arguments, not {args.Length}."); + } + + private static object Single(string name, object?[] args) { Arity(name, args, 1); return args[0]!; } + + private static double Num(string name, object?[] args, int expected) + { + Arity(name, args, expected); + return ToNumber(args[0]!); + } + + /// VBA Str: invariant formatting, with a leading space for a non-negative number. + private static string Str(double value) => + (value < 0 ? "" : " ") + value.ToString("R", CultureInfo.InvariantCulture); + + private static string Repeat(object?[] args) + { + if (args.Length != 2) throw new CalculatedExpressionException("String takes two arguments."); + string s = ToText(args[1]); + if (s.Length == 0) throw new CalculatedExpressionException("String of an empty character."); + return new string(s[0], (int)ToNumber(args[0]!)); + } + + private static string Take(object?[] args, string name, bool fromLeft) + { + if (args.Length != 2) throw new CalculatedExpressionException($"{name} takes two arguments."); + string s = ToText(args[0]); + int n = Math.Clamp((int)ToNumber(args[1]!), 0, s.Length); + return fromLeft ? s[..n] : s[^n..]; + } + + private static string Mid(object?[] args, string name) + { + if (args.Length != 3) + throw new CalculatedExpressionException( + $"{name} needs all three arguments in a calculated column, even though the third is optional in VBA."); + string s = ToText(args[0]); + int start = (int)ToNumber(args[1]!); + int length = (int)ToNumber(args[2]!); + if (start < 1) throw new CalculatedExpressionException("Mid start is 1-based."); + if (start > s.Length) return ""; + return s.Substring(start - 1, Math.Clamp(length, 0, s.Length - start + 1)); + } + + /// Measured against ACE: three or four arguments, never two — InStr([A],"a") is a syntax + /// error, InStr(1,[A],"a") and InStr(1,[A],"a",0) are both accepted and both populate. With + /// compare omitted the match is case-insensitive: InStr(1,"hello","H") is 1 while an + /// explicit ,0 gives 0. That is Access's Option Compare Database default rather than VBA's + /// binary one, so defaulting to 0 the way VBA does would silently miss matches. + private static double InStr(object?[] args, string name) + { + if (args.Length is not (3 or 4)) + throw new CalculatedExpressionException( + $"{name} takes three or four arguments in a calculated column; the two-argument form VBA " + + "allows is a syntax error here."); + int start = (int)ToNumber(args[0]!); + string haystack = ToText(args[1]); + string needle = ToText(args[2]); + bool caseInsensitive = args.Length < 4 || (int)ToNumber(args[3]!) == 1; + if (start < 1) throw new CalculatedExpressionException("InStr start is 1-based."); + if (start > haystack.Length) return 0; + int found = haystack.IndexOf(needle, start - 1, + caseInsensitive ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); + return found < 0 ? 0 : found + 1; + } + + private static DateTime DateSerial(object?[] args, string name) + { + if (args.Length != 3) throw new CalculatedExpressionException($"{name} takes three arguments."); + return new DateTime((int)ToNumber(args[0]!), 1, 1) + .AddMonths((int)ToNumber(args[1]!) - 1) + .AddDays((int)ToNumber(args[2]!) - 1); + } + + private static DateTime TimeSerial(object?[] args, string name) + { + if (args.Length != 3) throw new CalculatedExpressionException($"{name} takes three arguments."); + return JetEpoch + .AddHours(ToNumber(args[0]!)) + .AddMinutes(ToNumber(args[1]!)) + .AddSeconds(ToNumber(args[2]!)); + } + + /// Access MonthName(month, [abbreviate]). Measured accepted with the optional omitted, + /// unlike Mid and InStr — the "supply every optional" rule is per-function. + private static string MonthName(object?[] args, string name) + { + Arity(name, args, 1, 2); + int month = (int)ToNumber(args[0]!); + return args.Length > 1 && ToBoolean(args[1]!) + ? EnUs.DateTimeFormat.GetAbbreviatedMonthName(month) + : EnUs.DateTimeFormat.GetMonthName(month); + } + + /// Access WeekdayName(weekday, [abbreviate], [firstDayOfWeek]), likewise measured + /// accepted with its optionals omitted. + private static string WeekdayName(object?[] args, string name) + { + Arity(name, args, 1, 3); + int weekday = (int)ToNumber(args[0]!); + int firstDay = args.Length > 2 ? (int)ToNumber(args[2]!) : 1; + if (firstDay == 0) firstDay = 1; // vbUseSystem -> vbSunday, for determinism + int index = ((((firstDay - 1) + (weekday - 1)) % 7) + 7) % 7; + string[] names = args.Length > 1 && ToBoolean(args[1]!) + ? EnUs.DateTimeFormat.AbbreviatedDayNames + : EnUs.DateTimeFormat.DayNames; + return names[index]; + } + + // ---------------------------------------------------------------- financial + // + // All ten of these are on ACE's calculated-column whitelist. They are ported from LibRed.Engine's + // ExpressionEvaluator rather than re-derived, so a formula cannot answer one way through SQL and another + // through a calculated column. Two copies exist only because of the layering: this evaluation happens in + // Core at row-encode time, and Core cannot reach Engine (docs/format/page-02e-calculated-columns.md). + + private static double Pow1(double rate, double nper) => Math.Pow(1 + rate, nper); + + private static double AnnuityFactor(double rate, double nper, double type) + => (1 + rate * type) * (Pow1(rate, nper) - 1) / rate; + + private static double PaymentOf(double rate, double nper, double pv, double fv, double type) + => rate == 0 ? -(pv + fv) / nper : -(pv * Pow1(rate, nper) + fv) / AnnuityFactor(rate, nper, type); + + private static double InterestOf(double rate, double per, double nper, double pv, double fv, double type) + { + if (type == 1 && per == 1) return 0; + double pmt = PaymentOf(rate, nper, pv, fv, type); + double balance = pv * Pow1(rate, per - 1) + + pmt * (rate == 0 ? per - 1 : AnnuityFactor(rate, per - 1, type)); + double interest = -balance * rate; // an outflow, so negative like Pmt itself + return type == 1 ? interest / (1 + rate) : interest; + } + + /// VBA Pmt(rate, nper, pv, [fv], [type]): the constant payment for an annuity. + private static double Pmt(object?[] args, string name) + { + Arity(name, args, 3, 5); + return PaymentOf(Fin(args, 0), Fin(args, 1), Fin(args, 2), Fin(args, 3, 0), Fin(args, 4, 0)); + } + + /// VBA FV(rate, nper, pmt, [pv], [type]): the future value of an annuity. + private static double Fv(object?[] args, string name) + { + Arity(name, args, 3, 5); + double rate = Fin(args, 0), nper = Fin(args, 1), pmt = Fin(args, 2), + pv = Fin(args, 3, 0), type = Fin(args, 4, 0); + return rate == 0 + ? -(pv + pmt * nper) + : -(pv * Pow1(rate, nper) + pmt * AnnuityFactor(rate, nper, type)); + } + + /// VBA PV(rate, nper, pmt, [fv], [type]): the present value of an annuity. + private static double Pv(object?[] args, string name) + { + Arity(name, args, 3, 5); + double rate = Fin(args, 0), nper = Fin(args, 1), pmt = Fin(args, 2), + fv = Fin(args, 3, 0), type = Fin(args, 4, 0); + return rate == 0 + ? -(fv + pmt * nper) + : -(fv + pmt * AnnuityFactor(rate, nper, type)) / Pow1(rate, nper); + } + + /// VBA NPer(rate, pmt, pv, [fv], [type]): the number of periods for an annuity. + private static double NPer(object?[] args, string name) + { + Arity(name, args, 3, 5); + double rate = Fin(args, 0), pmt = Fin(args, 1), pv = Fin(args, 2), + fv = Fin(args, 3, 0), type = Fin(args, 4, 0); + if (rate == 0) return -(pv + fv) / pmt; + double a = pmt * (1 + rate * type); + return Math.Log((a - fv * rate) / (a + pv * rate)) / Math.Log(1 + rate); + } + + /// VBA IPmt(rate, per, nper, pv, [fv], [type]): the interest portion of one payment. + private static double IPmt(object?[] args, string name) + { + Arity(name, args, 4, 6); + return InterestOf( + Fin(args, 0), Fin(args, 1), Fin(args, 2), Fin(args, 3), Fin(args, 4, 0), Fin(args, 5, 0)); + } + + /// VBA PPmt(rate, per, nper, pv, [fv], [type]): the principal portion, Pmt minus IPmt. + private static double PPmt(object?[] args, string name) + { + Arity(name, args, 4, 6); + double rate = Fin(args, 0), nper = Fin(args, 2), pv = Fin(args, 3), + fv = Fin(args, 4, 0), type = Fin(args, 5, 0); + return PaymentOf(rate, nper, pv, fv, type) - InterestOf(rate, Fin(args, 1), nper, pv, fv, type); + } + + /// VBA SLN(cost, salvage, life): straight-line depreciation. + private static double Sln(object?[] args, string name) + { + Arity(name, args, 3); + return (Fin(args, 0) - Fin(args, 1)) / Fin(args, 2); + } + + /// VBA SYD(cost, salvage, life, period): sum-of-years'-digits depreciation. + private static double Syd(object?[] args, string name) + { + Arity(name, args, 4); + double life = Fin(args, 2); + return (Fin(args, 0) - Fin(args, 1)) * (life - Fin(args, 3) + 1) / (life * (life + 1) / 2); + } + + /// VBA DDB(cost, salvage, life, period, [factor]): double-declining-balance depreciation, + /// clamped so the book value never drops below salvage. + private static double Ddb(object?[] args, string name) + { + Arity(name, args, 4, 5); + double cost = Fin(args, 0), salvage = Fin(args, 1), period = Fin(args, 3); + double rate = Fin(args, 4, 2) / Fin(args, 2); + double bookStart = cost * Math.Pow(1 - rate, period - 1); + double depreciation = bookStart * rate; + return bookStart - depreciation < salvage ? Math.Max(0, bookStart - salvage) : depreciation; + } + + /// VBA Rate(nper, pmt, pv, [fv], [type], [guess]): the per-period rate. There is no closed + /// form, so it is solved by Newton-Raphson on the annuity equation, from the caller's guess. + private static double Rate(object?[] args, string name) + { + Arity(name, args, 3, 6); + double nper = Fin(args, 0), pmt = Fin(args, 1), pv = Fin(args, 2), + fv = Fin(args, 3, 0), type = Fin(args, 4, 0); + double r = Fin(args, 5, 0.1); + + for (int iteration = 0; iteration < 100; iteration++) + { + const double step = 1e-6; + double value = Annuity(r); + double derivative = (Annuity(r + step) - value) / step; + if (Math.Abs(derivative) < 1e-12) break; + double next = r - value / derivative; + if (Math.Abs(next - r) < 1e-10) return next; + r = next; + } + return r; + + double Annuity(double rate) => rate == 0 + ? pv + pmt * nper + fv + : pv * Pow1(rate, nper) + pmt * (1 + rate * type) * (Pow1(rate, nper) - 1) / rate + fv; + } + + private static double Fin(object?[] args, int index) => ToNumber(args[index]!); + + private static double Fin(object?[] args, int index, double fallback) + => args.Length > index ? ToNumber(args[index]!) : fallback; + + // ---------------------------------------------------------------- coercion + + /// Month and day names come from a fixed en-US, not the ambient culture: the value is written + /// into the file, so it must not depend on who wrote the row. + private static readonly CultureInfo EnUs = CultureInfo.GetCultureInfo("en-US"); + + /// The OLE Automation epoch Jet dates count from (see the heritage note in CLAUDE.md). + private static readonly DateTime JetEpoch = new(1899, 12, 30); + + private static double ToNumber(object value) => value switch + { + double d => d, + float f => f, + decimal m => (double)m, + bool b => b ? -1 : 0, // VARIANT_TRUE is -1, not 1 + DateTime t => t.ToOADate(), + string s when double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out double parsed) => parsed, + byte or short or int or long => Convert.ToDouble(value, CultureInfo.InvariantCulture), + _ => throw new CalculatedExpressionException($"Cannot use '{value}' as a number."), + }; + + private static bool ToBoolean(object value) => value is bool b ? b : ToNumber(value) != 0; + + private static string ToText(object? value) => value switch + { + null => "", + string s => s, + bool b => b ? "True" : "False", + DateTime d => d.ToString(CultureInfo.InvariantCulture), + _ => Convert.ToString(value, CultureInfo.InvariantCulture) ?? "", + }; + + private static DateTime ToDate(object value) => value is DateTime d ? d : DateTime.FromOADate(ToNumber(value)); + + private static int Compare(object left, object right) + { + if (left is string || right is string) + return string.Compare(ToText(left), ToText(right), StringComparison.OrdinalIgnoreCase); + if (left is DateTime || right is DateTime) + return ToDate(left).CompareTo(ToDate(right)); + return ToNumber(left).CompareTo(ToNumber(right)); + } + + /// Access Like: * any run, ? one character, # one digit. + private static bool Like(string text, string pattern) + { + var regex = new System.Text.StringBuilder("^"); + foreach (char c in pattern) + regex.Append(c switch + { + '*' => ".*", + '?' => ".", + '#' => "[0-9]", + _ => System.Text.RegularExpressions.Regex.Escape(c.ToString()), + }); + regex.Append('$'); + return System.Text.RegularExpressions.Regex.IsMatch( + text, regex.ToString(), System.Text.RegularExpressions.RegexOptions.IgnoreCase); + } + + /// Coerces an evaluated result to the column's ResultType, which is what the payload is + /// encoded in. + public static object? Coerce(object? value, JetDataType type) + { + if (value is null) return null; + return type switch + { + JetDataType.Boolean => ToBoolean(value), + JetDataType.Byte => (byte)Math.Round(ToNumber(value), MidpointRounding.ToEven), + JetDataType.Int16 => (short)Math.Round(ToNumber(value), MidpointRounding.ToEven), + JetDataType.Int32 => (int)Math.Round(ToNumber(value), MidpointRounding.ToEven), + JetDataType.Int64 => (long)Math.Round(ToNumber(value), MidpointRounding.ToEven), + JetDataType.Single => (float)ToNumber(value), + JetDataType.Double => ToNumber(value), + JetDataType.Currency => Math.Round((decimal)ToNumber(value), 4, MidpointRounding.ToEven), + JetDataType.DateTime => ToDate(value), + JetDataType.Text or JetDataType.Memo => ToText(value), + _ => throw new CalculatedExpressionException($"Cannot store a calculated {type} value."), + }; + } +} diff --git a/src/LibRed/LibRed.Core/Storage/Calculated/CalculatedExpression.cs b/src/LibRed/LibRed.Core/Storage/Calculated/CalculatedExpression.cs new file mode 100644 index 00000000..f240eeb6 --- /dev/null +++ b/src/LibRed/LibRed.Core/Storage/Calculated/CalculatedExpression.cs @@ -0,0 +1,533 @@ +using System.Globalization; + +namespace LibRed.Storage.Calculated; + +/// A parsed calculated-column expression (spec: page-02b §3.4a). +internal abstract record CalcNode; + +/// A literal: number, string, #date#, True/False, or Null. +internal sealed record CalcLiteral(object? Value) : CalcNode; + +/// A reference to another column of the same row — [Name] or a bare identifier. +internal sealed record CalcColumn(string Name) : CalcNode; + +internal sealed record CalcUnary(string Operator, CalcNode Operand) : CalcNode; + +internal sealed record CalcBinary(string Operator, CalcNode Left, CalcNode Right) : CalcNode; + +internal sealed record CalcCall(string Name, IReadOnlyList Arguments) : CalcNode; + +/// x Is Null / x Is Not Null. +internal sealed record CalcIsNull(CalcNode Operand, bool Negated) : CalcNode; + +/// x In (a, b, ...). +internal sealed record CalcIn(CalcNode Operand, IReadOnlyList Values) : CalcNode; + +/// +/// Parses the Access expression subset ACE permits in a calculated column. This is deliberately its own +/// small parser rather than a reuse of LibRed.Sql: the dependency runs Engine → Core, the value has +/// to be produced at row-encode time down here, and the language is a different (much smaller) one than +/// Access SQL — a fixed whitelist ACE will not extend, since a calculated field cannot call a user-defined +/// function. +/// +/// +/// Precedence follows VBA, loosest first: Or, And, Not, comparison (including +/// Like, Is Null and In), &, + -, * /, unary minus, ^. +/// Concatenation binding tighter than comparison but looser than arithmetic is what makes +/// [A] & "x" = "yx" parse as ([A] & "x") = "yx". +/// +internal static class CalculatedExpression +{ + private static readonly System.Collections.Concurrent.ConcurrentDictionary Cache = new(StringComparer.Ordinal); + + /// Parses , reusing an earlier parse of the same text. Every row written + /// to a table re-evaluates its calculated columns, so the parse must not be repeated per row. + public static CalcNode ParseCached(string text) => Cache.GetOrAdd(text, Parse); + + /// Parses , or throws . + public static CalcNode Parse(string text) + { + var tokens = Tokenise(text); + int position = 0; + CalcNode node = ParseOr(tokens, ref position); + if (position < tokens.Count) + throw new CalculatedExpressionException($"Unexpected '{tokens[position].Text}' in expression."); + return node; + } + + /// Every column the expression reads, which is what decides whether an UPDATE must recompute. + /// Every function ACE accepts in a calculated column. Measured over all 147 candidates rather + /// than derived: "deterministic, row-local, no I/O" explains the big exclusions but not the edges, where + /// Trim is in and LTrim/RTrim are out, Asc is in and Chr is out, and + /// CDbl is the only conversion of the ten. Independently confirmed against the list Access's own + /// Expression Builder offers. + private static readonly HashSet Accepted = new(StringComparer.OrdinalIgnoreCase) + { + "Abs", "Sgn", "Int", "Fix", "Round", "Sqr", "Exp", "Log", "Sin", "Cos", "Tan", "Atn", + "Len", "LCase", "UCase", "Trim", "Left", "Right", "Mid", "InStr", "Space", "String", "Str", "Asc", + "DateSerial", "TimeSerial", "Year", "Month", "Day", "Hour", "Minute", "Second", "Weekday", + "MonthName", "WeekdayName", + "IIf", "Choose", "IsNull", "IsEmpty", "CDbl", + "Pmt", "FV", "PV", "NPer", "Rate", "IPmt", "PPmt", "SLN", "SYD", "DDB", + }; + + /// Parses and checks it is one ACE would accept for a column named + /// over . + /// Validation is mandatory before writing, not a courtesy: an expression ACE rejects does not + /// produce a merely odd file, it produces a column ACE refuses to read at all — every SELECT of it raises + /// "This calculated column contains an invalid expression", and every INSERT leaves the value empty. + /// Proved by patching the stored property text behind DAO's back (§3.4a). + public static CalcNode ParseValidated(string expression, IReadOnlyCollection columns, string self) + { + CalcNode root = Parse(expression); + Check(root); + return root; + + void Check(CalcNode node) + { + switch (node) + { + case CalcColumn c when string.Equals(c.Name, self, StringComparison.OrdinalIgnoreCase): + throw new CalculatedExpressionException( + "The expression cannot be saved because it refers to itself."); + case CalcColumn c when !columns.Any(n => string.Equals(n, c.Name, StringComparison.OrdinalIgnoreCase)): + throw new CalculatedExpressionException( + $"The expression cannot be saved because it refers to another table: '{c.Name}' is not " + + "a column of this one."); + // Access's designer offers the '$' name variants and accepts them, but ACE then fails every + // insert into the table -- so a column using one can never be populated (§3.4a). + case CalcCall f when f.Name.EndsWith('$'): + throw new CalculatedExpressionException( + $"The expression {f.Name} cannot be used in a calculated column. Access accepts the '$' " + + $"name variants at design time but cannot populate such a column; use '{f.Name[..^1]}'."); + case CalcCall f when !Accepted.Contains(f.Name): + throw new CalculatedExpressionException( + $"The expression {f.Name} cannot be used in a calculated column."); + } + + foreach (CalcNode child in Children(node)) Check(child); + } + + static IEnumerable Children(CalcNode node) => node switch + { + CalcUnary u => [u.Operand], + CalcBinary b => [b.Left, b.Right], + CalcIsNull i => [i.Operand], + CalcIn i => [i.Operand, .. i.Values], + CalcCall f => f.Arguments, + _ => [], + }; + } + + /// Rewrites `backtick`-quoted identifiers into the [bracket] form Access's + /// expression service understands, leaving the rest of the text alone. + /// SQL quotes identifiers with backticks — it is what EF Core's Jet provider emits — but the + /// expression service is not the SQL parser and does not know them. Measured: ACE reads + /// `Qty`*2 as a reference to a field literally named `Qty` and fails with "Could not find + /// field". A backtick expression therefore has to be translated on the way in; storing it verbatim would + /// author a column ACE cannot evaluate. + public static string NormaliseIdentifierQuoting(string expression) + { + if (!expression.Contains('`', StringComparison.Ordinal)) return expression; + + var result = new System.Text.StringBuilder(expression.Length); + int i = 0; + while (i < expression.Length) + { + char c = expression[i]; + if (c is '"' or '\'' or '#') // a literal: copy through to its closing mark + { + result.Append(c); + for (i++; i < expression.Length; i++) + { + result.Append(expression[i]); + if (expression[i] == c) { i++; break; } + } + continue; + } + if (c == '[' && expression.IndexOf(']', i + 1) is var bracket && bracket > i) + { + result.Append(expression[i..(bracket + 1)]); // already bracketed: leave exactly as written + i = bracket + 1; + continue; + } + if (c == '`' && expression.IndexOf('`', i + 1) is var tick && tick > i) + { + result.Append('[').Append(expression[(i + 1)..tick]).Append(']'); + i = tick + 1; + continue; + } + result.Append(c); + i++; + } + return result.ToString(); + } + + /// Repoints every reference to at , leaving + /// the rest of the text byte-identical. Renaming a column a calculated expression reads without this + /// leaves a dangling reference, and ACE then fails every read of that column — the table is effectively + /// broken by an operation that looked unrelated. + /// Textual rather than a re-emit from the parse tree, because the parse tree cannot reproduce the + /// author's spacing or bracketing. It walks the same lexical structure the tokeniser does, so a name + /// inside a string or #date# literal is left alone, and a bare word followed by ( is a + /// function call rather than a column. + public static string RenameColumnReference(string expression, string oldName, string newName) + { + var result = new System.Text.StringBuilder(expression.Length); + int i = 0; + while (i < expression.Length) + { + char c = expression[i]; + if (c is '"' or '\'' or '#') // a literal: copy through to its closing mark + { + result.Append(c); + for (i++; i < expression.Length; i++) + { + result.Append(expression[i]); + if (expression[i] == c) { i++; break; } + } + continue; + } + if (c == '[' && expression.IndexOf(']', i + 1) is var close && close > i) + { + string inner = expression[(i + 1)..close]; + result.Append('[') + .Append(Matches(inner) ? newName : inner) + .Append(']'); + i = close + 1; + continue; + } + if (char.IsLetter(c) || c == '_') + { + int start = i; + while (i < expression.Length && (char.IsLetterOrDigit(expression[i]) || expression[i] is '_' or '$')) i++; + string word = expression[start..i]; + int after = i; + while (after < expression.Length && char.IsWhiteSpace(expression[after])) after++; + bool isCall = after < expression.Length && expression[after] == '('; + result.Append(!isCall && Matches(word) ? Bracketed(newName) : word); + continue; + } + result.Append(c); + i++; + } + return result.ToString(); + + bool Matches(string candidate) => string.Equals(candidate, oldName, StringComparison.OrdinalIgnoreCase); + + // A bare reference can only stay bare if the new name is still a plain identifier. + static string Bracketed(string name) => + name.Length > 0 && (char.IsLetter(name[0]) || name[0] == '_') + && name.All(ch => char.IsLetterOrDigit(ch) || ch == '_') + ? name : $"[{name}]"; + } + + public static IReadOnlySet ReferencedColumns(CalcNode node) + { + var names = new HashSet(StringComparer.OrdinalIgnoreCase); + Walk(node); + return names; + + void Walk(CalcNode n) + { + switch (n) + { + case CalcColumn c: names.Add(c.Name); break; + case CalcUnary u: Walk(u.Operand); break; + case CalcBinary b: Walk(b.Left); Walk(b.Right); break; + case CalcCall f: foreach (CalcNode a in f.Arguments) Walk(a); break; + case CalcIsNull i: Walk(i.Operand); break; + case CalcIn i: Walk(i.Operand); foreach (CalcNode v in i.Values) Walk(v); break; + } + } + } + + // ---------------------------------------------------------------- parsing + + private static CalcNode ParseOr(List t, ref int p) + { + CalcNode left = ParseAnd(t, ref p); + while (IsKeyword(t, p, "Or")) { p++; left = new CalcBinary("Or", left, ParseAnd(t, ref p)); } + return left; + } + + private static CalcNode ParseAnd(List t, ref int p) + { + CalcNode left = ParseNot(t, ref p); + while (IsKeyword(t, p, "And")) { p++; left = new CalcBinary("And", left, ParseNot(t, ref p)); } + return left; + } + + private static CalcNode ParseNot(List t, ref int p) + { + if (!IsKeyword(t, p, "Not")) return ParseComparison(t, ref p); + p++; + return new CalcUnary("Not", ParseNot(t, ref p)); + } + + private static CalcNode ParseComparison(List t, ref int p) + { + CalcNode left = ParseConcat(t, ref p); + while (true) + { + if (IsKeyword(t, p, "Is")) + { + p++; + bool negated = IsKeyword(t, p, "Not"); + if (negated) p++; + Expect(t, ref p, "Null", TokenKind.Keyword); + left = new CalcIsNull(left, negated); + } + else if (IsKeyword(t, p, "Like")) + { + p++; + left = new CalcBinary("Like", left, ParseConcat(t, ref p)); + } + else if (IsKeyword(t, p, "In")) + { + p++; + Expect(t, ref p, "(", TokenKind.Punctuation); + var values = new List { ParseOr(t, ref p) }; + while (IsPunctuation(t, p, ",")) { p++; values.Add(ParseOr(t, ref p)); } + Expect(t, ref p, ")", TokenKind.Punctuation); + left = new CalcIn(left, values); + } + else if (p < t.Count && t[p].Kind == TokenKind.Operator + && t[p].Text is "=" or "<>" or "<" or ">" or "<=" or ">=") + { + string op = t[p].Text; + p++; + left = new CalcBinary(op, left, ParseConcat(t, ref p)); + } + else return left; + } + } + + private static CalcNode ParseConcat(List t, ref int p) + { + CalcNode left = ParseAdditive(t, ref p); + while (IsOperator(t, p, "&")) { p++; left = new CalcBinary("&", left, ParseAdditive(t, ref p)); } + return left; + } + + private static CalcNode ParseAdditive(List t, ref int p) + { + CalcNode left = ParseMultiplicative(t, ref p); + while (p < t.Count && t[p].Kind == TokenKind.Operator && t[p].Text is "+" or "-") + { + string op = t[p].Text; + p++; + left = new CalcBinary(op, left, ParseMultiplicative(t, ref p)); + } + return left; + } + + private static CalcNode ParseMultiplicative(List t, ref int p) + { + CalcNode left = ParseUnary(t, ref p); + while (p < t.Count && t[p].Kind == TokenKind.Operator && t[p].Text is "*" or "/") + { + string op = t[p].Text; + p++; + left = new CalcBinary(op, left, ParseUnary(t, ref p)); + } + return left; + } + + private static CalcNode ParseUnary(List t, ref int p) + { + if (IsOperator(t, p, "-")) { p++; return new CalcUnary("-", ParseUnary(t, ref p)); } + if (IsOperator(t, p, "+")) { p++; return ParseUnary(t, ref p); } + return ParsePower(t, ref p); + } + + // Right-associative, and binds tighter than unary minus: -2^2 is -4. + private static CalcNode ParsePower(List t, ref int p) + { + CalcNode left = ParsePrimary(t, ref p); + if (!IsOperator(t, p, "^")) return left; + p++; + return new CalcBinary("^", left, ParseUnary(t, ref p)); + } + + private static CalcNode ParsePrimary(List t, ref int p) + { + if (p >= t.Count) throw new CalculatedExpressionException("Expression ended unexpectedly."); + Token token = t[p]; + + switch (token.Kind) + { + case TokenKind.Number: + p++; + return new CalcLiteral(double.Parse(token.Text, CultureInfo.InvariantCulture)); + + case TokenKind.String: + p++; + return new CalcLiteral(token.Text); + + case TokenKind.Date: + p++; + return new CalcLiteral(ParseDateLiteral(token.Text)); + + case TokenKind.Bracketed: + p++; + return new CalcColumn(token.Text); + + case TokenKind.Punctuation when token.Text == "(": + { + p++; + CalcNode inner = ParseOr(t, ref p); + Expect(t, ref p, ")", TokenKind.Punctuation); + return inner; + } + + case TokenKind.Keyword or TokenKind.Identifier: + { + if (token.Text.Equals("True", StringComparison.OrdinalIgnoreCase)) { p++; return new CalcLiteral(true); } + if (token.Text.Equals("False", StringComparison.OrdinalIgnoreCase)) { p++; return new CalcLiteral(false); } + if (token.Text.Equals("Null", StringComparison.OrdinalIgnoreCase)) { p++; return new CalcLiteral(null); } + + p++; + if (!IsPunctuation(t, p, "(")) return new CalcColumn(token.Text); + + p++; // the '(' + var args = new List(); + if (!IsPunctuation(t, p, ")")) + { + args.Add(ParseOr(t, ref p)); + while (IsPunctuation(t, p, ",")) { p++; args.Add(ParseOr(t, ref p)); } + } + Expect(t, ref p, ")", TokenKind.Punctuation); + return new CalcCall(token.Text, args); + } + + default: + throw new CalculatedExpressionException($"Unexpected '{token.Text}' in expression."); + } + } + + private static DateTime ParseDateLiteral(string text) => + DateTime.TryParse(text, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime value) + ? value + : throw new CalculatedExpressionException($"'#{text}#' is not a valid date literal."); + + private static bool IsKeyword(List t, int p, string word) => + p < t.Count && (t[p].Kind is TokenKind.Keyword or TokenKind.Identifier) + && string.Equals(t[p].Text, word, StringComparison.OrdinalIgnoreCase); + + private static bool IsOperator(List t, int p, string op) => + p < t.Count && t[p].Kind == TokenKind.Operator && t[p].Text == op; + + private static bool IsPunctuation(List t, int p, string text) => + p < t.Count && t[p].Kind == TokenKind.Punctuation && t[p].Text == text; + + private static void Expect(List t, ref int p, string text, TokenKind kind) + { + bool ok = p < t.Count + && (kind == TokenKind.Keyword + ? t[p].Kind is TokenKind.Keyword or TokenKind.Identifier + : t[p].Kind == kind) + && string.Equals(t[p].Text, text, StringComparison.OrdinalIgnoreCase); + if (!ok) + throw new CalculatedExpressionException( + $"Expected '{text}' but found {(p < t.Count ? $"'{t[p].Text}'" : "the end of the expression")}."); + p++; + } + + // ---------------------------------------------------------------- tokenising + + private enum TokenKind { Number, String, Date, Bracketed, Identifier, Keyword, Operator, Punctuation } + + private readonly record struct Token(TokenKind Kind, string Text); + + private static readonly string[] Keywords = ["And", "Or", "Not", "Is", "Null", "Like", "In", "True", "False"]; + + private static List Tokenise(string text) + { + var tokens = new List(); + int i = 0; + while (i < text.Length) + { + char c = text[i]; + if (char.IsWhiteSpace(c)) { i++; continue; } + + if (c == '[') + { + int end = text.IndexOf(']', i + 1); + if (end < 0) throw new CalculatedExpressionException("Unclosed '[' in expression."); + tokens.Add(new Token(TokenKind.Bracketed, text[(i + 1)..end])); + i = end + 1; + } + else if (c == '"') + { + var value = new System.Text.StringBuilder(); + i++; + while (true) + { + if (i >= text.Length) throw new CalculatedExpressionException("Unterminated string in expression."); + if (text[i] == '"') + { + if (i + 1 < text.Length && text[i + 1] == '"') { value.Append('"'); i += 2; continue; } + i++; + break; + } + value.Append(text[i++]); + } + tokens.Add(new Token(TokenKind.String, value.ToString())); + } + else if (c == '#') + { + int end = text.IndexOf('#', i + 1); + if (end < 0) throw new CalculatedExpressionException("Unclosed '#' in expression."); + tokens.Add(new Token(TokenKind.Date, text[(i + 1)..end])); + i = end + 1; + } + else if (char.IsDigit(c) || (c == '.' && i + 1 < text.Length && char.IsDigit(text[i + 1]))) + { + int start = i; + while (i < text.Length && (char.IsDigit(text[i]) || text[i] == '.')) i++; + if (i < text.Length && (text[i] is 'e' or 'E')) + { + i++; + if (i < text.Length && (text[i] is '+' or '-')) i++; + while (i < text.Length && char.IsDigit(text[i])) i++; + } + tokens.Add(new Token(TokenKind.Number, text[start..i])); + } + else if (char.IsLetter(c) || c == '_') + { + int start = i; + while (i < text.Length && (char.IsLetterOrDigit(text[i]) || text[i] == '_')) i++; + // A trailing '$' is part of the name (Left$, Trim$ …). Access's Expression Builder offers + // these and its designer accepts them, so they DO occur in real files — but the engine + // cannot evaluate one, and the evaluator says so rather than the tokeniser reporting a + // stray character. + if (i < text.Length && text[i] == '$') i++; + string word = text[start..i]; + bool keyword = Keywords.Contains(word, StringComparer.OrdinalIgnoreCase); + tokens.Add(new Token(keyword ? TokenKind.Keyword : TokenKind.Identifier, word)); + } + else if (c is '<' or '>' && i + 1 < text.Length && (text[i + 1] is '=' or '>')) + { + tokens.Add(new Token(TokenKind.Operator, text[i..(i + 2)])); + i += 2; + } + else if (c is '+' or '-' or '*' or '/' or '^' or '&' or '=' or '<' or '>') + { + tokens.Add(new Token(TokenKind.Operator, c.ToString())); + i++; + } + else if (c is '(' or ')' or ',') + { + tokens.Add(new Token(TokenKind.Punctuation, c.ToString())); + i++; + } + else throw new CalculatedExpressionException($"Unexpected character '{c}' in expression."); + } + return tokens; + } +} + +/// A calculated-column expression LibRed cannot parse, or cannot evaluate the way ACE would. +/// Never thrown for a value: a row that fails to evaluate must not be written at all. +public sealed class CalculatedExpressionException(string message) : InvalidOperationException(message); diff --git a/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs b/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs index 8e4b5279..6758f57f 100644 --- a/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs +++ b/src/LibRed/LibRed.Core/Storage/CalculatedValue.cs @@ -8,8 +8,12 @@ namespace LibRed.Storage; /// "Calculated columns"). A calculated column is always variable-length, and its slot holds a fixed /// header rather than a bare value: /// -/// [reserved:16] [payloadLength:4] [payload:n] [padding:3] +/// [status:4] [reserved:12] [payloadLength:4] [payload:n] [padding:3] /// +/// Status is not reserved. Zero means the expression produced a value; anything else is the VBA +/// error number it raised, and there is no payload — which is a different thing from Null, even though both +/// have an empty payload. The conversions raise rather than propagating, so CDbl(Null) caches 94 +/// ("invalid use of Null") where [Qty]/3 over the same Null row caches a plain Null. /// The payload is the value in its ordinary on-disk encoding for the column's declared type, so it goes /// straight to — text keeps the usual compressed/raw UTF-16 choice. /// When the column also owns a long-value map (a calculated Memo), the slot is a long-value descriptor @@ -17,9 +21,14 @@ namespace LibRed.Storage; /// internal static class CalculatedValue { - /// Reserved bytes before the length; zero in every file measured. + /// Header bytes before the length: a 4-byte status followed by 12 reserved bytes that are zero + /// in every file measured. private const int HeaderSize = 16; + /// The status field's size. Zero is the success code; anything else is a VBA runtime error + /// number, and the expression produced no value at all. + private const int StatusSize = 4; + /// Little-endian payload length. private const int LengthSize = 4; @@ -29,29 +38,169 @@ internal static class CalculatedValue /// The smallest envelope: header, length and padding with an empty payload. public const int MinimumSize = HeaderSize + LengthSize + PaddingSize; + /// Evaluates a calculated column's expression against one row and coerces the result to the + /// type its payload is stored in. + public static object? Evaluate(ColumnDef column, IReadOnlyList columns, object?[] values) + { + if (column.CalculatedExpression is not { Length: > 0 } text) + throw new Calculated.CalculatedExpressionException( + $"Calculated column '{column.Name}' has no stored expression, so its value cannot be recomputed. " + + "The table's property blob is missing or damaged."); + + object? result = Calculated.CalculatedEvaluator.Evaluate( + Calculated.CalculatedExpression.ParseCached(text), + name => Lookup(column, columns, values, name)); + + return Calculated.CalculatedEvaluator.Coerce(result, StoredType(column, 0)); + } + + /// The of every column the expression reads. An UPDATE recomputes + /// only when one of these is in its changed set — ACE leaves the cached value alone otherwise, and + /// recomputing anyway would write bytes it never would (§3.4a). + public static IReadOnlySet ReferencedIndexes(ColumnDef column, IReadOnlyList columns) + { + var indexes = new HashSet(); + if (column.CalculatedExpression is not { Length: > 0 } text) return indexes; + + foreach (string name in Calculated.CalculatedExpression.ReferencedColumns( + Calculated.CalculatedExpression.ParseCached(text))) + foreach (ColumnDef candidate in columns) + if (string.Equals(candidate.Name, name, StringComparison.OrdinalIgnoreCase)) + indexes.Add(candidate.Index); + return indexes; + } + + private static object? Lookup(ColumnDef column, IReadOnlyList columns, object?[] values, string name) + { + foreach (ColumnDef candidate in columns) + if (string.Equals(candidate.Name, name, StringComparison.OrdinalIgnoreCase)) + return candidate.Index < values.Length ? values[candidate.Index] : null; + + throw new Calculated.CalculatedExpressionException( + $"Calculated column '{column.Name}' refers to '{name}', which this table does not have."); + } + + /// Builds the envelope for — the inverse of + /// . A Null result is a zero-length payload, not an absent one: the column's + /// null-bitmap bit stays set either way (§3.4a). + public static byte[] Encode(ColumnDef column, object? value) + { + JetDataType type = StoredType(column, 0); + byte[] payload = value is null ? [] : EncodePayload(column, type, value); + + var envelope = new byte[MinimumSize + payload.Length]; + BinaryPrimitives.WriteUInt32LittleEndian(envelope.AsSpan(HeaderSize, LengthSize), (uint)payload.Length); + payload.CopyTo(envelope.AsSpan(HeaderSize + LengthSize)); + return envelope; + } + + /// Two payloads the ordinary codec would get wrong. + /// Boolean: a real Boolean column carries its value in the null bitmap and never reaches the + /// codec, so the codec has no Boolean case. A calculated one stores a single byte inside the envelope — + /// FF or 00. + /// Text: ACE compresses a calculated Text column's payload even though the column's + /// extended flags carry 0xC0 (calculated) and not 0x01 (compressed-Unicode capable), so the + /// capable flag must not gate it — the same exemption inline long values already get. The + /// under-three-character rule still applies and is ACE's: "hello-x" compresses, "-x" stays + /// UTF-16. + /// A calculated Memo — the one carrying a long-value map — is never compressed, + /// whatever its length, and folding Memo onto Text is what hid that. Measured: + /// ACE stores "hello-memo" as 20 bytes of UTF-16 in a Memo column and "hello-x" as 9 + /// compressed bytes in a Text one. It decides more than the bytes, because compressing shrinks the + /// envelope back under the 64-byte inline limit and so decides whether the value reaches a page at all. + /// + /// + private static byte[] EncodePayload(ColumnDef column, JetDataType type, object value) + { + var culture = System.Globalization.CultureInfo.InvariantCulture; + switch (type) + { + case JetDataType.Boolean: + return [Convert.ToBoolean(value, culture) ? (byte)0xFF : (byte)0x00]; + case JetDataType.Text: + { + string text = Convert.ToString(value, culture) ?? ""; + byte[] utf16 = System.Text.Encoding.Unicode.GetBytes(text); + if (column.HasLongValueMap) return utf16; // a calculated Memo: never compressed + return Types.JetTypeCodec.TryCompressText(column, text, requireCapableFlag: false) ?? utf16; + } + default: + return Types.JetTypeCodec.Encode(column, type, value); + } + } + /// Decodes the cached result inside , or null when the - /// expression evaluated to Null (ACE stores that as a zero-length payload, not a cleared null bit). + /// expression evaluated to Null (ACE stores that as a zero-length payload, not a cleared null bit). + /// Throws when the cached state is an error rather than a value. public static object? Decode(ColumnDef column, ReadOnlySpan envelope) { + // A failed expression is cached as its VBA error number with no payload, so it is NOT a Null even + // though it has a Null's empty payload -- and reading it as one is a silent wrong answer, on a value + // neither engine re-derives. ACE will not hand back such a row at all. + if (Status(envelope) is not 0 and var error) + throw new Calculated.CalculatedExpressionException( + $"Calculated column '{column.Name}' holds a cached error, not a value: " + + $"{VbaErrorText(error)}. Its expression is '{column.CalculatedExpression ?? "(unknown)"}'."); + ReadOnlySpan payload = Payload(envelope, column); - return payload.Length == 0 ? null : Types.JetTypeCodec.Decode(column, StoredType(column, payload.Length), payload); + JetDataType type = StoredType(column, payload.Length); + + // A zero-length payload is a Null result -- EXCEPT for text, where it is the empty string. The two + // are indistinguishable on disk (an empty string also encodes to nothing), and ACE resolves the + // ambiguity towards "": `Left([A],2)` over a Null [A] stores an empty payload and ACE reads back + // "", while the same empty payload under a DateTime result type reads back Null. + if (payload.Length == 0) + return type == JetDataType.Text ? "" : null; + + return Types.JetTypeCodec.Decode(column, type, payload); } + /// The envelope's leading status: 0 when the expression produced a value, otherwise the VBA + /// runtime error number it raised. A short envelope reads as 0 — a truncated slot is the width check's + /// business, not this one's. + private static uint Status(ReadOnlySpan envelope) => + envelope.Length >= StatusSize ? BinaryPrimitives.ReadUInt32LittleEndian(envelope[..StatusSize]) : 0; + + /// Names the VBA errors a calculated expression can actually raise, so the message says what + /// went wrong rather than quoting a number. Measured: CDbl(Null) caches 94 and CDbl('hello') + /// caches 13 — the conversions raise rather than propagating, which is why they can fail at all. + private static string VbaErrorText(uint error) => error switch + { + 5 => "VBA error 5, invalid procedure call or argument", + 6 => "VBA error 6, overflow", + 11 => "VBA error 11, division by zero", + 13 => "VBA error 13, type mismatch", + 94 => "VBA error 94, invalid use of Null", + _ => $"VBA error {error}", + }; + /// - /// The type the payload is actually encoded in. ACE widens a calculated column's descriptor type to the - /// next storage type in its family and keeps the payload at the result's natural width, so the declared - /// type alone reads the wrong number of bytes. Measured against ACE-authored columns of every type DAO - /// will create; the (declared, width) pair is unambiguous, including Boolean and Byte, which promote to - /// different declared types and so stay distinguishable at one byte. + /// The type the payload is actually encoded in. + /// — the ResultType property of the table's + /// LvProp blob — is the authority, and is used whenever it is present. The descriptor's + /// is the promoted storage type of the *expression*, which need not agree: + /// a CDbl expression on a column declared LONG has descriptor Double, ResultType Int32 and + /// a four-byte payload. + /// The width rule below is only the fallback for a file whose blob is missing or damaged. It + /// reverses ACE's promotion (Boolean→Int16, Byte/Int16→Int32, Single→Double), which is correct while the + /// declared and expression types agree — every column DAO authors — and wrong when they do not. /// - private static JetDataType StoredType(ColumnDef column, int payloadLength) => column.Type switch + private static JetDataType StoredType(ColumnDef column, int payloadLength) { - JetDataType.Int16 when payloadLength == 1 => JetDataType.Boolean, - JetDataType.Int32 when payloadLength == 1 => JetDataType.Byte, - JetDataType.Int32 when payloadLength == 2 => JetDataType.Int16, - JetDataType.Double when payloadLength == 4 => JetDataType.Single, - _ => column.Type, - }; + JetDataType type = column.CalculatedResultType ?? column.Type switch + { + JetDataType.Int16 when payloadLength == 1 => JetDataType.Boolean, + JetDataType.Int32 when payloadLength == 1 => JetDataType.Byte, + JetDataType.Int32 when payloadLength == 2 => JetDataType.Int16, + JetDataType.Double when payloadLength == 4 => JetDataType.Single, + _ => column.Type, + }; + + // A Memo result is plain text INSIDE the envelope — the long-value indirection wraps the whole + // envelope and the caller has already resolved it, so the codec's Memo branch (which hands back a + // raw descriptor) must not run here. + return type == JetDataType.Memo ? JetDataType.Text : type; + } /// The stored value inside , ready for the ordinary type codec. public static ReadOnlySpan Payload(ReadOnlySpan envelope, ColumnDef column) diff --git a/src/LibRed/LibRed.Core/Storage/RowDecoder.cs b/src/LibRed/LibRed.Core/Storage/RowDecoder.cs index 418f80ba..fe99d438 100644 --- a/src/LibRed/LibRed.Core/Storage/RowDecoder.cs +++ b/src/LibRed/LibRed.Core/Storage/RowDecoder.cs @@ -113,6 +113,24 @@ public Dictionary LongValueRaw(ReadOnlySpan row) return result; } + /// Returns each calculated column's stored slot verbatim (keyed by ) + /// — the envelope, or the long-value descriptor wrapping it — WITHOUT decoding or resolving it. An UPDATE + /// that touches nothing the expression reads writes these back unchanged, which is what ACE does. + public Dictionary CalculatedRaw(ReadOnlySpan row) + { + var result = new Dictionary(); + RowLayout layout = ParseLayout(row); + ReadOnlySpan nullBitmap = row[^layout.NullBitmapSize..]; + + foreach (ColumnDef column in _columns) + if (column.IsCalculated && !column.IsFixedLength + && IsPresent(nullBitmap, layout.ColumnCount, column.ColumnId) + && column.VariableIndex >= 0 && column.VariableIndex < layout.NumVar) + result[column.Index] = layout.VarChunk(column.VariableIndex).ToArray(); + + return result; + } + private ReadOnlySpan FixedSlice(ReadOnlySpan row, RowLayout layout, ColumnDef column) { int start = _format.RowColumnCountSize + column.FixedOffset; diff --git a/src/LibRed/LibRed.Core/Storage/RowEncoder.cs b/src/LibRed/LibRed.Core/Storage/RowEncoder.cs index 6491810a..2a18d174 100644 --- a/src/LibRed/LibRed.Core/Storage/RowEncoder.cs +++ b/src/LibRed/LibRed.Core/Storage/RowEncoder.cs @@ -16,13 +16,22 @@ namespace LibRed.Storage; /// an end-first offset table. A memo/OLE column's value is written as an *inline* long-value /// (12-byte descriptor + payload, §8) when it is small enough; anything larger is stored on LVAL /// pages by before the row reaches here, so only the descriptor is encoded. +/// A calculated column is the exception, because its value is derived here rather than supplied: an +/// oversized result is spilled through the spillCalculated callback the writer passes in. /// public sealed class RowEncoder(IReadOnlyList columns, JetFormatBase format, - int? fixedDataLength = null, int? variableColumnCount = null) + int? fixedDataLength = null, int? variableColumnCount = null, + Func? spillCalculated = null) { private readonly IReadOnlyList _columns = columns; private readonly JetFormatBase _format = format; + // How an oversized calculated result reaches an LVAL page, returning the in-row descriptor. A calculated + // column is the one value the encoder DERIVES rather than receives, so it cannot have been materialised + // before the row arrived here the way a plain memo is; the writer that owns the pages supplies this + // instead. Null for a standalone encode, which has no channel to write to and so must refuse. + private readonly Func? _spillCalculated = spillCalculated; + // How many variable slots a row carries. The TDEF's 0x2B when the caller has it — a high-water that // never decrements — else the tight maximum over the live columns, which is the same number until the // LAST variable column is dropped and is all a standalone encode can know. @@ -33,7 +42,15 @@ public sealed class RowEncoder(IReadOnlyList columns, JetFormatBase f // passes the TDEF's actual fixed-row size so the on-disk layout matches Access. private readonly int _fixedDataLength = fixedDataLength ?? ComputeFixedDataLength(columns); - public byte[] Encode(object?[] values) + public byte[] Encode(object?[] values) => Encode(values, null); + + /// Encodes a row, recomputing its calculated columns. + /// Envelopes to carry over verbatim, keyed by + /// . An UPDATE that touches nothing a calculated column reads must leave + /// the cached value exactly as it was: ACE recomputes only when a referenced column is written, so + /// recomputing unconditionally would write bytes ACE would not have (§3.4a). Null on INSERT, where every + /// calculated column is computed fresh. + public byte[] Encode(object?[] values, IReadOnlyDictionary? preservedCalculated) { if (values.Length != _columns.Count) throw new ArgumentException($"Expected {_columns.Count} values, got {values.Length}.", nameof(values)); @@ -71,6 +88,11 @@ public byte[] Encode(object?[] values) Array.Fill(varChunks, []); // a dropped column's slot stays present, and empty foreach (ColumnDef column in varCols) { + if (column.IsCalculated) + { + varChunks[column.VariableIndex] = EncodeCalculated(column, values, preservedCalculated); + continue; + } object? v = values[column.Index]; varChunks[column.VariableIndex] = v is null ? [] : JetTypeCodec.Encode(column, v); } @@ -78,6 +100,32 @@ public byte[] Encode(object?[] values) return AssembleRow(maxColumnId, fixedRegion, varChunks, _columns, values); } + /// The slot for a calculated column: the envelope holding the result, wrapped in a long-value + /// descriptor when the column owns a long-value map (which is how ACE stores a calculated Memo). + private byte[] EncodeCalculated(ColumnDef column, object?[] values, + IReadOnlyDictionary? preservedCalculated) + { + if (preservedCalculated is not null && preservedCalculated.TryGetValue(column.Index, out byte[]? kept)) + return kept; + + byte[] envelope = CalculatedValue.Encode(column, CalculatedValue.Evaluate(column, _columns, values)); + if (!column.HasLongValueMap) return envelope; + + // A memo-backed result inlines while it fits and spills to an LVAL page once it does not — the same + // 64-byte boundary a plain memo uses, and for the same reason: Access reads an inlined long value + // back but refuses one that should have been on a page. What goes on the page is the WHOLE envelope, + // header and padding included, because that is what the in-row slot would otherwise have held. + if (envelope.Length <= LongValueFormat.MaxInlineValue) + return JetTypeCodec.EncodeInlineLongValue(envelope); + + return _spillCalculated is not null + ? _spillCalculated(column, envelope) + : throw new NotSupportedException( + $"Calculated column '{column.Name}' produced a {envelope.Length}-byte value, too large to " + + "store inline. Encoding it needs a writer that can allocate long-value pages, which a " + + "standalone RowEncoder has no channel for — insert or update through RowInserter."); + } + /// Rejects a variable TEXT/BINARY value longer than its column's declared width, as ACE does /// (measured in ColumnLengthAccessTests); without it LibRed wrote rows Access will not read back. /// Memo/OLE are exempt — they encode to a long-value descriptor whose size is unrelated to @@ -111,19 +159,12 @@ private static void EnsureFitsDeclaredLength(ColumnDef column, byte[] encoded) internal static byte[] AssembleRow(int maxColumnId, ReadOnlySpan fixedRegion, IReadOnlyList varChunks, IReadOnlyList columns, object?[] values) { - // A calculated column's slot is not a value but an envelope holding ACE's cached result - // (page-02b §3.4a), and only ACE can evaluate the expression that fills it. Encoding the decoded - // value back would write a bare value into that slot, which ACE then reads as a corrupt envelope. - // Refusing is the honest outcome until LibRed can evaluate the expression itself: LibRed reads - // these tables, and until this guard existed reading them was impossible anyway. - foreach (ColumnDef column in columns) - if (column.IsCalculated) - throw new NotSupportedException( - $"Table has calculated column '{column.Name}', whose stored value only ACE can compute. " + - "LibRed reads calculated columns but cannot write a row that contains one."); - + // A calculated column is exempt from the declared-width check: its length field is a constant ACE + // writes (39 for a value type, 509 for any Text, whatever size was asked for), not a limit — a + // Text(5) calculated column stores a far longer result and ACE reads it back in full (§3.4a). foreach (ColumnDef column in columns) - if (!column.IsFixedLength && column.VariableIndex >= 0 && column.VariableIndex < varChunks.Count) + if (!column.IsFixedLength && !column.IsCalculated + && column.VariableIndex >= 0 && column.VariableIndex < varChunks.Count) EnsureFitsDeclaredLength(column, varChunks[column.VariableIndex]); const int countSize = 2; @@ -164,7 +205,12 @@ internal static byte[] AssembleRow(int maxColumnId, ReadOnlySpan fixedRegi foreach (ColumnDef column in columns) { liveIds.Add(column.ColumnId); - bool present = column.Type == JetDataType.Boolean ? IsTruthy(values[column.Index]) : values[column.Index] is not null; + // A calculated column is always present, even when its expression evaluated to Null — ACE marks + // the bit and stores a zero-length payload, so here the bit means "has an envelope" and says + // nothing about the value (§3.4a). It is also why a calculated Boolean cannot use the bit as its + // value the way a real one does. + bool present = column.IsCalculated + || (column.Type == JetDataType.Boolean ? IsTruthy(values[column.Index]) : values[column.Index] is not null); if (present) row[bitmapPos + (column.ColumnId >> 3)] |= (byte)(1 << (column.ColumnId & 7)); } for (int id = 0; id <= maxColumnId; id++) // dead ids read present in ACE diff --git a/src/LibRed/LibRed.Core/Storage/RowInserter.cs b/src/LibRed/LibRed.Core/Storage/RowInserter.cs index 1a72f210..df995138 100644 --- a/src/LibRed/LibRed.Core/Storage/RowInserter.cs +++ b/src/LibRed/LibRed.Core/Storage/RowInserter.cs @@ -31,6 +31,7 @@ public sealed class RowInserter(PageChannel channel, TableDef table) public void Insert(object?[] values, bool updateIndexes) { JetFormatBase format = _channel.Format; + RejectExplicitCalculatedValues(values, null); // Assign AutoNumber ids for any AutoNumber column the caller left unset (the usual case — // Jet SQL omits the AutoNumber column from the insert). An explicitly supplied value is kept @@ -48,7 +49,7 @@ public void Insert(object?[] values, bool updateIndexes) // Encode first: the fixed-region length is pinned by any existing row (to match Access), // or derived from the columns for a just-created empty table. var encoder = new RowEncoder(_table.Columns, format, InferFixedDataLength(format), - _table.VariableColumnCount); + _table.VariableColumnCount, SpillCalculated); byte[] record = encoder.Encode(values); EnsureRecordFits(format, record); @@ -90,10 +91,14 @@ public void Insert(object?[] values, bool updateIndexes) public void Update(RowId id, object?[] values, IReadOnlySet changedColumns) { JetFormatBase format = _channel.Format; + RejectExplicitCalculatedValues(values, changedColumns); // Long-value (memo/OLE) columns: keep an unchanged column's on-disk descriptor verbatim (so it is not // needlessly re-materialised onto fresh LVAL pages), and free a changed column's old chained pages. - var oldDescriptors = new RowDecoder(_table.Columns, format).LongValueRaw(ReadRowBytes(id)); + byte[] oldRow = ReadRowBytes(id); + var decoder = new RowDecoder(_table.Columns, format); + var oldDescriptors = decoder.LongValueRaw(oldRow); + var oldCalculated = decoder.CalculatedRaw(oldRow); foreach (ColumnDef column in _table.Columns) { if (column.Type is not (JetDataType.Memo or JetDataType.Ole)) continue; @@ -102,6 +107,33 @@ public void Update(RowId id, object?[] values, IReadOnlySet changedColumns) else values[column.Index] = new LongValueDescriptor(oldDescriptor); } + // A calculated column is recomputed only when the UPDATE writes a column its expression READS — + // measured against ACE, which leaves the cached value untouched otherwise and refreshes it even when + // a referenced column is rewritten with the value it already had (§3.4a). Carrying the old envelope + // over verbatim is therefore not an optimisation: recomputing every time would write bytes ACE never + // would, and a cache neither engine re-derives on read is exactly where that stays invisible. + Dictionary? preservedCalculated = null; + foreach (ColumnDef column in _table.Columns) + { + if (!column.IsCalculated) continue; + if (CalculatedValue.ReferencedIndexes(column, _table.Columns).Overlaps(changedColumns)) continue; + if (!oldCalculated.TryGetValue(column.Index, out byte[]? kept)) continue; + (preservedCalculated ??= [])[column.Index] = kept; + } + + // A calculated column that IS being recomputed abandons whatever its old result occupied, so a + // memo-backed one has to give its LVAL pages back — nothing else will, and the row's new descriptor + // overwrites the only reference to them. A preserved column keeps its pages precisely because the + // descriptor carried over verbatim still points at them. + foreach (ColumnDef column in _table.Columns) + { + if (!column.IsCalculated || !column.HasLongValueMap) continue; + if (preservedCalculated?.ContainsKey(column.Index) == true) continue; + if (oldCalculated.TryGetValue(column.Index, out byte[]? stale) + && stale.Length >= LongValueFormat.DescriptorSize) + FreeLongValue(column, stale); + } + MaterializeLongValues(values); byte[] srcPage = _channel.ReadPageShared(id.Page).Span.ToArray(); @@ -109,8 +141,8 @@ public void Update(RowId id, object?[] values, IReadOnlySet changedColumns) // parse returns a negative length for an all-fixed-column table (no variable columns — e.g. Northwind // Order Details), which without the guard would overflow `new byte[len]`. var encoder = new RowEncoder(_table.Columns, format, InferFixedDataLength(format), - _table.VariableColumnCount); - byte[] record = encoder.Encode(values); + _table.VariableColumnCount, SpillCalculated); + byte[] record = encoder.Encode(values, preservedCalculated); // Here as well as on the insert path, and before the in-place rewrite rather than beside the // page-search: a row that grows past the cap but still fits its current page is rewritten where it @@ -665,7 +697,7 @@ private static int LowestRowOffset(byte[] page, JetFormatBase format, int rowCou /// private void MaterializeLongValues(object?[] values) { - const int maxInline = 64; // Jackcess MAX_INLINE_LONG_VALUE_SIZE (Jet3 and Jet4) + const int maxInline = LongValueFormat.MaxInlineValue; LongValueWriter? writer = null; TableDefinitionPage? definition = null; @@ -701,6 +733,34 @@ private void MaterializeLongValues(object?[] values) private const int MaxLvalRowSize = 4076; // one LVAL page row (Jackcess MAX_LONG_VALUE_ROW_SIZE, Jet4) private const int MinLvalRow = 65 + 2; + /// Rejects a caller-supplied value for a calculated column, as ACE does — it refuses both an + /// INSERT naming one and an UPDATE setting one, with "Cannot update 'x'; field not updateable." + /// Refusing beats ignoring: a caller who passes a value expects it stored, and quietly computing + /// something else instead is the harder bug to find. + /// On INSERT the test is a value in the slot, because nothing else would put one there. On UPDATE + /// it has to be — callers hand back the whole row they just read, so + /// the slot legitimately still holds the cached value and its presence means nothing. + private void RejectExplicitCalculatedValues(object?[] values, IReadOnlySet? changedColumns) + { + foreach (ColumnDef column in _table.Columns) + { + if (!column.IsCalculated) continue; + bool written = changedColumns is null + ? values[column.Index] is not null + : changedColumns.Contains(column.Index); + if (written) + throw new InvalidOperationException( + $"Cannot update '{column.Name}'; field not updateable. It is a calculated column, so its " + + "value comes from its expression and cannot be supplied."); + } + } + + /// Writes an oversized calculated result to an LVAL page and returns its in-row descriptor. + /// Handed to , which derives the value and so is the only place that knows how + /// big it turned out; the pages and their usage maps stay this class's business. + private byte[] SpillCalculated(ColumnDef column, byte[] envelope) + => StorePackedLongValue(column.ColumnId, envelope); + /// Stores on an LVAL page for long-value column /// — packing onto a free page as usual — and returns the in-row descriptor. /// For a caller that must use a page regardless of size (the MSysObjects LvProp property blob, diff --git a/src/LibRed/LibRed.Core/Storage/TableCreator.cs b/src/LibRed/LibRed.Core/Storage/TableCreator.cs index 5ba712b9..44c92ca1 100644 --- a/src/LibRed/LibRed.Core/Storage/TableCreator.cs +++ b/src/LibRed/LibRed.Core/Storage/TableCreator.cs @@ -117,8 +117,12 @@ public void Create( // CREATE TABLE, but a spec can carry an explicit id — the faithful-rebuild path does, and ids are // never reused after a DROP COLUMN — and the TDEF's long-value map is read back by id, so using the // position there silently points a Memo/OLE column's usage maps at the wrong column. + // A calculated column with a Memo RESULT needs the maps too, and its declared type does not say so: + // ACE declares such a column Text with length 0 and reaches the value through a long-value + // descriptor, so keying off Type alone leaves it without maps and its result nowhere to go (§3.4a). var longValueCols = columns.Select((c, i) => (Column: c, Id: c.ColumnId ?? i)) - .Where(x => x.Column.Type is JetDataType.Memo or JetDataType.Ole) + .Where(x => x.Column.Type is JetDataType.Memo or JetDataType.Ole + || x.Column.CalculatedResultType is JetDataType.Memo) .ToList(); // The table's data-block indexes: the primary key (unique), then a unique index per UNIQUE @@ -136,6 +140,15 @@ public void Create( foreach (RelationshipSpec fk in relationships) indexPlans.Add((fk.Name, fk.Columns.Select(c => c.Column).ToList(), false, false, fk)); + // Every index this CREATE would build, including the ones arriving as a PRIMARY KEY or UNIQUE + // constraint rather than as an index — the inline `col type PRIMARY KEY` form is refused earlier, at + // the SQL layer, but the table-level CONSTRAINT form reaches here. + foreach (var plan in indexPlans) + RejectCalculatedIndexColumns(plan.Name, plan.Columns, + n => columns.FirstOrDefault( + c => c.CalculatedExpression is not null + && string.Equals(c.Name, n, StringComparison.OrdinalIgnoreCase))?.Name); + // Usage-map layout (verified vs ACE): the primary page holds row 0 = table owned, row 1 = table // free, then one row per index, then two rows (owned + free) per long-value (memo/OLE) column — as // many *whole* columns as fit (a page holds ~57 inline records). Once the primary page is full, each @@ -263,6 +276,7 @@ public void Create( columnProps.Add(new PropertyBlob.Property(col.Name, PropertyBlob.DefaultValueProperty, def.DefaultSql)); if (!col.IsNullable && !col.IsAutoNumber) columnProps.Add(PropertyBlob.Bool(col.Name, PropertyBlob.RequiredProperty, true)); + columnProps.AddRange(CalculatedProperties(col)); } AddCatalogRow(name, tdefPage, columnProps, checkConstraints); @@ -273,6 +287,36 @@ public void Create( AddIncomingRelationshipBlock(inc); } + /// The property-blob entries that make a column calculated (§3.4a), or nothing for an ordinary + /// one. All three pieces have to agree or Access reads the payload wrongly: Expression is the text + /// the engine evaluates, ResultType is the authority on the payload's encoding, and the three + /// FCMin*Ver strings declare the Access floor a calculated column forces. The version properties + /// are not DDL properties, unlike the first two — matching what ACE writes. + private static IEnumerable CalculatedProperties(ColumnSpec column) + { + if (column.CalculatedExpression is not { } expression) yield break; + + JetDataType resultType = column.CalculatedResultType ?? column.Type; + yield return new PropertyBlob.Property( + column.Name, PropertyBlob.ExpressionProperty, expression, JetDataType.Memo); + // A Byte property is one raw byte, so the value has to be supplied as RawValue -- a Value string + // would be written as UTF-16 text and read back as a nonsense type code. + yield return new PropertyBlob.Property( + column.Name, PropertyBlob.ResultTypeProperty, + ((byte)resultType).ToString(System.Globalization.CultureInfo.InvariantCulture), + JetDataType.Byte, RawValue: [(byte)resultType]); + foreach (string version in CalculatedVersionProperties) + yield return new PropertyBlob.Property( + column.Name, version, CalculatedMinimumVersion, JetDataType.Text) { IsDdl = false }; + } + + private static readonly string[] CalculatedVersionProperties = + ["FCMinReadVer", "FCMinWriteVer", "FCMinDesignVer"]; + + /// Access 2010 (ACE 14) is the floor a calculated column declares, which is also the on-disk + /// version byte it needs — see . + private const string CalculatedMinimumVersion = "14.0.0000.0000"; + // Index-info block field values (§3.6), verified against ACE-created relationships. // (PlainAction and the index-type bytes are shared with the reader via IndexBlockFormat.) private const byte NoCascadeAction = 0x00; // relationship without ON UPDATE/DELETE CASCADE @@ -405,12 +449,33 @@ public void AddIndex(string tableName, string indexName, IReadOnlyList<(string C if (table.Indexes.Any(i => string.Equals(i.Name, indexName, StringComparison.OrdinalIgnoreCase))) throw new InvalidOperationException( $"Table '{table.Name}' already has an index named '{indexName}'."); + RejectCalculatedIndexColumns(indexName, columns.Select(c => c.Column), + n => table.Columns.FirstOrDefault( + c => c.IsCalculated && string.Equals(c.Name, n, StringComparison.OrdinalIgnoreCase))?.Name); var slots = ResolveSlots(table, columns.Select(c => (c.Column, Ascending: !c.Descending))); InsertIndex(table, indexName, slots, unique: isUnique || isPrimary, required: isPrimary || disallowNull, ignoreNulls, (num, ord) => BuildPlainInfoBlock(num, ord, isPrimary)); } + /// Refuses an index over a calculated column, on whichever route asked for it. + /// This matches Access and diverges only from ACE's SQL layer, which is the one that gets it wrong. + /// Access's designer does not offer a calculated column in the Indexes dialog at all and will not + /// let it be the primary key; the storage engine agrees, refusing every INSERT into a table whose + /// calculated column is indexed — "Operation is not supported for this type of object." Only + /// ACE via SQL accepts CREATE INDEX (and even CREATE UNIQUE INDEX) on one, and what + /// it produces is a table into which no row can ever be written. Measured for Int16 and Int32 results, + /// with the index created both before and after rows exist (page-02e-calculated-columns). + private static void RejectCalculatedIndexColumns( + string indexName, IEnumerable columnNames, Func findCalculated) + { + foreach (string name in columnNames) + if (findCalculated(name) is { } calculated) + throw new NotSupportedException( + $"Index '{indexName}' cannot include calculated column '{calculated}'. Access does not " + + "offer one for indexing, and an index over it makes the table refuse every insert."); + } + /// Resolves index column names to (columnId, ascending) slots against a table. private static IReadOnlyList<(int Id, bool Ascending)> ResolveSlots( TableDef table, IEnumerable<(string Column, bool Ascending)> columns) @@ -1006,8 +1071,10 @@ private void RenameColumnProperties(int tdefPage, string oldName, string newName if (values[idIndex] is null || Convert.ToInt32(values[idIndex]) != tdefPage) continue; if (values[lvProp.Index] is not byte[] { Length: > 0 } blob) return; - byte[] renamed = PropertyBlob.RenameOwner(blob, oldName, newName); - if (renamed.AsSpan().SequenceEqual(blob)) return; // the column had no property block + byte[] renamed = RewriteCalculatedReferences( + PropertyBlob.RenameOwner(blob, oldName, newName), oldName, newName); + // Nothing owned by, or referring to, this column — leave the blob exactly as it was. + if (renamed.AsSpan().SequenceEqual(blob)) return; byte[] descriptor = new RowInserter(_channel, msys).StorePackedLongValue(lvProp.ColumnId, renamed); values[lvProp.Index] = new LongValueDescriptor(descriptor); @@ -1016,6 +1083,50 @@ private void RenameColumnProperties(int tdefPage, string oldName, string newName } } + /// The calculated columns of whose expression reads + /// . A malformed expression counts as reading nothing rather than throwing: + /// refusing to drop is a safeguard, and it must not turn into a refusal to drop anything at all because + /// some other column's expression cannot be parsed. + private static List CalculatedColumnsReading(TableDef table, ColumnDef column) + { + var dependents = new List(); + foreach (ColumnDef candidate in table.Columns) + { + if (!candidate.IsCalculated || candidate.CalculatedExpression is null) continue; + try + { + if (CalculatedValue.ReferencedIndexes(candidate, table.Columns).Contains(column.Index)) + dependents.Add(candidate.Name); + } + catch (Calculated.CalculatedExpressionException) { /* unparseable: reads nothing we can prove */ } + } + return dependents; + } + + /// Repoints every calculated Expression in the blob that READS the renamed column. + /// moves the renamed column's own properties; this is about the + /// OTHER columns that mention it, which nothing else would fix. Measured: without it a rename leaves + /// [Qty]*2 pointing at a column that no longer exists, and ACE fails every read of the calculated + /// column — a table broken by an operation that named a different column entirely. + private static byte[] RewriteCalculatedReferences(byte[] blob, string oldName, string newName) + { + var properties = PropertyBlob.Read(blob).ToList(); + bool changed = false; + for (int i = 0; i < properties.Count; i++) + { + if (properties[i].Name != PropertyBlob.ExpressionProperty) continue; + string rewritten = Calculated.CalculatedExpression.RenameColumnReference( + properties[i].Value, oldName, newName); + if (rewritten == properties[i].Value) continue; + // Drop RawValue so the new text is encoded rather than the original bytes replayed. + properties[i] = properties[i] with { Value = rewritten, RawValue = null }; + changed = true; + } + return changed + ? PropertyBlob.Write(properties, blob.Length >= 4 ? blob.AsSpan(0, 4) : default) + : blob; + } + /// Repoints every relationship that names this column, on whichever side owns it. Unlike a table /// name, a column name is only unique within its table, so each side is matched on its table name too. private void RepointRelationshipColumns(string tableName, string oldName, string newName) @@ -1200,7 +1311,10 @@ public bool AddColumn(string tableName, ColumnSpec spec, string? defaultValue = if (table.Columns.Count >= MaxColumnsPerTable) throw new NotSupportedException($"Table '{tableName}' already has {MaxColumnsPerTable} columns (Jet/ACE limit)."); JetFormatBase format = _channel.Format; - bool isLongValue = spec.Type is JetDataType.Memo or JetDataType.Ole; + // As on the create path, a calculated column with a Memo RESULT needs the long-value maps even though + // its declared type is Text — the value reaches a page through a descriptor either way (§3.4a). + bool isLongValue = spec.Type is JetDataType.Memo or JetDataType.Ole + || spec.CalculatedResultType is JetDataType.Memo; TdefParts parts = ParseTdef(table.DefinitionPage); // stitches continuation pages for a multi-page TDEF int maxCols = BinaryPrimitives.ReadUInt16LittleEndian(parts.Header.AsSpan(format.TdefMaxColumnsOffset, 2)); @@ -1262,6 +1376,12 @@ public bool AddColumn(string tableName, ColumnSpec spec, string? defaultValue = Scale = spec.Scale, IsNullable = spec.IsNullable, Collation = spec.Type == JetDataType.FixedPoint ? Collation.GeneralLegacy : _collation, + // Without this the descriptor gets no 0xC0 and the column reads back as an ordinary one: its + // Expression and ResultType properties are written, nothing looks at them, and every row stores + // NULL where the computed value should be. + IsCalculated = spec.CalculatedExpression is not null, + CalculatedExpression = spec.CalculatedExpression, + CalculatedResultType = spec.CalculatedResultType, }; AppendColumnToParts(parts, colCount, TdefBuilder.BuildColumnDescriptor(newColumn, format), spec.Name, format); @@ -1318,6 +1438,7 @@ public bool AddColumn(string tableName, ColumnSpec spec, string? defaultValue = var props = new List(); if (defaultValue is not null) props.Add(new PropertyBlob.Property(spec.Name, PropertyBlob.DefaultValueProperty, defaultValue)); if (!spec.IsNullable) props.Add(PropertyBlob.Bool(spec.Name, PropertyBlob.RequiredProperty, true)); + props.AddRange(CalculatedProperties(spec)); if (props.Count > 0) SetColumnProperties(table.DefinitionPage, spec.Name, props); _catalog.Invalidate(); @@ -2275,6 +2396,19 @@ public bool DropColumn(string tableName, string columnName) ColumnDef? col = table.Columns.FirstOrDefault(c => string.Equals(c.Name, columnName, StringComparison.OrdinalIgnoreCase)); if (col is null) return false; + // A DELIBERATE divergence from ACE. ACE accepts dropping a column a calculated expression reads and + // simply leaves that column unevaluatable — measured: every subsequent read of it fails, and there is + // no way back short of recreating the column, because ACE offers no route to edit an expression at + // all. Refusing keeps the file readable, and the caller who really wants it gone can drop the + // calculated column first. + if (CalculatedColumnsReading(table, col) is { Count: > 0 } dependents) + throw new InvalidOperationException( + $"Column '{col.Name}' cannot be dropped because " + + $"{string.Join(", ", dependents.Select(d => $"'{d}'"))} " + + (dependents.Count == 1 + ? "is a calculated column that reads it. Drop it first." + : "are calculated columns that read it. Drop those first.")); + // ACE rejects dropping a column that participates in a relationship (as the child FK column or the // referenced parent key) — even a NO INDEX FK with no backing index — with "It is part of one or more // relationships"; you must drop the relationship first. This is correct, permanent behaviour (not a diff --git a/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs b/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs index ea69e71c..f9f9467c 100644 --- a/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs +++ b/src/LibRed/LibRed.Core/Storage/Types/JetTypeCodec.cs @@ -215,7 +215,13 @@ public static string DecodeText(ReadOnlySpan value) /// one reaches here as the pre-built descriptor of a value /// has already put on LVAL pages. /// - public static byte[] Encode(ColumnDef column, object value) + public static byte[] Encode(ColumnDef column, object value) => Encode(column, column.Type, value); + + /// Encodes as rather than the column's declared + /// type — the write-side counterpart of the + /// overload, and needed for the same reason: a calculated column's payload is encoded in its + /// ResultType, not in the promoted type its descriptor carries. + internal static byte[] Encode(ColumnDef column, JetDataType type, object value) { var c = System.Globalization.CultureInfo.InvariantCulture; @@ -231,7 +237,7 @@ public static byte[] Encode(ColumnDef column, object value) if (value is bool boolean) value = (short)(boolean ? -1 : 0); - switch (column.Type) + switch (type) { case JetDataType.Byte: return [Convert.ToByte(value, c)]; @@ -453,7 +459,7 @@ private static byte[] Bytes(int length, Action> write) /// This is the exact shape reads back for an inline /// value. /// - private static byte[] EncodeInlineLongValue(ReadOnlySpan payload) + internal static byte[] EncodeInlineLongValue(ReadOnlySpan payload) { LongValueFormat.ValidateLength(payload.Length); var result = new byte[12 + payload.Length]; diff --git a/src/LibRed/LibRed.EFCore/Migrations/LibRedMigrationsSqlGenerator.cs b/src/LibRed/LibRed.EFCore/Migrations/LibRedMigrationsSqlGenerator.cs index 0979bb56..0e73177a 100644 --- a/src/LibRed/LibRed.EFCore/Migrations/LibRedMigrationsSqlGenerator.cs +++ b/src/LibRed/LibRed.EFCore/Migrations/LibRedMigrationsSqlGenerator.cs @@ -892,6 +892,35 @@ operation[JetAnnotationNames.Identity] is string identity && RelationalStrings.UnsupportedTypeForColumn(fullTableName, name, operation.ClrType?.Name ?? "unknown")); } + /// + /// Generates a SQL fragment for a computed column definition for the given column metadata. + /// + /// The schema that contains the table, or to use the default schema. + /// The table that contains the column. + /// The column name. + /// The column metadata. + /// The target model which may be if the operations exist without a model. + /// The command builder to use to add the SQL fragment. + protected override void ComputedColumnDefinition( + string? schema, + string table, + string name, + ColumnOperation operation, + IModel? model, + MigrationCommandListBuilder builder) + { + builder.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(name)); + + builder.Append(" "); + + builder.Append(operation.ColumnType!); + + builder + .Append(" AS (") + .Append(operation.ComputedColumnSql!) + .Append(")"); + } + /// /// Generates a SQL fragment for the given referential action. /// diff --git a/src/LibRed/LibRed.EFCore/Scaffolding/Internal/LibRedDatabaseModelFactory.cs b/src/LibRed/LibRed.EFCore/Scaffolding/Internal/LibRedDatabaseModelFactory.cs index 3bcc48f5..51f92a28 100644 --- a/src/LibRed/LibRed.EFCore/Scaffolding/Internal/LibRedDatabaseModelFactory.cs +++ b/src/LibRed/LibRed.EFCore/Scaffolding/Internal/LibRedDatabaseModelFactory.cs @@ -115,6 +115,12 @@ private void GetColumns(JetDatabase database, IReadOnlyList table // DefaultValue is the expression's source text (e.g. "0", "'hi'"), read from the same blob. string? defaultValueSql = column.DefaultValue; + // A calculated column's expression IS its ComputedColumnSql, reported verbatim in the Access + // expression service's own syntax ("[X] + [Y]"). Always stored: the value is cached on disk + // and neither engine re-derives it on read, so there is no virtual form to report. + string? computedColumnSql = column.IsCalculated ? column.CalculatedExpression : null; + bool? computedIsStored = computedColumnSql is null ? null : true; + _logger.ColumnFound( table.Name, column.Name, @@ -126,8 +132,8 @@ private void GetColumns(JetDatabase database, IReadOnlyList table nullable, column.IsAutoNumber, defaultValueSql, - null, // computedValue - null); // computed-is-stored + computedColumnSql, + computedIsStored); // Identity seed/increment (matching EFCore.Jet's scaffolder), read from the column's COUNTER // config; a non-identity column carries a null seed/increment as Jet's does. @@ -145,6 +151,8 @@ private void GetColumns(JetDatabase database, IReadOnlyList table // parsed to a CLR value when it's a simple literal (so the scaffolded model uses HasDefaultValue). DefaultValueSql = defaultValueSql, DefaultValue = ParseDefaultValue(column.Type, defaultValueSql), + ComputedColumnSql = computedColumnSql, + IsStored = computedIsStored, ValueGenerated = column.IsAutoNumber ? ValueGenerated.OnAdd : null, }; diff --git a/src/LibRed/LibRed.Engine/Execution/AccessTypeMapper.cs b/src/LibRed/LibRed.Engine/Execution/AccessTypeMapper.cs index afff2b75..5e789aca 100644 --- a/src/LibRed/LibRed.Engine/Execution/AccessTypeMapper.cs +++ b/src/LibRed/LibRed.Engine/Execution/AccessTypeMapper.cs @@ -13,8 +13,9 @@ namespace LibRed.Engine.Execution; /// internal static class AccessTypeMapper { - public static ColumnSpec ToColumnSpec(ColumnDefinition column, JetVersion version) => - MapType(column, version) with + public static ColumnSpec ToColumnSpec(ColumnDefinition column, JetVersion version) + { + ColumnSpec spec = MapType(column, version) with { IsNullable = !column.NotNull, // WITH COMPRESSION is only meaningful on the two types ACE accepts it for; Access rejects it @@ -26,6 +27,34 @@ public static ColumnSpec ToColumnSpec(ColumnDefinition column, JetVersion versio : false, }; + if (column.Calculated is not { } expression) return spec; + + // Everything a calculated column cannot also be. Each of these is refused rather than ignored, + // because each would otherwise produce a column that looks declared one way and behaves another. + if (column.PrimaryKey) + throw new NotSupportedException( + $"Column '{column.Name}' cannot be both calculated and a key: ACE accepts an index on a " + + "calculated column and then refuses every insert into the table, so such a table can never " + + "hold a row."); + if (column.Default is not null) + throw new NotSupportedException( + $"Column '{column.Name}' cannot have a DEFAULT as well as a calculated expression — its value " + + "always comes from the expression."); + if (column.NotNull) + throw new NotSupportedException( + $"Column '{column.Name}' cannot be NOT NULL: a calculated column stores whatever its " + + "expression evaluates to, and that includes Null."); + if (column.Compressed) + throw new NotSupportedException( + $"Column '{column.Name}' cannot be declared WITH COMPRESSION: whether a calculated result is " + + "compressed follows its result type, and the engine decides it."); + + // The DECLARED type is the result type, not the storage type — the descriptor carries a promoted type + // and a constant length — so rebuild through the factory that knows those rules rather than patching + // the mapped spec here (page-02e-calculated-columns). + return ColumnSpec.Calculated(spec.Name, spec.Type, expression); + } + /// Whether WITH COMPRESSION applies to this column's type. Mapped at the HIGHEST version so the /// version gate inside cannot fire here: asking at Version4 made /// BIGINT … WITH COMPRESSION on an ACE 16 file — which had already passed the real gate — report diff --git a/src/LibRed/LibRed.Sql/Ast/Statements.cs b/src/LibRed/LibRed.Sql/Ast/Statements.cs index 8e02d76b..3c2ea16d 100644 --- a/src/LibRed/LibRed.Sql/Ast/Statements.cs +++ b/src/LibRed/LibRed.Sql/Ast/Statements.cs @@ -131,7 +131,11 @@ public sealed record ColumnDefinition( bool PrimaryKey, string? Default = null, /// WITH COMPRESSION / WITH COMP — Text and Memo only. - bool Compressed = false); + bool Compressed = false, + /// A calculated column's expression, from the LibRed-only AS (…) clause, kept as source + /// text because that text is what goes on disk and what the engine re-evaluates. Null for an ordinary + /// column. + string? Calculated = null); /// Referential action for a foreign key's ON DELETE / ON UPDATE clause. Jet records only /// enforce + cascade-update + cascade-delete, so NoAction/SetNull/SetDefault collapse to "no cascade". diff --git a/src/LibRed/LibRed.Sql/Grammar/AccessSql.g4 b/src/LibRed/LibRed.Sql/Grammar/AccessSql.g4 index 2bcbb24e..377754bb 100644 --- a/src/LibRed/LibRed.Sql/Grammar/AccessSql.g4 +++ b/src/LibRed/LibRed.Sql/Grammar/AccessSql.g4 @@ -125,7 +125,17 @@ withOption | IGNORE NULL # WithIgnoreNull ; -columnDefinition : name=identifier dataType columnConstraint* ; +columnDefinition : name=identifier dataType calculatedClause? columnConstraint* ; + +// A calculated column. This is a LibRed EXTENSION: Access SQL has no syntax for one at all, and ACE can +// only create them through DAO's object model, so nothing here will run against ACE. Shaped after SQL +// Server's computed column, with one difference — the data type is REQUIRED rather than inferred, because +// the declared type is what decides how the cached result is encoded on disk (page-02e-calculated-columns). +// The parentheses are REQUIRED, unlike SQL Server's computed column. The expression is not parsed by this +// grammar — it is captured as raw text and handed to CalculatedExpression, a separate parser for the Access +// expression service — so an explicit delimiter is what makes "where the expression ends" unambiguous to +// both. Without it, `AS x + y NOT NULL` has the expression rule and columnConstraint* competing for NOT. +calculatedClause : AS LPAREN expression RPAREN ; // A second word handles two-word ANSI aliases like CHARACTER VARYING / BIT VARYING. // Up to three words to cover multi-word SQL type names: "char varying", "national character varying", etc. diff --git a/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlBaseVisitor.cs b/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlBaseVisitor.cs index 4c6da56b..ec56f31a 100644 --- a/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlBaseVisitor.cs +++ b/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlBaseVisitor.cs @@ -433,6 +433,16 @@ public partial class AccessSqlBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitColumnDefinition([NotNull] AccessSqlParser.ColumnDefinitionContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCalculatedClause([NotNull] AccessSqlParser.CalculatedClauseContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by . /// /// The default implementation returns the result of calling diff --git a/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlParser.cs b/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlParser.cs index d44d92f2..51833008 100644 --- a/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlParser.cs +++ b/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlParser.cs @@ -64,28 +64,28 @@ public const int RULE_procParamList = 13, RULE_procParam = 14, RULE_procParamName = 15, RULE_alterTableStatement = 16, RULE_alterTableAction = 17, RULE_procedureBody = 18, RULE_createIndexStatement = 19, RULE_dropStatement = 20, RULE_indexColumn = 21, - RULE_withOption = 22, RULE_columnDefinition = 23, RULE_dataType = 24, - RULE_signedInteger = 25, RULE_columnConstraint = 26, RULE_tableConstraint = 27, - RULE_checkBody = 28, RULE_foreignKeyAction = 29, RULE_referentialAction = 30, - RULE_insertStatement = 31, RULE_rowValues = 32, RULE_rowValue = 33, RULE_queryExpression = 34, - RULE_queryTerm = 35, RULE_setOperator = 36, RULE_querySpecification = 37, - RULE_selectPredicate = 38, RULE_groupByClause = 39, RULE_havingClause = 40, - RULE_topClause = 41, RULE_topOperand = 42, RULE_offsetFetchClause = 43, - RULE_rowKeyword = 44, RULE_selectList = 45, RULE_selectItem = 46, RULE_fromClause = 47, - RULE_tableSource = 48, RULE_tablePrimary = 49, RULE_joinClause = 50, RULE_joinType = 51, - RULE_whereClause = 52, RULE_orderByClause = 53, RULE_orderByItem = 54, - RULE_expression = 55, RULE_primary = 56, RULE_caseExpression = 57, RULE_caseWhen = 58, - RULE_functionCall = 59, RULE_functionName = 60, RULE_columnRef = 61, RULE_identifier = 62, - RULE_literal = 63, RULE_transactionStatement = 64, RULE_standaloneExpression = 65, - RULE_windowSpecification = 66; + RULE_withOption = 22, RULE_columnDefinition = 23, RULE_calculatedClause = 24, + RULE_dataType = 25, RULE_signedInteger = 26, RULE_columnConstraint = 27, + RULE_tableConstraint = 28, RULE_checkBody = 29, RULE_foreignKeyAction = 30, + RULE_referentialAction = 31, RULE_insertStatement = 32, RULE_rowValues = 33, + RULE_rowValue = 34, RULE_queryExpression = 35, RULE_queryTerm = 36, RULE_setOperator = 37, + RULE_querySpecification = 38, RULE_selectPredicate = 39, RULE_groupByClause = 40, + RULE_havingClause = 41, RULE_topClause = 42, RULE_topOperand = 43, RULE_offsetFetchClause = 44, + RULE_rowKeyword = 45, RULE_selectList = 46, RULE_selectItem = 47, RULE_fromClause = 48, + RULE_tableSource = 49, RULE_tablePrimary = 50, RULE_joinClause = 51, RULE_joinType = 52, + RULE_whereClause = 53, RULE_orderByClause = 54, RULE_orderByItem = 55, + RULE_expression = 56, RULE_primary = 57, RULE_caseExpression = 58, RULE_caseWhen = 59, + RULE_functionCall = 60, RULE_functionName = 61, RULE_columnRef = 62, RULE_identifier = 63, + RULE_literal = 64, RULE_transactionStatement = 65, RULE_standaloneExpression = 66, + RULE_windowSpecification = 67; public static readonly string[] ruleNames = { "statement", "ifThenStatement", "thenBody", "executeStatement", "updateStatement", "assignment", "deleteStatement", "systemVariableSelect", "sysVarItem", "parametersClause", "createTableStatement", "createViewStatement", "createProcedureStatement", "procParamList", "procParam", "procParamName", "alterTableStatement", "alterTableAction", "procedureBody", "createIndexStatement", "dropStatement", - "indexColumn", "withOption", "columnDefinition", "dataType", "signedInteger", - "columnConstraint", "tableConstraint", "checkBody", "foreignKeyAction", + "indexColumn", "withOption", "columnDefinition", "calculatedClause", "dataType", + "signedInteger", "columnConstraint", "tableConstraint", "checkBody", "foreignKeyAction", "referentialAction", "insertStatement", "rowValues", "rowValue", "queryExpression", "queryTerm", "setOperator", "querySpecification", "selectPredicate", "groupByClause", "havingClause", "topClause", "topOperand", "offsetFetchClause", "rowKeyword", @@ -229,115 +229,115 @@ public StatementContext statement() { try { EnterOuterAlt(_localctx, 1); { - State = 135; + State = 137; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==PARAMETERS) { { - State = 134; + State = 136; parametersClause(); } } - State = 151; + State = 153; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,1,Context) ) { case 1: { - State = 137; + State = 139; ifThenStatement(); } break; case 2: { - State = 138; + State = 140; createTableStatement(); } break; case 3: { - State = 139; + State = 141; createIndexStatement(); } break; case 4: { - State = 140; + State = 142; createViewStatement(); } break; case 5: { - State = 141; + State = 143; createProcedureStatement(); } break; case 6: { - State = 142; + State = 144; alterTableStatement(); } break; case 7: { - State = 143; + State = 145; dropStatement(); } break; case 8: { - State = 144; + State = 146; insertStatement(); } break; case 9: { - State = 145; + State = 147; updateStatement(); } break; case 10: { - State = 146; + State = 148; deleteStatement(); } break; case 11: { - State = 147; + State = 149; transactionStatement(); } break; case 12: { - State = 148; + State = 150; executeStatement(); } break; case 13: { - State = 149; + State = 151; systemVariableSelect(); } break; case 14: { - State = 150; + State = 152; queryExpression(); } break; } - State = 154; + State = 156; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==SEMI) { { - State = 153; + State = 155; Match(SEMI); } } - State = 156; + State = 158; Match(Eof); } } @@ -387,29 +387,29 @@ public IfThenStatementContext ifThenStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 158; - Match(IF); State = 160; + Match(IF); + State = 162; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NOT) { { - State = 159; + State = 161; _localctx.not = Match(NOT); } } - State = 162; + State = 164; Match(EXISTS); - State = 163; + State = 165; Match(LPAREN); - State = 164; + State = 166; queryExpression(); - State = 165; + State = 167; Match(RPAREN); - State = 166; + State = 168; Match(THEN); - State = 167; + State = 169; thenBody(); } } @@ -476,83 +476,83 @@ public ThenBodyContext thenBody() { ThenBodyContext _localctx = new ThenBodyContext(Context, State); EnterRule(_localctx, 4, RULE_thenBody); try { - State = 180; + State = 182; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 169; + State = 171; createTableStatement(); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 170; + State = 172; createIndexStatement(); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 171; + State = 173; createViewStatement(); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 172; + State = 174; createProcedureStatement(); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 173; + State = 175; alterTableStatement(); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 174; + State = 176; dropStatement(); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 175; + State = 177; insertStatement(); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 176; + State = 178; updateStatement(); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 177; + State = 179; deleteStatement(); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 178; + State = 180; executeStatement(); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 179; + State = 181; queryExpression(); } break; @@ -607,7 +607,7 @@ public ExecuteStatementContext executeStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 182; + State = 184; _la = TokenStream.LA(1); if ( !(_la==EXECUTE || _la==EXEC) ) { ErrorHandler.RecoverInline(this); @@ -616,28 +616,28 @@ public ExecuteStatementContext executeStatement() { ErrorHandler.ReportMatch(this); Consume(); } - State = 183; + State = 185; _localctx.name = identifier(); - State = 192; + State = 194; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 35596957585664L) != 0) || ((((_la - 97)) & ~0x3f) == 0 && ((1L << (_la - 97)) & 17171743773L) != 0)) { { - State = 184; + State = 186; expression(0); - State = 189; + State = 191; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 185; + State = 187; Match(COMMA); - State = 186; + State = 188; expression(0); } } - State = 191; + State = 193; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -697,36 +697,36 @@ public UpdateStatementContext updateStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 194; + State = 196; Match(UPDATE); - State = 195; + State = 197; tableSource(); - State = 196; + State = 198; Match(SET); - State = 197; + State = 199; assignment(); - State = 202; + State = 204; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 198; + State = 200; Match(COMMA); - State = 199; + State = 201; assignment(); } } - State = 204; + State = 206; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 206; + State = 208; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==WHERE) { { - State = 205; + State = 207; whereClause(); } } @@ -773,11 +773,11 @@ public AssignmentContext assignment() { try { EnterOuterAlt(_localctx, 1); { - State = 208; + State = 210; _localctx.target = columnRef(); - State = 209; + State = 211; Match(EQ); - State = 210; + State = 212; expression(0); } } @@ -828,26 +828,26 @@ public DeleteStatementContext deleteStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 212; + State = 214; Match(DELETE); - State = 218; + State = 220; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case BRACKET_ID: case BACKTICK_ID: case IDENTIFIER: { - State = 213; + State = 215; _localctx.target = identifier(); - State = 214; + State = 216; Match(DOT); - State = 215; + State = 217; Match(STAR); } break; case STAR: { - State = 217; + State = 219; Match(STAR); } break; @@ -856,16 +856,16 @@ public DeleteStatementContext deleteStatement() { default: break; } - State = 220; + State = 222; Match(FROM); - State = 221; - tableSource(); State = 223; + tableSource(); + State = 225; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==WHERE) { { - State = 222; + State = 224; whereClause(); } } @@ -916,23 +916,23 @@ public SystemVariableSelectContext systemVariableSelect() { try { EnterOuterAlt(_localctx, 1); { - State = 225; + State = 227; Match(SELECT); - State = 226; + State = 228; sysVarItem(); - State = 231; + State = 233; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 227; + State = 229; Match(COMMA); - State = 228; + State = 230; sysVarItem(); } } - State = 233; + State = 235; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -977,24 +977,24 @@ public SysVarItemContext sysVarItem() { try { EnterOuterAlt(_localctx, 1); { - State = 234; + State = 236; Match(SYSVAR); - State = 239; + State = 241; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 7L) != 0)) { { - State = 236; + State = 238; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS) { { - State = 235; + State = 237; Match(AS); } } - State = 238; + State = 240; _localctx.alias = identifier(); } } @@ -1046,27 +1046,27 @@ public ParametersClauseContext parametersClause() { try { EnterOuterAlt(_localctx, 1); { - State = 241; + State = 243; Match(PARAMETERS); - State = 242; + State = 244; procParam(); - State = 247; + State = 249; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 243; + State = 245; Match(COMMA); - State = 244; + State = 246; procParam(); } } - State = 249; + State = 251; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 250; + State = 252; Match(SEMI); } } @@ -1130,61 +1130,61 @@ public CreateTableStatementContext createTableStatement() { int _alt; EnterOuterAlt(_localctx, 1); { - State = 252; - Match(CREATE); State = 254; + Match(CREATE); + State = 256; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==TEMPORARY) { { - State = 253; + State = 255; _localctx.temp = Match(TEMPORARY); } } - State = 256; + State = 258; Match(TABLE); - State = 257; + State = 259; _localctx.table = identifier(); - State = 258; + State = 260; Match(LPAREN); - State = 259; + State = 261; columnDefinition(); - State = 264; + State = 266; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,16,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 260; + State = 262; Match(COMMA); - State = 261; + State = 263; columnDefinition(); } } } - State = 266; + State = 268; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,16,Context); } - State = 271; + State = 273; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 267; + State = 269; Match(COMMA); - State = 268; + State = 270; tableConstraint(); } } - State = 273; + State = 275; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 274; + State = 276; Match(RPAREN); } } @@ -1243,47 +1243,47 @@ public CreateViewStatementContext createViewStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 276; + State = 278; Match(CREATE); - State = 277; + State = 279; Match(VIEW); - State = 278; + State = 280; _localctx.name = identifier(); - State = 290; + State = 292; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==LPAREN) { { - State = 279; + State = 281; Match(LPAREN); - State = 280; + State = 282; _localctx._identifier = identifier(); _localctx._columns.Add(_localctx._identifier); - State = 285; + State = 287; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 281; + State = 283; Match(COMMA); - State = 282; + State = 284; _localctx._identifier = identifier(); _localctx._columns.Add(_localctx._identifier); } } - State = 287; + State = 289; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 288; + State = 290; Match(RPAREN); } } - State = 292; + State = 294; Match(AS); - State = 293; + State = 295; _localctx.query = queryExpression(); } } @@ -1334,25 +1334,25 @@ public CreateProcedureStatementContext createProcedureStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 295; + State = 297; Match(CREATE); - State = 296; + State = 298; Match(PROCEDURE); - State = 297; - _localctx.name = identifier(); State = 299; + _localctx.name = identifier(); + State = 301; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (((((_la - 115)) & ~0x3f) == 0 && ((1L << (_la - 115)) & 57409L) != 0)) { { - State = 298; + State = 300; procParamList(); } } - State = 301; + State = 303; Match(AS); - State = 302; + State = 304; _localctx.body = procedureBody(); } } @@ -1399,33 +1399,33 @@ public ProcParamListContext procParamList() { EnterRule(_localctx, 26, RULE_procParamList); int _la; try { - State = 323; + State = 325; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case LPAREN: EnterOuterAlt(_localctx, 1); { - State = 304; + State = 306; Match(LPAREN); - State = 305; + State = 307; procParam(); - State = 310; + State = 312; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 306; + State = 308; Match(COMMA); - State = 307; + State = 309; procParam(); } } - State = 312; + State = 314; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 313; + State = 315; Match(RPAREN); } break; @@ -1435,21 +1435,21 @@ public ProcParamListContext procParamList() { case IDENTIFIER: EnterOuterAlt(_localctx, 2); { - State = 315; + State = 317; procParam(); - State = 320; + State = 322; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 316; + State = 318; Match(COMMA); - State = 317; + State = 319; procParam(); } } - State = 322; + State = 324; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1498,9 +1498,9 @@ public ProcParamContext procParam() { try { EnterOuterAlt(_localctx, 1); { - State = 325; + State = 327; _localctx.pname = procParamName(); - State = 326; + State = 328; dataType(); } } @@ -1538,7 +1538,7 @@ public ProcParamNameContext procParamName() { ProcParamNameContext _localctx = new ProcParamNameContext(Context, State); EnterRule(_localctx, 30, RULE_procParamName); try { - State = 330; + State = 332; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case BRACKET_ID: @@ -1546,14 +1546,14 @@ public ProcParamNameContext procParamName() { case IDENTIFIER: EnterOuterAlt(_localctx, 1); { - State = 328; + State = 330; identifier(); } break; case PARAM: EnterOuterAlt(_localctx, 2); { - State = 329; + State = 331; Match(PARAM); } break; @@ -1602,13 +1602,13 @@ public AlterTableStatementContext alterTableStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 332; + State = 334; Match(ALTER); - State = 333; + State = 335; Match(TABLE); - State = 334; + State = 336; _localctx.table = identifier(); - State = 335; + State = 337; alterTableAction(); } } @@ -1815,26 +1815,26 @@ public AlterTableActionContext alterTableAction() { EnterRule(_localctx, 34, RULE_alterTableAction); int _la; try { - State = 394; + State = 396; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,30,Context) ) { case 1: _localctx = new AddColumnActionContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 337; - Match(ADD); State = 339; + Match(ADD); + State = 341; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==COLUMN) { { - State = 338; + State = 340; Match(COLUMN); } } - State = 341; + State = 343; columnDefinition(); } break; @@ -1842,9 +1842,9 @@ public AlterTableActionContext alterTableAction() { _localctx = new AddConstraintActionContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 342; + State = 344; Match(ADD); - State = 343; + State = 345; tableConstraint(); } break; @@ -1852,33 +1852,33 @@ public AlterTableActionContext alterTableAction() { _localctx = new AlterColumnActionContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 344; - Match(ALTER); State = 346; + Match(ALTER); + State = 348; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==COLUMN) { { - State = 345; + State = 347; Match(COLUMN); } } - State = 348; + State = 350; ((AlterColumnActionContext)_localctx).field = identifier(); - State = 349; + State = 351; dataType(); - State = 353; + State = 355; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==NOT || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & 2149656597L) != 0)) { { { - State = 350; + State = 352; columnConstraint(); } } - State = 355; + State = 357; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -1888,25 +1888,25 @@ public AlterTableActionContext alterTableAction() { _localctx = new AlterColumnSetDefaultActionContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 356; - Match(ALTER); State = 358; + Match(ALTER); + State = 360; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==COLUMN) { { - State = 357; + State = 359; Match(COLUMN); } } - State = 360; + State = 362; ((AlterColumnSetDefaultActionContext)_localctx).field = identifier(); - State = 361; + State = 363; Match(SET); - State = 362; + State = 364; Match(DEFAULT); - State = 363; + State = 365; expression(0); } break; @@ -1914,23 +1914,23 @@ public AlterTableActionContext alterTableAction() { _localctx = new AlterColumnDropDefaultActionContext(_localctx); EnterOuterAlt(_localctx, 5); { - State = 365; - Match(ALTER); State = 367; + Match(ALTER); + State = 369; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==COLUMN) { { - State = 366; + State = 368; Match(COLUMN); } } - State = 369; + State = 371; ((AlterColumnDropDefaultActionContext)_localctx).field = identifier(); - State = 370; + State = 372; Match(DROP); - State = 371; + State = 373; Match(DEFAULT); } break; @@ -1938,11 +1938,11 @@ public AlterTableActionContext alterTableAction() { _localctx = new DropColumnActionContext(_localctx); EnterOuterAlt(_localctx, 6); { - State = 373; + State = 375; Match(DROP); - State = 374; + State = 376; Match(COLUMN); - State = 375; + State = 377; ((DropColumnActionContext)_localctx).field = identifier(); } break; @@ -1950,11 +1950,11 @@ public AlterTableActionContext alterTableAction() { _localctx = new DropConstraintActionContext(_localctx); EnterOuterAlt(_localctx, 7); { - State = 376; + State = 378; Match(DROP); - State = 377; + State = 379; Match(CONSTRAINT); - State = 378; + State = 380; ((DropConstraintActionContext)_localctx).cname = identifier(); } break; @@ -1962,11 +1962,11 @@ public AlterTableActionContext alterTableAction() { _localctx = new RenameTableActionContext(_localctx); EnterOuterAlt(_localctx, 8); { - State = 379; + State = 381; Match(RENAME); - State = 380; + State = 382; Match(TO); - State = 381; + State = 383; ((RenameTableActionContext)_localctx).newName = identifier(); } break; @@ -1974,15 +1974,15 @@ public AlterTableActionContext alterTableAction() { _localctx = new RenameColumnActionContext(_localctx); EnterOuterAlt(_localctx, 9); { - State = 382; + State = 384; Match(RENAME); - State = 383; + State = 385; Match(COLUMN); - State = 384; + State = 386; ((RenameColumnActionContext)_localctx).field = identifier(); - State = 385; + State = 387; Match(TO); - State = 386; + State = 388; ((RenameColumnActionContext)_localctx).newName = identifier(); } break; @@ -1990,15 +1990,15 @@ public AlterTableActionContext alterTableAction() { _localctx = new RenameIndexActionContext(_localctx); EnterOuterAlt(_localctx, 10); { - State = 388; + State = 390; Match(RENAME); - State = 389; + State = 391; Match(INDEX); - State = 390; + State = 392; ((RenameIndexActionContext)_localctx).index = identifier(); - State = 391; + State = 393; Match(TO); - State = 392; + State = 394; ((RenameIndexActionContext)_localctx).newName = identifier(); } break; @@ -2043,7 +2043,7 @@ public ProcedureBodyContext procedureBody() { ProcedureBodyContext _localctx = new ProcedureBodyContext(Context, State); EnterRule(_localctx, 36, RULE_procedureBody); try { - State = 399; + State = 401; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case SELECT: @@ -2051,21 +2051,21 @@ public ProcedureBodyContext procedureBody() { case LPAREN: EnterOuterAlt(_localctx, 1); { - State = 396; + State = 398; queryExpression(); } break; case INSERT: EnterOuterAlt(_localctx, 2); { - State = 397; + State = 399; insertStatement(); } break; case CREATE: EnterOuterAlt(_localctx, 3); { - State = 398; + State = 400; createTableStatement(); } break; @@ -2135,56 +2135,56 @@ public CreateIndexStatementContext createIndexStatement() { try { EnterOuterAlt(_localctx, 1); { - State = 401; - Match(CREATE); State = 403; + Match(CREATE); + State = 405; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==UNIQUE) { { - State = 402; + State = 404; _localctx.unique = Match(UNIQUE); } } - State = 405; + State = 407; Match(INDEX); - State = 406; + State = 408; _localctx.name = identifier(); - State = 407; + State = 409; Match(ON); - State = 408; + State = 410; _localctx.table = identifier(); - State = 409; + State = 411; Match(LPAREN); - State = 410; + State = 412; indexColumn(); - State = 415; + State = 417; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 411; + State = 413; Match(COMMA); - State = 412; + State = 414; indexColumn(); } } - State = 417; + State = 419; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 418; + State = 420; Match(RPAREN); - State = 421; + State = 423; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==WITH) { { - State = 419; + State = 421; Match(WITH); - State = 420; + State = 422; withOption(); } } @@ -2285,18 +2285,18 @@ public DropStatementContext dropStatement() { DropStatementContext _localctx = new DropStatementContext(Context, State); EnterRule(_localctx, 40, RULE_dropStatement); try { - State = 438; + State = 440; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,35,Context) ) { case 1: _localctx = new DropTableStatementContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 423; + State = 425; Match(DROP); - State = 424; + State = 426; Match(TABLE); - State = 425; + State = 427; ((DropTableStatementContext)_localctx).table = identifier(); } break; @@ -2304,15 +2304,15 @@ public DropStatementContext dropStatement() { _localctx = new DropIndexStatementContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 426; + State = 428; Match(DROP); - State = 427; + State = 429; Match(INDEX); - State = 428; + State = 430; ((DropIndexStatementContext)_localctx).index = identifier(); - State = 429; + State = 431; Match(ON); - State = 430; + State = 432; ((DropIndexStatementContext)_localctx).table = identifier(); } break; @@ -2320,11 +2320,11 @@ public DropStatementContext dropStatement() { _localctx = new DropProcedureStatementContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 432; + State = 434; Match(DROP); - State = 433; + State = 435; Match(PROCEDURE); - State = 434; + State = 436; ((DropProcedureStatementContext)_localctx).proc = identifier(); } break; @@ -2332,11 +2332,11 @@ public DropStatementContext dropStatement() { _localctx = new DropViewStatementContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 435; + State = 437; Match(DROP); - State = 436; + State = 438; Match(VIEW); - State = 437; + State = 439; ((DropViewStatementContext)_localctx).view = identifier(); } break; @@ -2382,14 +2382,14 @@ public IndexColumnContext indexColumn() { try { EnterOuterAlt(_localctx, 1); { - State = 440; - _localctx.col = identifier(); State = 442; + _localctx.col = identifier(); + State = 444; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ASC || _la==DESC) { { - State = 441; + State = 443; _localctx.dir = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !(_la==ASC || _la==DESC) ) { @@ -2465,14 +2465,14 @@ public WithOptionContext withOption() { WithOptionContext _localctx = new WithOptionContext(Context, State); EnterRule(_localctx, 44, RULE_withOption); try { - State = 449; + State = 451; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case PRIMARY: _localctx = new WithPrimaryContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 444; + State = 446; Match(PRIMARY); } break; @@ -2480,9 +2480,9 @@ public WithOptionContext withOption() { _localctx = new WithDisallowNullContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 445; + State = 447; Match(DISALLOW); - State = 446; + State = 448; Match(NULL); } break; @@ -2490,9 +2490,9 @@ public WithOptionContext withOption() { _localctx = new WithIgnoreNullContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 447; + State = 449; Match(IGNORE); - State = 448; + State = 450; Match(NULL); } break; @@ -2519,6 +2519,9 @@ [System.Diagnostics.DebuggerNonUserCode] public DataTypeContext dataType() { [System.Diagnostics.DebuggerNonUserCode] public IdentifierContext identifier() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public CalculatedClauseContext calculatedClause() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public ColumnConstraintContext[] columnConstraint() { return GetRuleContexts(); } @@ -2546,21 +2549,31 @@ public ColumnDefinitionContext columnDefinition() { try { EnterOuterAlt(_localctx, 1); { - State = 451; + State = 453; _localctx.name = identifier(); - State = 452; + State = 454; dataType(); State = 456; ErrorHandler.Sync(this); _la = TokenStream.LA(1); + if (_la==AS) { + { + State = 455; + calculatedClause(); + } + } + + State = 461; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); while (_la==NOT || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & 2149656597L) != 0)) { { { - State = 453; + State = 458; columnConstraint(); } } - State = 458; + State = 463; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2577,6 +2590,54 @@ public ColumnDefinitionContext columnDefinition() { return _localctx; } + public partial class CalculatedClauseContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode AS() { return GetToken(AccessSqlParser.AS, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPAREN() { return GetToken(AccessSqlParser.LPAREN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExpressionContext expression() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RPAREN() { return GetToken(AccessSqlParser.RPAREN, 0); } + public CalculatedClauseContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_calculatedClause; } } + [System.Diagnostics.DebuggerNonUserCode] + public override TResult Accept(IParseTreeVisitor visitor) { + IAccessSqlVisitor typedVisitor = visitor as IAccessSqlVisitor; + if (typedVisitor != null) return typedVisitor.VisitCalculatedClause(this); + else return visitor.VisitChildren(this); + } + } + + [RuleVersion(0)] + public CalculatedClauseContext calculatedClause() { + CalculatedClauseContext _localctx = new CalculatedClauseContext(Context, State); + EnterRule(_localctx, 48, RULE_calculatedClause); + try { + EnterOuterAlt(_localctx, 1); + { + State = 464; + Match(AS); + State = 465; + Match(LPAREN); + State = 466; + expression(0); + State = 467; + Match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + public partial class DataTypeContext : ParserRuleContext { public IdentifierContext typeName; public IdentifierContext extra; @@ -2614,55 +2675,55 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public DataTypeContext dataType() { DataTypeContext _localctx = new DataTypeContext(Context, State); - EnterRule(_localctx, 48, RULE_dataType); + EnterRule(_localctx, 50, RULE_dataType); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 459; + State = 469; _localctx.typeName = identifier(); - State = 461; + State = 471; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,39,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,40,Context) ) { case 1: { - State = 460; + State = 470; _localctx.extra = identifier(); } break; } - State = 464; + State = 474; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 7L) != 0)) { { - State = 463; + State = 473; _localctx.extra2 = identifier(); } } - State = 474; + State = 484; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==LPAREN) { { - State = 466; + State = 476; Match(LPAREN); - State = 467; + State = 477; _localctx.size = signedInteger(); - State = 470; + State = 480; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==COMMA) { { - State = 468; + State = 478; Match(COMMA); - State = 469; + State = 479; _localctx.scale = signedInteger(); } } - State = 472; + State = 482; Match(RPAREN); } } @@ -2699,22 +2760,22 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public SignedIntegerContext signedInteger() { SignedIntegerContext _localctx = new SignedIntegerContext(Context, State); - EnterRule(_localctx, 50, RULE_signedInteger); + EnterRule(_localctx, 52, RULE_signedInteger); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 477; + State = 487; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==MINUS) { { - State = 476; + State = 486; Match(MINUS); } } - State = 479; + State = 489; Match(INTEGER_LITERAL); } } @@ -2875,19 +2936,19 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ColumnConstraintContext columnConstraint() { ColumnConstraintContext _localctx = new ColumnConstraintContext(Context, State); - EnterRule(_localctx, 52, RULE_columnConstraint); + EnterRule(_localctx, 54, RULE_columnConstraint); int _la; try { - State = 533; + State = 543; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,51,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,52,Context) ) { case 1: _localctx = new NotNullConstraintContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 481; + State = 491; Match(NOT); - State = 482; + State = 492; Match(NULL); } break; @@ -2895,7 +2956,7 @@ public ColumnConstraintContext columnConstraint() { _localctx = new NullableConstraintContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 483; + State = 493; Match(NULL); } break; @@ -2903,9 +2964,9 @@ public ColumnConstraintContext columnConstraint() { _localctx = new DefaultConstraintContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 484; + State = 494; Match(DEFAULT); - State = 485; + State = 495; expression(0); } break; @@ -2913,9 +2974,9 @@ public ColumnConstraintContext columnConstraint() { _localctx = new CompressionConstraintContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 486; + State = 496; Match(WITH); - State = 487; + State = 497; _la = TokenStream.LA(1); if ( !(_la==COMPRESSION || _la==COMP) ) { ErrorHandler.RecoverInline(this); @@ -2930,25 +2991,25 @@ public ColumnConstraintContext columnConstraint() { _localctx = new CheckColumnConstraintContext(_localctx); EnterOuterAlt(_localctx, 5); { - State = 490; + State = 500; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 488; + State = 498; Match(CONSTRAINT); - State = 489; + State = 499; ((CheckColumnConstraintContext)_localctx).cname = identifier(); } } - State = 492; + State = 502; Match(CHECK); - State = 493; + State = 503; Match(LPAREN); - State = 494; + State = 504; checkBody(); - State = 495; + State = 505; Match(RPAREN); } break; @@ -2956,21 +3017,21 @@ public ColumnConstraintContext columnConstraint() { _localctx = new PrimaryKeyConstraintContext(_localctx); EnterOuterAlt(_localctx, 6); { - State = 499; + State = 509; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 497; + State = 507; Match(CONSTRAINT); - State = 498; + State = 508; ((PrimaryKeyConstraintContext)_localctx).cname = identifier(); } } - State = 501; + State = 511; Match(PRIMARY); - State = 502; + State = 512; Match(KEY); } break; @@ -2978,19 +3039,19 @@ public ColumnConstraintContext columnConstraint() { _localctx = new UniqueColumnConstraintContext(_localctx); EnterOuterAlt(_localctx, 7); { - State = 505; + State = 515; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 503; + State = 513; Match(CONSTRAINT); - State = 504; + State = 514; ((UniqueColumnConstraintContext)_localctx).cname = identifier(); } } - State = 507; + State = 517; Match(UNIQUE); } break; @@ -2998,65 +3059,65 @@ public ColumnConstraintContext columnConstraint() { _localctx = new ColumnReferencesConstraintContext(_localctx); EnterOuterAlt(_localctx, 8); { - State = 510; + State = 520; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 508; + State = 518; Match(CONSTRAINT); - State = 509; + State = 519; ((ColumnReferencesConstraintContext)_localctx).cname = identifier(); } } - State = 512; + State = 522; Match(REFERENCES); - State = 513; + State = 523; ((ColumnReferencesConstraintContext)_localctx).refTable = identifier(); - State = 525; + State = 535; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==LPAREN) { { - State = 514; + State = 524; Match(LPAREN); - State = 515; + State = 525; ((ColumnReferencesConstraintContext)_localctx)._identifier = identifier(); ((ColumnReferencesConstraintContext)_localctx)._refColumns.Add(((ColumnReferencesConstraintContext)_localctx)._identifier); - State = 520; + State = 530; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 516; + State = 526; Match(COMMA); - State = 517; + State = 527; ((ColumnReferencesConstraintContext)_localctx)._identifier = identifier(); ((ColumnReferencesConstraintContext)_localctx)._refColumns.Add(((ColumnReferencesConstraintContext)_localctx)._identifier); } } - State = 522; + State = 532; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 523; + State = 533; Match(RPAREN); } } - State = 530; + State = 540; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==ON) { { { - State = 527; + State = 537; foreignKeyAction(); } } - State = 532; + State = 542; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3209,55 +3270,55 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TableConstraintContext tableConstraint() { TableConstraintContext _localctx = new TableConstraintContext(Context, State); - EnterRule(_localctx, 54, RULE_tableConstraint); + EnterRule(_localctx, 56, RULE_tableConstraint); int _la; try { - State = 618; + State = 628; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,63,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,64,Context) ) { case 1: _localctx = new PrimaryKeyTableConstraintContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 537; + State = 547; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 535; + State = 545; Match(CONSTRAINT); - State = 536; + State = 546; ((PrimaryKeyTableConstraintContext)_localctx).name = identifier(); } } - State = 539; + State = 549; Match(PRIMARY); - State = 540; + State = 550; Match(KEY); - State = 541; + State = 551; Match(LPAREN); - State = 542; + State = 552; ((PrimaryKeyTableConstraintContext)_localctx)._identifier = identifier(); ((PrimaryKeyTableConstraintContext)_localctx)._columns.Add(((PrimaryKeyTableConstraintContext)_localctx)._identifier); - State = 547; + State = 557; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 543; + State = 553; Match(COMMA); - State = 544; + State = 554; ((PrimaryKeyTableConstraintContext)_localctx)._identifier = identifier(); ((PrimaryKeyTableConstraintContext)_localctx)._columns.Add(((PrimaryKeyTableConstraintContext)_localctx)._identifier); } } - State = 549; + State = 559; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 550; + State = 560; Match(RPAREN); } break; @@ -3265,43 +3326,43 @@ public TableConstraintContext tableConstraint() { _localctx = new UniqueTableConstraintContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 554; + State = 564; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 552; + State = 562; Match(CONSTRAINT); - State = 553; + State = 563; ((UniqueTableConstraintContext)_localctx).name = identifier(); } } - State = 556; + State = 566; Match(UNIQUE); - State = 557; + State = 567; Match(LPAREN); - State = 558; + State = 568; ((UniqueTableConstraintContext)_localctx)._identifier = identifier(); ((UniqueTableConstraintContext)_localctx)._columns.Add(((UniqueTableConstraintContext)_localctx)._identifier); - State = 563; + State = 573; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 559; + State = 569; Match(COMMA); - State = 560; + State = 570; ((UniqueTableConstraintContext)_localctx)._identifier = identifier(); ((UniqueTableConstraintContext)_localctx)._columns.Add(((UniqueTableConstraintContext)_localctx)._identifier); } } - State = 565; + State = 575; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 566; + State = 576; Match(RPAREN); } break; @@ -3309,105 +3370,105 @@ public TableConstraintContext tableConstraint() { _localctx = new ForeignKeyTableConstraintContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 570; + State = 580; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 568; + State = 578; Match(CONSTRAINT); - State = 569; + State = 579; ((ForeignKeyTableConstraintContext)_localctx).name = identifier(); } } - State = 572; + State = 582; Match(FOREIGN); - State = 573; + State = 583; Match(KEY); - State = 576; + State = 586; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NO) { { - State = 574; + State = 584; ((ForeignKeyTableConstraintContext)_localctx).noIndex = Match(NO); - State = 575; + State = 585; Match(INDEX); } } - State = 578; + State = 588; Match(LPAREN); - State = 579; + State = 589; ((ForeignKeyTableConstraintContext)_localctx)._identifier = identifier(); ((ForeignKeyTableConstraintContext)_localctx)._columns.Add(((ForeignKeyTableConstraintContext)_localctx)._identifier); - State = 584; + State = 594; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 580; + State = 590; Match(COMMA); - State = 581; + State = 591; ((ForeignKeyTableConstraintContext)_localctx)._identifier = identifier(); ((ForeignKeyTableConstraintContext)_localctx)._columns.Add(((ForeignKeyTableConstraintContext)_localctx)._identifier); } } - State = 586; + State = 596; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 587; + State = 597; Match(RPAREN); - State = 588; + State = 598; Match(REFERENCES); - State = 589; + State = 599; ((ForeignKeyTableConstraintContext)_localctx).refTable = identifier(); - State = 601; + State = 611; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==LPAREN) { { - State = 590; + State = 600; Match(LPAREN); - State = 591; + State = 601; ((ForeignKeyTableConstraintContext)_localctx)._identifier = identifier(); ((ForeignKeyTableConstraintContext)_localctx)._refColumns.Add(((ForeignKeyTableConstraintContext)_localctx)._identifier); - State = 596; + State = 606; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 592; + State = 602; Match(COMMA); - State = 593; + State = 603; ((ForeignKeyTableConstraintContext)_localctx)._identifier = identifier(); ((ForeignKeyTableConstraintContext)_localctx)._refColumns.Add(((ForeignKeyTableConstraintContext)_localctx)._identifier); } } - State = 598; + State = 608; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 599; + State = 609; Match(RPAREN); } } - State = 606; + State = 616; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==ON) { { { - State = 603; + State = 613; foreignKeyAction(); } } - State = 608; + State = 618; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3417,25 +3478,25 @@ public TableConstraintContext tableConstraint() { _localctx = new CheckTableConstraintContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 611; + State = 621; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==CONSTRAINT) { { - State = 609; + State = 619; Match(CONSTRAINT); - State = 610; + State = 620; ((CheckTableConstraintContext)_localctx).name = identifier(); } } - State = 613; + State = 623; Match(CHECK); - State = 614; + State = 624; Match(LPAREN); - State = 615; + State = 625; checkBody(); - State = 616; + State = 626; Match(RPAREN); } break; @@ -3483,17 +3544,17 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public CheckBodyContext checkBody() { CheckBodyContext _localctx = new CheckBodyContext(Context, State); - EnterRule(_localctx, 56, RULE_checkBody); + EnterRule(_localctx, 58, RULE_checkBody); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 627; + State = 637; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & -2L) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & -4503599627370497L) != 0) || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 63L) != 0)) { { - State = 625; + State = 635; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case SELECT: @@ -3628,7 +3689,7 @@ public CheckBodyContext checkBody() { case LINE_COMMENT: case BLOCK_COMMENT: { - State = 620; + State = 630; _la = TokenStream.LA(1); if ( _la <= 0 || (_la==LPAREN || _la==RPAREN) ) { ErrorHandler.RecoverInline(this); @@ -3641,11 +3702,11 @@ public CheckBodyContext checkBody() { break; case LPAREN: { - State = 621; + State = 631; Match(LPAREN); - State = 622; + State = 632; checkBody(); - State = 623; + State = 633; Match(RPAREN); } break; @@ -3653,7 +3714,7 @@ public CheckBodyContext checkBody() { throw new NoViableAltException(this); } } - State = 629; + State = 639; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3714,20 +3775,20 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ForeignKeyActionContext foreignKeyAction() { ForeignKeyActionContext _localctx = new ForeignKeyActionContext(Context, State); - EnterRule(_localctx, 58, RULE_foreignKeyAction); + EnterRule(_localctx, 60, RULE_foreignKeyAction); try { - State = 636; + State = 646; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,66,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,67,Context) ) { case 1: _localctx = new OnUpdateActionContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 630; + State = 640; Match(ON); - State = 631; + State = 641; Match(UPDATE); - State = 632; + State = 642; referentialAction(); } break; @@ -3735,11 +3796,11 @@ public ForeignKeyActionContext foreignKeyAction() { _localctx = new OnDeleteActionContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 633; + State = 643; Match(ON); - State = 634; + State = 644; Match(DELETE); - State = 635; + State = 645; referentialAction(); } break; @@ -3825,16 +3886,16 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ReferentialActionContext referentialAction() { ReferentialActionContext _localctx = new ReferentialActionContext(Context, State); - EnterRule(_localctx, 60, RULE_referentialAction); + EnterRule(_localctx, 62, RULE_referentialAction); try { - State = 646; + State = 656; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,67,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,68,Context) ) { case 1: _localctx = new CascadeActionContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 638; + State = 648; Match(CASCADE); } break; @@ -3842,9 +3903,9 @@ public ReferentialActionContext referentialAction() { _localctx = new NoActionActionContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 639; + State = 649; Match(NO); - State = 640; + State = 650; Match(ACTION); } break; @@ -3852,7 +3913,7 @@ public ReferentialActionContext referentialAction() { _localctx = new RestrictActionContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 641; + State = 651; Match(RESTRICT); } break; @@ -3860,9 +3921,9 @@ public ReferentialActionContext referentialAction() { _localctx = new SetNullActionContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 642; + State = 652; Match(SET); - State = 643; + State = 653; Match(NULL); } break; @@ -3870,9 +3931,9 @@ public ReferentialActionContext referentialAction() { _localctx = new SetDefaultActionContext(_localctx); EnterOuterAlt(_localctx, 5); { - State = 644; + State = 654; Match(SET); - State = 645; + State = 655; Match(DEFAULT); } break; @@ -3935,78 +3996,78 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public InsertStatementContext insertStatement() { InsertStatementContext _localctx = new InsertStatementContext(Context, State); - EnterRule(_localctx, 62, RULE_insertStatement); + EnterRule(_localctx, 64, RULE_insertStatement); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 648; + State = 658; Match(INSERT); - State = 649; + State = 659; Match(INTO); - State = 650; + State = 660; _localctx.table = identifier(); - State = 678; + State = 688; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case SELECT: case VALUES: case LPAREN: { - State = 662; + State = 672; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,69,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,70,Context) ) { case 1: { - State = 651; + State = 661; Match(LPAREN); - State = 652; + State = 662; _localctx._identifier = identifier(); _localctx._columns.Add(_localctx._identifier); - State = 657; + State = 667; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 653; + State = 663; Match(COMMA); - State = 654; + State = 664; _localctx._identifier = identifier(); _localctx._columns.Add(_localctx._identifier); } } - State = 659; + State = 669; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 660; + State = 670; Match(RPAREN); } break; } - State = 674; + State = 684; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,71,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,72,Context) ) { case 1: { - State = 664; + State = 674; Match(VALUES); - State = 665; + State = 675; rowValues(); - State = 670; + State = 680; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 666; + State = 676; Match(COMMA); - State = 667; + State = 677; rowValues(); } } - State = 672; + State = 682; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -4014,7 +4075,7 @@ public InsertStatementContext insertStatement() { break; case 2: { - State = 673; + State = 683; _localctx.source = queryExpression(); } break; @@ -4023,9 +4084,9 @@ public InsertStatementContext insertStatement() { break; case DEFAULT: { - State = 676; + State = 686; Match(DEFAULT); - State = 677; + State = 687; Match(VALUES); } break; @@ -4074,32 +4135,32 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public RowValuesContext rowValues() { RowValuesContext _localctx = new RowValuesContext(Context, State); - EnterRule(_localctx, 64, RULE_rowValues); + EnterRule(_localctx, 66, RULE_rowValues); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 680; + State = 690; Match(LPAREN); - State = 681; + State = 691; rowValue(); - State = 686; + State = 696; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 682; + State = 692; Match(COMMA); - State = 683; + State = 693; rowValue(); } } - State = 688; + State = 698; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 689; + State = 699; Match(RPAREN); } } @@ -4135,15 +4196,15 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public RowValueContext rowValue() { RowValueContext _localctx = new RowValueContext(Context, State); - EnterRule(_localctx, 66, RULE_rowValue); + EnterRule(_localctx, 68, RULE_rowValue); try { - State = 693; + State = 703; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case DEFAULT: EnterOuterAlt(_localctx, 1); { - State = 691; + State = 701; Match(DEFAULT); } break; @@ -4174,7 +4235,7 @@ public RowValueContext rowValue() { case IDENTIFIER: EnterOuterAlt(_localctx, 2); { - State = 692; + State = 702; expression(0); } break; @@ -4228,45 +4289,45 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public QueryExpressionContext queryExpression() { QueryExpressionContext _localctx = new QueryExpressionContext(Context, State); - EnterRule(_localctx, 68, RULE_queryExpression); + EnterRule(_localctx, 70, RULE_queryExpression); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 695; + State = 705; queryTerm(); - State = 701; + State = 711; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 14636698788954112L) != 0)) { { { - State = 696; + State = 706; setOperator(); - State = 697; + State = 707; queryTerm(); } } - State = 703; + State = 713; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 705; + State = 715; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ORDER) { { - State = 704; + State = 714; orderByClause(); } } - State = 708; + State = 718; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==OFFSET || _la==FETCH) { { - State = 707; + State = 717; offsetFetchClause(); } } @@ -4346,17 +4407,17 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public QueryTermContext queryTerm() { QueryTermContext _localctx = new QueryTermContext(Context, State); - EnterRule(_localctx, 70, RULE_queryTerm); + EnterRule(_localctx, 72, RULE_queryTerm); int _la; try { - State = 724; + State = 734; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case SELECT: _localctx = new SelectTermContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 710; + State = 720; querySpecification(); } break; @@ -4364,11 +4425,11 @@ public QueryTermContext queryTerm() { _localctx = new ParenTermContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 711; + State = 721; Match(LPAREN); - State = 712; + State = 722; queryExpression(); - State = 713; + State = 723; Match(RPAREN); } break; @@ -4376,23 +4437,23 @@ public QueryTermContext queryTerm() { _localctx = new ValuesTermContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 715; + State = 725; Match(VALUES); - State = 716; + State = 726; rowValues(); - State = 721; + State = 731; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 717; + State = 727; Match(COMMA); - State = 718; + State = 728; rowValues(); } } - State = 723; + State = 733; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -4434,23 +4495,23 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public SetOperatorContext setOperator() { SetOperatorContext _localctx = new SetOperatorContext(Context, State); - EnterRule(_localctx, 72, RULE_setOperator); + EnterRule(_localctx, 74, RULE_setOperator); int _la; try { - State = 732; + State = 742; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case UNION: EnterOuterAlt(_localctx, 1); { - State = 726; + State = 736; Match(UNION); - State = 728; + State = 738; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ALL) { { - State = 727; + State = 737; Match(ALL); } } @@ -4460,14 +4521,14 @@ public SetOperatorContext setOperator() { case INTERSECT: EnterOuterAlt(_localctx, 2); { - State = 730; + State = 740; Match(INTERSECT); } break; case EXCEPT: EnterOuterAlt(_localctx, 3); { - State = 731; + State = 741; Match(EXCEPT); } break; @@ -4531,83 +4592,83 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public QuerySpecificationContext querySpecification() { QuerySpecificationContext _localctx = new QuerySpecificationContext(Context, State); - EnterRule(_localctx, 74, RULE_querySpecification); + EnterRule(_localctx, 76, RULE_querySpecification); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 734; + State = 744; Match(SELECT); - State = 736; + State = 746; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 2251806256136192L) != 0)) { { - State = 735; + State = 745; _localctx.predicate = selectPredicate(); } } - State = 739; + State = 749; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==TOP) { { - State = 738; + State = 748; topClause(); } } - State = 741; + State = 751; selectList(); - State = 744; + State = 754; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==INTO) { { - State = 742; + State = 752; Match(INTO); - State = 743; + State = 753; _localctx.into = identifier(); } } - State = 747; + State = 757; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==FROM) { { - State = 746; + State = 756; fromClause(); } } - State = 750; + State = 760; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==WHERE) { { - State = 749; + State = 759; whereClause(); } } - State = 753; + State = 763; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==GROUP) { { - State = 752; + State = 762; groupByClause(); } } - State = 756; + State = 766; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==HAVING) { { - State = 755; + State = 765; havingClause(); } } @@ -4645,12 +4706,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public SelectPredicateContext selectPredicate() { SelectPredicateContext _localctx = new SelectPredicateContext(Context, State); - EnterRule(_localctx, 76, RULE_selectPredicate); + EnterRule(_localctx, 78, RULE_selectPredicate); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 758; + State = 768; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 2251806256136192L) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -4701,30 +4762,30 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public GroupByClauseContext groupByClause() { GroupByClauseContext _localctx = new GroupByClauseContext(Context, State); - EnterRule(_localctx, 78, RULE_groupByClause); + EnterRule(_localctx, 80, RULE_groupByClause); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 760; + State = 770; Match(GROUP); - State = 761; + State = 771; Match(BY); - State = 762; + State = 772; expression(0); - State = 767; + State = 777; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 763; + State = 773; Match(COMMA); - State = 764; + State = 774; expression(0); } } - State = 769; + State = 779; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -4762,13 +4823,13 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public HavingClauseContext havingClause() { HavingClauseContext _localctx = new HavingClauseContext(Context, State); - EnterRule(_localctx, 80, RULE_havingClause); + EnterRule(_localctx, 82, RULE_havingClause); try { EnterOuterAlt(_localctx, 1); { - State = 770; + State = 780; Match(HAVING); - State = 771; + State = 781; expression(0); } } @@ -4817,24 +4878,24 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TopClauseContext topClause() { TopClauseContext _localctx = new TopClauseContext(Context, State); - EnterRule(_localctx, 82, RULE_topClause); + EnterRule(_localctx, 84, RULE_topClause); int _la; try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 773; + State = 783; Match(TOP); - State = 774; + State = 784; topOperand(); - State = 779; + State = 789; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,90,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,91,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 775; + State = 785; _la = TokenStream.LA(1); if ( !(_la==PLUS || _la==MINUS) ) { ErrorHandler.RecoverInline(this); @@ -4843,21 +4904,21 @@ public TopClauseContext topClause() { ErrorHandler.ReportMatch(this); Consume(); } - State = 776; + State = 786; topOperand(); } } } - State = 781; + State = 791; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,90,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,91,Context); } - State = 783; + State = 793; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==PERCENT) { { - State = 782; + State = 792; _localctx.percent = Match(PERCENT); } } @@ -4899,33 +4960,33 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TopOperandContext topOperand() { TopOperandContext _localctx = new TopOperandContext(Context, State); - EnterRule(_localctx, 84, RULE_topOperand); + EnterRule(_localctx, 86, RULE_topOperand); try { - State = 791; + State = 801; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case INTEGER_LITERAL: EnterOuterAlt(_localctx, 1); { - State = 785; + State = 795; Match(INTEGER_LITERAL); } break; case PARAM: EnterOuterAlt(_localctx, 2); { - State = 786; + State = 796; Match(PARAM); } break; case LPAREN: EnterOuterAlt(_localctx, 3); { - State = 787; + State = 797; Match(LPAREN); - State = 788; + State = 798; expression(0); - State = 789; + State = 799; Match(RPAREN); } break; @@ -4980,29 +5041,29 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public OffsetFetchClauseContext offsetFetchClause() { OffsetFetchClauseContext _localctx = new OffsetFetchClauseContext(Context, State); - EnterRule(_localctx, 86, RULE_offsetFetchClause); + EnterRule(_localctx, 88, RULE_offsetFetchClause); int _la; try { - State = 810; + State = 820; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case OFFSET: EnterOuterAlt(_localctx, 1); { - State = 793; + State = 803; Match(OFFSET); - State = 794; + State = 804; _localctx.offset = expression(0); - State = 795; + State = 805; rowKeyword(); - State = 802; + State = 812; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==FETCH) { { - State = 796; + State = 806; Match(FETCH); - State = 797; + State = 807; _la = TokenStream.LA(1); if ( !(_la==NEXT || _la==FIRST) ) { ErrorHandler.RecoverInline(this); @@ -5011,11 +5072,11 @@ public OffsetFetchClauseContext offsetFetchClause() { ErrorHandler.ReportMatch(this); Consume(); } - State = 798; + State = 808; _localctx.limit = expression(0); - State = 799; + State = 809; rowKeyword(); - State = 800; + State = 810; Match(ONLY); } } @@ -5025,9 +5086,9 @@ public OffsetFetchClauseContext offsetFetchClause() { case FETCH: EnterOuterAlt(_localctx, 2); { - State = 804; + State = 814; Match(FETCH); - State = 805; + State = 815; _la = TokenStream.LA(1); if ( !(_la==NEXT || _la==FIRST) ) { ErrorHandler.RecoverInline(this); @@ -5036,11 +5097,11 @@ public OffsetFetchClauseContext offsetFetchClause() { ErrorHandler.ReportMatch(this); Consume(); } - State = 806; + State = 816; _localctx.limit = expression(0); - State = 807; + State = 817; rowKeyword(); - State = 808; + State = 818; Match(ONLY); } break; @@ -5078,12 +5139,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public RowKeywordContext rowKeyword() { RowKeywordContext _localctx = new RowKeywordContext(Context, State); - EnterRule(_localctx, 88, RULE_rowKeyword); + EnterRule(_localctx, 90, RULE_rowKeyword); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 812; + State = 822; _la = TokenStream.LA(1); if ( !(_la==ROWS || _la==ROW) ) { ErrorHandler.RecoverInline(this); @@ -5133,16 +5194,16 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public SelectListContext selectList() { SelectListContext _localctx = new SelectListContext(Context, State); - EnterRule(_localctx, 90, RULE_selectList); + EnterRule(_localctx, 92, RULE_selectList); int _la; try { - State = 823; + State = 833; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case STAR: EnterOuterAlt(_localctx, 1); { - State = 814; + State = 824; Match(STAR); } break; @@ -5173,21 +5234,21 @@ public SelectListContext selectList() { case IDENTIFIER: EnterOuterAlt(_localctx, 2); { - State = 815; + State = 825; selectItem(); - State = 820; + State = 830; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 816; + State = 826; Match(COMMA); - State = 817; + State = 827; selectItem(); } } - State = 822; + State = 832; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -5256,21 +5317,21 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public SelectItemContext selectItem() { SelectItemContext _localctx = new SelectItemContext(Context, State); - EnterRule(_localctx, 92, RULE_selectItem); + EnterRule(_localctx, 94, RULE_selectItem); int _la; try { - State = 836; + State = 846; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,99,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,100,Context) ) { case 1: _localctx = new QualifiedStarSelectItemContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 825; + State = 835; ((QualifiedStarSelectItemContext)_localctx).qualifier = identifier(); - State = 826; + State = 836; Match(DOT); - State = 827; + State = 837; Match(STAR); } break; @@ -5278,24 +5339,24 @@ public SelectItemContext selectItem() { _localctx = new ExpressionSelectItemContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 829; + State = 839; expression(0); - State = 834; + State = 844; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 7L) != 0)) { { - State = 831; + State = 841; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS) { { - State = 830; + State = 840; Match(AS); } } - State = 833; + State = 843; ((ExpressionSelectItemContext)_localctx).alias = identifier(); } } @@ -5343,28 +5404,28 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public FromClauseContext fromClause() { FromClauseContext _localctx = new FromClauseContext(Context, State); - EnterRule(_localctx, 94, RULE_fromClause); + EnterRule(_localctx, 96, RULE_fromClause); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 838; + State = 848; Match(FROM); - State = 839; + State = 849; tableSource(); - State = 844; + State = 854; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 840; + State = 850; Match(COMMA); - State = 841; + State = 851; tableSource(); } } - State = 846; + State = 856; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -5407,24 +5468,24 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TableSourceContext tableSource() { TableSourceContext _localctx = new TableSourceContext(Context, State); - EnterRule(_localctx, 96, RULE_tableSource); + EnterRule(_localctx, 98, RULE_tableSource); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 847; + State = 857; tablePrimary(); - State = 851; + State = 861; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 17181933568L) != 0)) { { { - State = 848; + State = 858; joinClause(); } } - State = 853; + State = 863; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -5508,34 +5569,34 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TablePrimaryContext tablePrimary() { TablePrimaryContext _localctx = new TablePrimaryContext(Context, State); - EnterRule(_localctx, 98, RULE_tablePrimary); + EnterRule(_localctx, 100, RULE_tablePrimary); int _la; try { - State = 874; + State = 884; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,106,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,107,Context) ) { case 1: _localctx = new NamedTablePrimaryContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 854; + State = 864; ((NamedTablePrimaryContext)_localctx).table = identifier(); - State = 859; + State = 869; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 7L) != 0)) { { - State = 856; + State = 866; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS) { { - State = 855; + State = 865; Match(AS); } } - State = 858; + State = 868; ((NamedTablePrimaryContext)_localctx).alias = identifier(); } } @@ -5546,28 +5607,28 @@ public TablePrimaryContext tablePrimary() { _localctx = new SubqueryPrimaryContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 861; + State = 871; Match(LPAREN); - State = 862; + State = 872; queryExpression(); - State = 863; + State = 873; Match(RPAREN); - State = 868; + State = 878; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 7L) != 0)) { { - State = 865; + State = 875; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==AS) { { - State = 864; + State = 874; Match(AS); } } - State = 867; + State = 877; ((SubqueryPrimaryContext)_localctx).alias = identifier(); } } @@ -5578,11 +5639,11 @@ public TablePrimaryContext tablePrimary() { _localctx = new ParenJoinPrimaryContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 870; + State = 880; Match(LPAREN); - State = 871; + State = 881; tableSource(); - State = 872; + State = 882; Match(RPAREN); } break; @@ -5677,24 +5738,24 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public JoinClauseContext joinClause() { JoinClauseContext _localctx = new JoinClauseContext(Context, State); - EnterRule(_localctx, 100, RULE_joinClause); + EnterRule(_localctx, 102, RULE_joinClause); try { - State = 891; + State = 901; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,107,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,108,Context) ) { case 1: _localctx = new ConditionalJoinContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 876; + State = 886; joinType(); - State = 877; + State = 887; Match(JOIN); - State = 878; + State = 888; tablePrimary(); - State = 879; + State = 889; Match(ON); - State = 880; + State = 890; expression(0); } break; @@ -5702,11 +5763,11 @@ public JoinClauseContext joinClause() { _localctx = new CrossJoinContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 882; + State = 892; Match(CROSS); - State = 883; + State = 893; Match(JOIN); - State = 884; + State = 894; tablePrimary(); } break; @@ -5714,11 +5775,11 @@ public JoinClauseContext joinClause() { _localctx = new CrossApplyContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 885; + State = 895; Match(CROSS); - State = 886; + State = 896; Match(APPLY); - State = 887; + State = 897; tablePrimary(); } break; @@ -5726,11 +5787,11 @@ public JoinClauseContext joinClause() { _localctx = new OuterApplyContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 888; + State = 898; Match(OUTER); - State = 889; + State = 899; Match(APPLY); - State = 890; + State = 900; tablePrimary(); } break; @@ -5806,10 +5867,10 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public JoinTypeContext joinType() { JoinTypeContext _localctx = new JoinTypeContext(Context, State); - EnterRule(_localctx, 102, RULE_joinType); + EnterRule(_localctx, 104, RULE_joinType); int _la; try { - State = 908; + State = 918; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case INNER: @@ -5817,12 +5878,12 @@ public JoinTypeContext joinType() { _localctx = new InnerJoinContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 894; + State = 904; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==INNER) { { - State = 893; + State = 903; Match(INNER); } } @@ -5833,14 +5894,14 @@ public JoinTypeContext joinType() { _localctx = new LeftJoinContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 896; + State = 906; Match(LEFT); - State = 898; + State = 908; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==OUTER) { { - State = 897; + State = 907; Match(OUTER); } } @@ -5851,14 +5912,14 @@ public JoinTypeContext joinType() { _localctx = new RightJoinContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 900; + State = 910; Match(RIGHT); - State = 902; + State = 912; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==OUTER) { { - State = 901; + State = 911; Match(OUTER); } } @@ -5869,14 +5930,14 @@ public JoinTypeContext joinType() { _localctx = new FullJoinContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 904; + State = 914; Match(FULL); - State = 906; + State = 916; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==OUTER) { { - State = 905; + State = 915; Match(OUTER); } } @@ -5919,13 +5980,13 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public WhereClauseContext whereClause() { WhereClauseContext _localctx = new WhereClauseContext(Context, State); - EnterRule(_localctx, 104, RULE_whereClause); + EnterRule(_localctx, 106, RULE_whereClause); try { EnterOuterAlt(_localctx, 1); { - State = 910; + State = 920; Match(WHERE); - State = 911; + State = 921; expression(0); } } @@ -5969,30 +6030,30 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public OrderByClauseContext orderByClause() { OrderByClauseContext _localctx = new OrderByClauseContext(Context, State); - EnterRule(_localctx, 106, RULE_orderByClause); + EnterRule(_localctx, 108, RULE_orderByClause); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 913; + State = 923; Match(ORDER); - State = 914; + State = 924; Match(BY); - State = 915; + State = 925; orderByItem(); - State = 920; + State = 930; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 916; + State = 926; Match(COMMA); - State = 917; + State = 927; orderByItem(); } } - State = 922; + State = 932; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -6032,19 +6093,19 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public OrderByItemContext orderByItem() { OrderByItemContext _localctx = new OrderByItemContext(Context, State); - EnterRule(_localctx, 108, RULE_orderByItem); + EnterRule(_localctx, 110, RULE_orderByItem); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 923; + State = 933; expression(0); - State = 925; + State = 935; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ASC || _la==DESC) { { - State = 924; + State = 934; _localctx.dir = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !(_la==ASC || _la==DESC) ) { @@ -6394,14 +6455,14 @@ private ExpressionContext expression(int _p) { int _parentState = State; ExpressionContext _localctx = new ExpressionContext(Context, _parentState); ExpressionContext _prevctx = _localctx; - int _startState = 110; - EnterRecursionRule(_localctx, 110, RULE_expression, _p); + int _startState = 112; + EnterRecursionRule(_localctx, 112, RULE_expression, _p); int _la; try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 935; + State = 945; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case NOT: @@ -6410,9 +6471,9 @@ private ExpressionContext expression(int _p) { Context = _localctx; _prevctx = _localctx; - State = 928; + State = 938; Match(NOT); - State = 929; + State = 939; expression(16); } break; @@ -6421,9 +6482,9 @@ private ExpressionContext expression(int _p) { _localctx = new BitNotExprContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 930; + State = 940; Match(BNOT); - State = 931; + State = 941; expression(15); } break; @@ -6432,9 +6493,9 @@ private ExpressionContext expression(int _p) { _localctx = new NegateExprContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 932; + State = 942; Match(MINUS); - State = 933; + State = 943; expression(14); } break; @@ -6464,7 +6525,7 @@ private ExpressionContext expression(int _p) { _localctx = new PrimaryExprContext(_localctx); Context = _localctx; _prevctx = _localctx; - State = 934; + State = 944; primary(); } break; @@ -6472,28 +6533,28 @@ private ExpressionContext expression(int _p) { throw new NoViableAltException(this); } Context.Stop = TokenStream.LT(-1); - State = 1006; + State = 1016; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,123,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,124,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( ParseListeners!=null ) TriggerExitRuleEvent(); _prevctx = _localctx; { - State = 1004; + State = 1014; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,122,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,123,Context) ) { case 1: { _localctx = new PowExprContext(new ExpressionContext(_parentctx, _parentState)); ((PowExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 937; + State = 947; if (!(Precpred(Context, 13))) throw new FailedPredicateException(this, "Precpred(Context, 13)"); - State = 938; + State = 948; Match(CARET); - State = 939; + State = 949; ((PowExprContext)_localctx).right = expression(14); } break; @@ -6502,9 +6563,9 @@ private ExpressionContext expression(int _p) { _localctx = new MulDivExprContext(new ExpressionContext(_parentctx, _parentState)); ((MulDivExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 940; + State = 950; if (!(Precpred(Context, 12))) throw new FailedPredicateException(this, "Precpred(Context, 12)"); - State = 941; + State = 951; ((MulDivExprContext)_localctx).op = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !(_la==MOD || ((((_la - 102)) & ~0x3f) == 0 && ((1L << (_la - 102)) & 7L) != 0)) ) { @@ -6514,7 +6575,7 @@ private ExpressionContext expression(int _p) { ErrorHandler.ReportMatch(this); Consume(); } - State = 942; + State = 952; ((MulDivExprContext)_localctx).right = expression(13); } break; @@ -6523,9 +6584,9 @@ private ExpressionContext expression(int _p) { _localctx = new AddConcatExprContext(new ExpressionContext(_parentctx, _parentState)); ((AddConcatExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 943; + State = 953; if (!(Precpred(Context, 11))) throw new FailedPredicateException(this, "Precpred(Context, 11)"); - State = 944; + State = 954; ((AddConcatExprContext)_localctx).op = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !(((((_la - 106)) & ~0x3f) == 0 && ((1L << (_la - 106)) & 7L) != 0)) ) { @@ -6535,7 +6596,7 @@ private ExpressionContext expression(int _p) { ErrorHandler.ReportMatch(this); Consume(); } - State = 945; + State = 955; ((AddConcatExprContext)_localctx).right = expression(12); } break; @@ -6544,9 +6605,9 @@ private ExpressionContext expression(int _p) { _localctx = new ComparisonExprContext(new ExpressionContext(_parentctx, _parentState)); ((ComparisonExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 946; + State = 956; if (!(Precpred(Context, 10))) throw new FailedPredicateException(this, "Precpred(Context, 10)"); - State = 947; + State = 957; ((ComparisonExprContext)_localctx).op = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !(((((_la - 109)) & ~0x3f) == 0 && ((1L << (_la - 109)) & 63L) != 0)) ) { @@ -6556,7 +6617,7 @@ private ExpressionContext expression(int _p) { ErrorHandler.ReportMatch(this); Consume(); } - State = 948; + State = 958; ((ComparisonExprContext)_localctx).right = expression(11); } break; @@ -6565,25 +6626,25 @@ private ExpressionContext expression(int _p) { _localctx = new BetweenExprContext(new ExpressionContext(_parentctx, _parentState)); ((BetweenExprContext)_localctx).val = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 949; + State = 959; if (!(Precpred(Context, 9))) throw new FailedPredicateException(this, "Precpred(Context, 9)"); - State = 951; + State = 961; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NOT) { { - State = 950; + State = 960; ((BetweenExprContext)_localctx).not = Match(NOT); } } - State = 953; + State = 963; Match(BETWEEN); - State = 954; + State = 964; ((BetweenExprContext)_localctx).lo = expression(0); - State = 955; + State = 965; Match(AND); - State = 956; + State = 966; ((BetweenExprContext)_localctx).hi = expression(10); } break; @@ -6592,21 +6653,21 @@ private ExpressionContext expression(int _p) { _localctx = new LikeExprContext(new ExpressionContext(_parentctx, _parentState)); ((LikeExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 958; + State = 968; if (!(Precpred(Context, 8))) throw new FailedPredicateException(this, "Precpred(Context, 8)"); - State = 960; + State = 970; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NOT) { { - State = 959; + State = 969; ((LikeExprContext)_localctx).not = Match(NOT); } } - State = 962; + State = 972; Match(LIKE); - State = 963; + State = 973; ((LikeExprContext)_localctx).right = expression(9); } break; @@ -6615,9 +6676,9 @@ private ExpressionContext expression(int _p) { _localctx = new BitwiseExprContext(new ExpressionContext(_parentctx, _parentState)); ((BitwiseExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 964; + State = 974; if (!(Precpred(Context, 4))) throw new FailedPredicateException(this, "Precpred(Context, 4)"); - State = 965; + State = 975; ((BitwiseExprContext)_localctx).op = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 3584L) != 0)) ) { @@ -6627,7 +6688,7 @@ private ExpressionContext expression(int _p) { ErrorHandler.ReportMatch(this); Consume(); } - State = 966; + State = 976; ((BitwiseExprContext)_localctx).right = expression(5); } break; @@ -6636,11 +6697,11 @@ private ExpressionContext expression(int _p) { _localctx = new AndExprContext(new ExpressionContext(_parentctx, _parentState)); ((AndExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 967; + State = 977; if (!(Precpred(Context, 3))) throw new FailedPredicateException(this, "Precpred(Context, 3)"); - State = 968; + State = 978; Match(AND); - State = 969; + State = 979; ((AndExprContext)_localctx).right = expression(4); } break; @@ -6649,11 +6710,11 @@ private ExpressionContext expression(int _p) { _localctx = new OrExprContext(new ExpressionContext(_parentctx, _parentState)); ((OrExprContext)_localctx).left = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 970; + State = 980; if (!(Precpred(Context, 2))) throw new FailedPredicateException(this, "Precpred(Context, 2)"); - State = 971; + State = 981; Match(OR); - State = 972; + State = 982; ((OrExprContext)_localctx).right = expression(3); } break; @@ -6662,25 +6723,25 @@ private ExpressionContext expression(int _p) { _localctx = new InSubqueryExprContext(new ExpressionContext(_parentctx, _parentState)); ((InSubqueryExprContext)_localctx).val = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 973; + State = 983; if (!(Precpred(Context, 7))) throw new FailedPredicateException(this, "Precpred(Context, 7)"); - State = 975; + State = 985; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NOT) { { - State = 974; + State = 984; ((InSubqueryExprContext)_localctx).not = Match(NOT); } } - State = 977; + State = 987; Match(IN); - State = 978; + State = 988; Match(LPAREN); - State = 979; + State = 989; ((InSubqueryExprContext)_localctx).sub = queryExpression(); - State = 980; + State = 990; Match(RPAREN); } break; @@ -6689,43 +6750,43 @@ private ExpressionContext expression(int _p) { _localctx = new InExprContext(new ExpressionContext(_parentctx, _parentState)); ((InExprContext)_localctx).val = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 982; + State = 992; if (!(Precpred(Context, 6))) throw new FailedPredicateException(this, "Precpred(Context, 6)"); - State = 984; + State = 994; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NOT) { { - State = 983; + State = 993; ((InExprContext)_localctx).not = Match(NOT); } } - State = 986; + State = 996; Match(IN); - State = 987; + State = 997; Match(LPAREN); - State = 988; + State = 998; ((InExprContext)_localctx)._expression = expression(0); ((InExprContext)_localctx)._items.Add(((InExprContext)_localctx)._expression); - State = 993; + State = 1003; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 989; + State = 999; Match(COMMA); - State = 990; + State = 1000; ((InExprContext)_localctx)._expression = expression(0); ((InExprContext)_localctx)._items.Add(((InExprContext)_localctx)._expression); } } - State = 995; + State = 1005; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 996; + State = 1006; Match(RPAREN); } break; @@ -6734,30 +6795,30 @@ private ExpressionContext expression(int _p) { _localctx = new IsNullExprContext(new ExpressionContext(_parentctx, _parentState)); ((IsNullExprContext)_localctx).operand = _prevctx; PushNewRecursionContext(_localctx, _startState, RULE_expression); - State = 998; + State = 1008; if (!(Precpred(Context, 5))) throw new FailedPredicateException(this, "Precpred(Context, 5)"); - State = 999; + State = 1009; Match(IS); - State = 1001; + State = 1011; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==NOT) { { - State = 1000; + State = 1010; ((IsNullExprContext)_localctx).not = Match(NOT); } } - State = 1003; + State = 1013; Match(NULL); } break; } } } - State = 1008; + State = 1018; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,123,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,124,Context); } } } @@ -6899,16 +6960,16 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public PrimaryContext primary() { PrimaryContext _localctx = new PrimaryContext(Context, State); - EnterRule(_localctx, 112, RULE_primary); + EnterRule(_localctx, 114, RULE_primary); try { - State = 1028; + State = 1038; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,124,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,125,Context) ) { case 1: _localctx = new LiteralPrimaryContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 1009; + State = 1019; literal(); } break; @@ -6916,7 +6977,7 @@ public PrimaryContext primary() { _localctx = new CasePrimaryContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 1010; + State = 1020; caseExpression(); } break; @@ -6924,7 +6985,7 @@ public PrimaryContext primary() { _localctx = new FunctionCallPrimaryContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 1011; + State = 1021; functionCall(); } break; @@ -6932,7 +6993,7 @@ public PrimaryContext primary() { _localctx = new ColumnPrimaryContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 1012; + State = 1022; columnRef(); } break; @@ -6940,7 +7001,7 @@ public PrimaryContext primary() { _localctx = new ParamPrimaryContext(_localctx); EnterOuterAlt(_localctx, 5); { - State = 1013; + State = 1023; Match(PARAM); } break; @@ -6948,7 +7009,7 @@ public PrimaryContext primary() { _localctx = new SystemVariablePrimaryContext(_localctx); EnterOuterAlt(_localctx, 6); { - State = 1014; + State = 1024; Match(SYSVAR); } break; @@ -6956,13 +7017,13 @@ public PrimaryContext primary() { _localctx = new ExistsPrimaryContext(_localctx); EnterOuterAlt(_localctx, 7); { - State = 1015; + State = 1025; Match(EXISTS); - State = 1016; + State = 1026; Match(LPAREN); - State = 1017; + State = 1027; queryExpression(); - State = 1018; + State = 1028; Match(RPAREN); } break; @@ -6970,11 +7031,11 @@ public PrimaryContext primary() { _localctx = new ScalarSubqueryPrimaryContext(_localctx); EnterOuterAlt(_localctx, 8); { - State = 1020; + State = 1030; Match(LPAREN); - State = 1021; + State = 1031; queryExpression(); - State = 1022; + State = 1032; Match(RPAREN); } break; @@ -6982,11 +7043,11 @@ public PrimaryContext primary() { _localctx = new ParenPrimaryContext(_localctx); EnterOuterAlt(_localctx, 9); { - State = 1024; + State = 1034; Match(LPAREN); - State = 1025; + State = 1035; expression(0); - State = 1026; + State = 1036; Match(RPAREN); } break; @@ -7037,50 +7098,50 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public CaseExpressionContext caseExpression() { CaseExpressionContext _localctx = new CaseExpressionContext(Context, State); - EnterRule(_localctx, 114, RULE_caseExpression); + EnterRule(_localctx, 116, RULE_caseExpression); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1030; + State = 1040; Match(CASE); - State = 1032; + State = 1042; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 35596957585664L) != 0) || ((((_la - 97)) & ~0x3f) == 0 && ((1L << (_la - 97)) & 17171743773L) != 0)) { { - State = 1031; + State = 1041; _localctx.operand = expression(0); } } - State = 1035; + State = 1045; ErrorHandler.Sync(this); _la = TokenStream.LA(1); do { { { - State = 1034; + State = 1044; caseWhen(); } } - State = 1037; + State = 1047; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } while ( _la==WHEN ); - State = 1041; + State = 1051; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ELSE) { { - State = 1039; + State = 1049; Match(ELSE); - State = 1040; + State = 1050; _localctx.elseResult = expression(0); } } - State = 1043; + State = 1053; Match(END); } } @@ -7122,17 +7183,17 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public CaseWhenContext caseWhen() { CaseWhenContext _localctx = new CaseWhenContext(Context, State); - EnterRule(_localctx, 116, RULE_caseWhen); + EnterRule(_localctx, 118, RULE_caseWhen); try { EnterOuterAlt(_localctx, 1); { - State = 1045; + State = 1055; Match(WHEN); - State = 1046; + State = 1056; _localctx.condition = expression(0); - State = 1047; + State = 1057; Match(THEN); - State = 1048; + State = 1058; _localctx.result = expression(0); } } @@ -7188,21 +7249,21 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public FunctionCallContext functionCall() { FunctionCallContext _localctx = new FunctionCallContext(Context, State); - EnterRule(_localctx, 118, RULE_functionCall); + EnterRule(_localctx, 120, RULE_functionCall); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1050; + State = 1060; _localctx.name = functionName(); - State = 1051; + State = 1061; Match(LPAREN); - State = 1064; + State = 1074; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case STAR: { - State = 1052; + State = 1062; _localctx.star = Match(STAR); } break; @@ -7234,31 +7295,31 @@ public FunctionCallContext functionCall() { case IDENTIFIER: { { - State = 1054; + State = 1064; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==DISTINCT) { { - State = 1053; + State = 1063; _localctx.distinct = Match(DISTINCT); } } - State = 1056; + State = 1066; expression(0); - State = 1061; + State = 1071; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 1057; + State = 1067; Match(COMMA); - State = 1058; + State = 1068; expression(0); } } - State = 1063; + State = 1073; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -7270,16 +7331,16 @@ public FunctionCallContext functionCall() { default: break; } - State = 1066; + State = 1076; Match(RPAREN); - State = 1069; + State = 1079; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,131,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,132,Context) ) { case 1: { - State = 1067; + State = 1077; Match(OVER); - State = 1068; + State = 1078; windowSpecification(); } break; @@ -7322,9 +7383,9 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public FunctionNameContext functionName() { FunctionNameContext _localctx = new FunctionNameContext(Context, State); - EnterRule(_localctx, 120, RULE_functionName); + EnterRule(_localctx, 122, RULE_functionName); try { - State = 1077; + State = 1087; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case BRACKET_ID: @@ -7332,42 +7393,42 @@ public FunctionNameContext functionName() { case IDENTIFIER: EnterOuterAlt(_localctx, 1); { - State = 1071; + State = 1081; identifier(); } break; case LEFT: EnterOuterAlt(_localctx, 2); { - State = 1072; + State = 1082; Match(LEFT); } break; case RIGHT: EnterOuterAlt(_localctx, 3); { - State = 1073; + State = 1083; Match(RIGHT); } break; case ASC: EnterOuterAlt(_localctx, 4); { - State = 1074; + State = 1084; Match(ASC); } break; case FIRST: EnterOuterAlt(_localctx, 5); { - State = 1075; + State = 1085; Match(FIRST); } break; case PARTITION: EnterOuterAlt(_localctx, 6); { - State = 1076; + State = 1086; Match(PARTITION); } break; @@ -7412,23 +7473,23 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public ColumnRefContext columnRef() { ColumnRefContext _localctx = new ColumnRefContext(Context, State); - EnterRule(_localctx, 122, RULE_columnRef); + EnterRule(_localctx, 124, RULE_columnRef); try { EnterOuterAlt(_localctx, 1); { - State = 1082; + State = 1092; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,133,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,134,Context) ) { case 1: { - State = 1079; + State = 1089; _localctx.qualifier = identifier(); - State = 1080; + State = 1090; Match(DOT); } break; } - State = 1084; + State = 1094; _localctx.name = identifier(); } } @@ -7463,12 +7524,12 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public IdentifierContext identifier() { IdentifierContext _localctx = new IdentifierContext(Context, State); - EnterRule(_localctx, 124, RULE_identifier); + EnterRule(_localctx, 126, RULE_identifier); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1086; + State = 1096; _la = TokenStream.LA(1); if ( !(((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & 7L) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -7596,16 +7657,16 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public LiteralContext literal() { LiteralContext _localctx = new LiteralContext(Context, State); - EnterRule(_localctx, 126, RULE_literal); + EnterRule(_localctx, 128, RULE_literal); try { - State = 1097; + State = 1107; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case INTEGER_LITERAL: _localctx = new IntLiteralContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 1088; + State = 1098; Match(INTEGER_LITERAL); } break; @@ -7613,7 +7674,7 @@ public LiteralContext literal() { _localctx = new NumberLiteralContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 1089; + State = 1099; Match(NUMBER_LITERAL); } break; @@ -7621,7 +7682,7 @@ public LiteralContext literal() { _localctx = new HexLiteralContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 1090; + State = 1100; Match(HEX_LITERAL); } break; @@ -7629,7 +7690,7 @@ public LiteralContext literal() { _localctx = new StringLiteralContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 1091; + State = 1101; Match(STRING_LITERAL); } break; @@ -7637,7 +7698,7 @@ public LiteralContext literal() { _localctx = new DateLiteralContext(_localctx); EnterOuterAlt(_localctx, 5); { - State = 1092; + State = 1102; Match(DATE_LITERAL); } break; @@ -7645,7 +7706,7 @@ public LiteralContext literal() { _localctx = new GuidLiteralContext(_localctx); EnterOuterAlt(_localctx, 6); { - State = 1093; + State = 1103; Match(GUID_LITERAL); } break; @@ -7653,7 +7714,7 @@ public LiteralContext literal() { _localctx = new TrueLiteralContext(_localctx); EnterOuterAlt(_localctx, 7); { - State = 1094; + State = 1104; Match(TRUE); } break; @@ -7661,7 +7722,7 @@ public LiteralContext literal() { _localctx = new FalseLiteralContext(_localctx); EnterOuterAlt(_localctx, 8); { - State = 1095; + State = 1105; Match(FALSE); } break; @@ -7669,7 +7730,7 @@ public LiteralContext literal() { _localctx = new NullLiteralContext(_localctx); EnterOuterAlt(_localctx, 9); { - State = 1096; + State = 1106; Match(NULL); } break; @@ -7740,24 +7801,24 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public TransactionStatementContext transactionStatement() { TransactionStatementContext _localctx = new TransactionStatementContext(Context, State); - EnterRule(_localctx, 128, RULE_transactionStatement); + EnterRule(_localctx, 130, RULE_transactionStatement); int _la; try { - State = 1111; + State = 1121; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case BEGIN: _localctx = new BeginTransactionStatementContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 1099; + State = 1109; Match(BEGIN); - State = 1101; + State = 1111; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==TRANSACTION || _la==WORK) { { - State = 1100; + State = 1110; _la = TokenStream.LA(1); if ( !(_la==TRANSACTION || _la==WORK) ) { ErrorHandler.RecoverInline(this); @@ -7775,14 +7836,14 @@ public TransactionStatementContext transactionStatement() { _localctx = new CommitTransactionStatementContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 1103; + State = 1113; Match(COMMIT); - State = 1105; + State = 1115; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==TRANSACTION || _la==WORK) { { - State = 1104; + State = 1114; _la = TokenStream.LA(1); if ( !(_la==TRANSACTION || _la==WORK) ) { ErrorHandler.RecoverInline(this); @@ -7800,14 +7861,14 @@ public TransactionStatementContext transactionStatement() { _localctx = new RollbackTransactionStatementContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 1107; + State = 1117; Match(ROLLBACK); - State = 1109; + State = 1119; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==TRANSACTION || _la==WORK) { { - State = 1108; + State = 1118; _la = TokenStream.LA(1); if ( !(_la==TRANSACTION || _la==WORK) ) { ErrorHandler.RecoverInline(this); @@ -7857,13 +7918,13 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public StandaloneExpressionContext standaloneExpression() { StandaloneExpressionContext _localctx = new StandaloneExpressionContext(Context, State); - EnterRule(_localctx, 130, RULE_standaloneExpression); + EnterRule(_localctx, 132, RULE_standaloneExpression); try { EnterOuterAlt(_localctx, 1); { - State = 1113; + State = 1123; expression(0); - State = 1114; + State = 1124; Match(Eof); } } @@ -7914,56 +7975,56 @@ public override TResult Accept(IParseTreeVisitor visitor) { [RuleVersion(0)] public WindowSpecificationContext windowSpecification() { WindowSpecificationContext _localctx = new WindowSpecificationContext(Context, State); - EnterRule(_localctx, 132, RULE_windowSpecification); + EnterRule(_localctx, 134, RULE_windowSpecification); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1116; + State = 1126; Match(LPAREN); - State = 1127; + State = 1137; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==PARTITION) { { - State = 1117; + State = 1127; Match(PARTITION); - State = 1118; + State = 1128; Match(BY); - State = 1119; + State = 1129; _localctx._expression = expression(0); _localctx._partition.Add(_localctx._expression); - State = 1124; + State = 1134; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==COMMA) { { { - State = 1120; + State = 1130; Match(COMMA); - State = 1121; + State = 1131; _localctx._expression = expression(0); _localctx._partition.Add(_localctx._expression); } } - State = 1126; + State = 1136; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } } } - State = 1130; + State = 1140; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ORDER) { { - State = 1129; + State = 1139; orderByClause(); } } - State = 1132; + State = 1142; Match(RPAREN); } } @@ -7980,7 +8041,7 @@ public WindowSpecificationContext windowSpecification() { public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 55: return expression_sempred((ExpressionContext)_localctx, predIndex); + case 56: return expression_sempred((ExpressionContext)_localctx, predIndex); } return true; } @@ -8003,7 +8064,7 @@ private bool expression_sempred(ExpressionContext _localctx, int predIndex) { } private static int[] _serializedATN = { - 4,1,133,1135,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2, + 4,1,133,1145,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2, 7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14, 2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21, 2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28, @@ -8012,410 +8073,413 @@ private bool expression_sempred(ExpressionContext _localctx, int predIndex) { 2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49, 2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56, 2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63, - 2,64,7,64,2,65,7,65,2,66,7,66,1,0,3,0,136,8,0,1,0,1,0,1,0,1,0,1,0,1,0, - 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,3,0,152,8,0,1,0,3,0,155,8,0,1,0,1,0,1, - 1,1,1,3,1,161,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2, - 1,2,1,2,1,2,1,2,1,2,3,2,181,8,2,1,3,1,3,1,3,1,3,1,3,5,3,188,8,3,10,3,12, - 3,191,9,3,3,3,193,8,3,1,4,1,4,1,4,1,4,1,4,1,4,5,4,201,8,4,10,4,12,4,204, - 9,4,1,4,3,4,207,8,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,3,6,219,8, - 6,1,6,1,6,1,6,3,6,224,8,6,1,7,1,7,1,7,1,7,5,7,230,8,7,10,7,12,7,233,9, - 7,1,8,1,8,3,8,237,8,8,1,8,3,8,240,8,8,1,9,1,9,1,9,1,9,5,9,246,8,9,10,9, - 12,9,249,9,9,1,9,1,9,1,10,1,10,3,10,255,8,10,1,10,1,10,1,10,1,10,1,10, - 1,10,5,10,263,8,10,10,10,12,10,266,9,10,1,10,1,10,5,10,270,8,10,10,10, - 12,10,273,9,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,5,11,284,8, - 11,10,11,12,11,287,9,11,1,11,1,11,3,11,291,8,11,1,11,1,11,1,11,1,12,1, - 12,1,12,1,12,3,12,300,8,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,5,13,309, - 8,13,10,13,12,13,312,9,13,1,13,1,13,1,13,1,13,1,13,5,13,319,8,13,10,13, - 12,13,322,9,13,3,13,324,8,13,1,14,1,14,1,14,1,15,1,15,3,15,331,8,15,1, - 16,1,16,1,16,1,16,1,16,1,17,1,17,3,17,340,8,17,1,17,1,17,1,17,1,17,1,17, - 3,17,347,8,17,1,17,1,17,1,17,5,17,352,8,17,10,17,12,17,355,9,17,1,17,1, - 17,3,17,359,8,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,368,8,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,395,8,17,1,18,1, - 18,1,18,3,18,400,8,18,1,19,1,19,3,19,404,8,19,1,19,1,19,1,19,1,19,1,19, - 1,19,1,19,1,19,5,19,414,8,19,10,19,12,19,417,9,19,1,19,1,19,1,19,3,19, - 422,8,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1, - 20,1,20,1,20,3,20,439,8,20,1,21,1,21,3,21,443,8,21,1,22,1,22,1,22,1,22, - 1,22,3,22,450,8,22,1,23,1,23,1,23,5,23,455,8,23,10,23,12,23,458,9,23,1, - 24,1,24,3,24,462,8,24,1,24,3,24,465,8,24,1,24,1,24,1,24,1,24,3,24,471, - 8,24,1,24,1,24,3,24,475,8,24,1,25,3,25,478,8,25,1,25,1,25,1,26,1,26,1, - 26,1,26,1,26,1,26,1,26,1,26,1,26,3,26,491,8,26,1,26,1,26,1,26,1,26,1,26, - 1,26,1,26,3,26,500,8,26,1,26,1,26,1,26,1,26,3,26,506,8,26,1,26,1,26,1, - 26,3,26,511,8,26,1,26,1,26,1,26,1,26,1,26,1,26,5,26,519,8,26,10,26,12, - 26,522,9,26,1,26,1,26,3,26,526,8,26,1,26,5,26,529,8,26,10,26,12,26,532, - 9,26,3,26,534,8,26,1,27,1,27,3,27,538,8,27,1,27,1,27,1,27,1,27,1,27,1, - 27,5,27,546,8,27,10,27,12,27,549,9,27,1,27,1,27,1,27,1,27,3,27,555,8,27, - 1,27,1,27,1,27,1,27,1,27,5,27,562,8,27,10,27,12,27,565,9,27,1,27,1,27, - 1,27,1,27,3,27,571,8,27,1,27,1,27,1,27,1,27,3,27,577,8,27,1,27,1,27,1, - 27,1,27,5,27,583,8,27,10,27,12,27,586,9,27,1,27,1,27,1,27,1,27,1,27,1, - 27,1,27,5,27,595,8,27,10,27,12,27,598,9,27,1,27,1,27,3,27,602,8,27,1,27, - 5,27,605,8,27,10,27,12,27,608,9,27,1,27,1,27,3,27,612,8,27,1,27,1,27,1, - 27,1,27,1,27,3,27,619,8,27,1,28,1,28,1,28,1,28,1,28,5,28,626,8,28,10,28, - 12,28,629,9,28,1,29,1,29,1,29,1,29,1,29,1,29,3,29,637,8,29,1,30,1,30,1, - 30,1,30,1,30,1,30,1,30,1,30,3,30,647,8,30,1,31,1,31,1,31,1,31,1,31,1,31, - 1,31,5,31,656,8,31,10,31,12,31,659,9,31,1,31,1,31,3,31,663,8,31,1,31,1, - 31,1,31,1,31,5,31,669,8,31,10,31,12,31,672,9,31,1,31,3,31,675,8,31,1,31, - 1,31,3,31,679,8,31,1,32,1,32,1,32,1,32,5,32,685,8,32,10,32,12,32,688,9, - 32,1,32,1,32,1,33,1,33,3,33,694,8,33,1,34,1,34,1,34,1,34,5,34,700,8,34, - 10,34,12,34,703,9,34,1,34,3,34,706,8,34,1,34,3,34,709,8,34,1,35,1,35,1, - 35,1,35,1,35,1,35,1,35,1,35,1,35,5,35,720,8,35,10,35,12,35,723,9,35,3, - 35,725,8,35,1,36,1,36,3,36,729,8,36,1,36,1,36,3,36,733,8,36,1,37,1,37, - 3,37,737,8,37,1,37,3,37,740,8,37,1,37,1,37,1,37,3,37,745,8,37,1,37,3,37, - 748,8,37,1,37,3,37,751,8,37,1,37,3,37,754,8,37,1,37,3,37,757,8,37,1,38, - 1,38,1,39,1,39,1,39,1,39,1,39,5,39,766,8,39,10,39,12,39,769,9,39,1,40, - 1,40,1,40,1,41,1,41,1,41,1,41,5,41,778,8,41,10,41,12,41,781,9,41,1,41, - 3,41,784,8,41,1,42,1,42,1,42,1,42,1,42,1,42,3,42,792,8,42,1,43,1,43,1, - 43,1,43,1,43,1,43,1,43,1,43,1,43,3,43,803,8,43,1,43,1,43,1,43,1,43,1,43, - 1,43,3,43,811,8,43,1,44,1,44,1,45,1,45,1,45,1,45,5,45,819,8,45,10,45,12, - 45,822,9,45,3,45,824,8,45,1,46,1,46,1,46,1,46,1,46,1,46,3,46,832,8,46, - 1,46,3,46,835,8,46,3,46,837,8,46,1,47,1,47,1,47,1,47,5,47,843,8,47,10, - 47,12,47,846,9,47,1,48,1,48,5,48,850,8,48,10,48,12,48,853,9,48,1,49,1, - 49,3,49,857,8,49,1,49,3,49,860,8,49,1,49,1,49,1,49,1,49,3,49,866,8,49, - 1,49,3,49,869,8,49,1,49,1,49,1,49,1,49,3,49,875,8,49,1,50,1,50,1,50,1, - 50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,3,50,892,8,50, - 1,51,3,51,895,8,51,1,51,1,51,3,51,899,8,51,1,51,1,51,3,51,903,8,51,1,51, - 1,51,3,51,907,8,51,3,51,909,8,51,1,52,1,52,1,52,1,53,1,53,1,53,1,53,1, - 53,5,53,919,8,53,10,53,12,53,922,9,53,1,54,1,54,3,54,926,8,54,1,55,1,55, - 1,55,1,55,1,55,1,55,1,55,1,55,3,55,936,8,55,1,55,1,55,1,55,1,55,1,55,1, - 55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,3,55,952,8,55,1,55,1,55,1,55, - 1,55,1,55,1,55,1,55,3,55,961,8,55,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1, - 55,1,55,1,55,1,55,1,55,1,55,3,55,976,8,55,1,55,1,55,1,55,1,55,1,55,1,55, - 1,55,3,55,985,8,55,1,55,1,55,1,55,1,55,1,55,5,55,992,8,55,10,55,12,55, - 995,9,55,1,55,1,55,1,55,1,55,1,55,3,55,1002,8,55,1,55,5,55,1005,8,55,10, - 55,12,55,1008,9,55,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1, - 56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,3,56,1029,8,56,1,57,1,57,3, - 57,1033,8,57,1,57,4,57,1036,8,57,11,57,12,57,1037,1,57,1,57,3,57,1042, - 8,57,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,59,1,59,1,59,1,59,3,59,1055, - 8,59,1,59,1,59,1,59,5,59,1060,8,59,10,59,12,59,1063,9,59,3,59,1065,8,59, - 1,59,1,59,1,59,3,59,1070,8,59,1,60,1,60,1,60,1,60,1,60,1,60,3,60,1078, - 8,60,1,61,1,61,1,61,3,61,1083,8,61,1,61,1,61,1,62,1,62,1,63,1,63,1,63, - 1,63,1,63,1,63,1,63,1,63,1,63,3,63,1098,8,63,1,64,1,64,3,64,1102,8,64, - 1,64,1,64,3,64,1106,8,64,1,64,1,64,3,64,1110,8,64,3,64,1112,8,64,1,65, - 1,65,1,65,1,66,1,66,1,66,1,66,1,66,1,66,5,66,1123,8,66,10,66,12,66,1126, - 9,66,3,66,1128,8,66,1,66,3,66,1131,8,66,1,66,1,66,1,66,0,1,110,67,0,2, - 4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52, - 54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100, - 102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,0,14,1, - 0,95,96,1,0,97,98,1,0,87,88,1,0,115,116,2,0,31,32,51,51,1,0,106,107,1, - 0,44,45,1,0,46,47,2,0,14,14,102,104,1,0,106,108,1,0,109,114,1,0,9,11,1, - 0,128,130,1,0,59,60,1294,0,135,1,0,0,0,2,158,1,0,0,0,4,180,1,0,0,0,6,182, - 1,0,0,0,8,194,1,0,0,0,10,208,1,0,0,0,12,212,1,0,0,0,14,225,1,0,0,0,16, - 234,1,0,0,0,18,241,1,0,0,0,20,252,1,0,0,0,22,276,1,0,0,0,24,295,1,0,0, - 0,26,323,1,0,0,0,28,325,1,0,0,0,30,330,1,0,0,0,32,332,1,0,0,0,34,394,1, - 0,0,0,36,399,1,0,0,0,38,401,1,0,0,0,40,438,1,0,0,0,42,440,1,0,0,0,44,449, - 1,0,0,0,46,451,1,0,0,0,48,459,1,0,0,0,50,477,1,0,0,0,52,533,1,0,0,0,54, - 618,1,0,0,0,56,627,1,0,0,0,58,636,1,0,0,0,60,646,1,0,0,0,62,648,1,0,0, - 0,64,680,1,0,0,0,66,693,1,0,0,0,68,695,1,0,0,0,70,724,1,0,0,0,72,732,1, - 0,0,0,74,734,1,0,0,0,76,758,1,0,0,0,78,760,1,0,0,0,80,770,1,0,0,0,82,773, - 1,0,0,0,84,791,1,0,0,0,86,810,1,0,0,0,88,812,1,0,0,0,90,823,1,0,0,0,92, - 836,1,0,0,0,94,838,1,0,0,0,96,847,1,0,0,0,98,874,1,0,0,0,100,891,1,0,0, - 0,102,908,1,0,0,0,104,910,1,0,0,0,106,913,1,0,0,0,108,923,1,0,0,0,110, - 935,1,0,0,0,112,1028,1,0,0,0,114,1030,1,0,0,0,116,1045,1,0,0,0,118,1050, - 1,0,0,0,120,1077,1,0,0,0,122,1082,1,0,0,0,124,1086,1,0,0,0,126,1097,1, - 0,0,0,128,1111,1,0,0,0,130,1113,1,0,0,0,132,1116,1,0,0,0,134,136,3,18, - 9,0,135,134,1,0,0,0,135,136,1,0,0,0,136,151,1,0,0,0,137,152,3,2,1,0,138, - 152,3,20,10,0,139,152,3,38,19,0,140,152,3,22,11,0,141,152,3,24,12,0,142, - 152,3,32,16,0,143,152,3,40,20,0,144,152,3,62,31,0,145,152,3,8,4,0,146, - 152,3,12,6,0,147,152,3,128,64,0,148,152,3,6,3,0,149,152,3,14,7,0,150,152, - 3,68,34,0,151,137,1,0,0,0,151,138,1,0,0,0,151,139,1,0,0,0,151,140,1,0, - 0,0,151,141,1,0,0,0,151,142,1,0,0,0,151,143,1,0,0,0,151,144,1,0,0,0,151, - 145,1,0,0,0,151,146,1,0,0,0,151,147,1,0,0,0,151,148,1,0,0,0,151,149,1, - 0,0,0,151,150,1,0,0,0,152,154,1,0,0,0,153,155,5,119,0,0,154,153,1,0,0, - 0,154,155,1,0,0,0,155,156,1,0,0,0,156,157,5,0,0,1,157,1,1,0,0,0,158,160, - 5,29,0,0,159,161,5,8,0,0,160,159,1,0,0,0,160,161,1,0,0,0,161,162,1,0,0, - 0,162,163,5,28,0,0,163,164,5,115,0,0,164,165,3,68,34,0,165,166,5,116,0, - 0,166,167,5,30,0,0,167,168,3,4,2,0,168,3,1,0,0,0,169,181,3,20,10,0,170, - 181,3,38,19,0,171,181,3,22,11,0,172,181,3,24,12,0,173,181,3,32,16,0,174, - 181,3,40,20,0,175,181,3,62,31,0,176,181,3,8,4,0,177,181,3,12,6,0,178,181, - 3,6,3,0,179,181,3,68,34,0,180,169,1,0,0,0,180,170,1,0,0,0,180,171,1,0, - 0,0,180,172,1,0,0,0,180,173,1,0,0,0,180,174,1,0,0,0,180,175,1,0,0,0,180, - 176,1,0,0,0,180,177,1,0,0,0,180,178,1,0,0,0,180,179,1,0,0,0,181,5,1,0, - 0,0,182,183,7,0,0,0,183,192,3,124,62,0,184,189,3,110,55,0,185,186,5,117, - 0,0,186,188,3,110,55,0,187,185,1,0,0,0,188,191,1,0,0,0,189,187,1,0,0,0, - 189,190,1,0,0,0,190,193,1,0,0,0,191,189,1,0,0,0,192,184,1,0,0,0,192,193, - 1,0,0,0,193,7,1,0,0,0,194,195,5,76,0,0,195,196,3,96,48,0,196,197,5,80, - 0,0,197,202,3,10,5,0,198,199,5,117,0,0,199,201,3,10,5,0,200,198,1,0,0, - 0,201,204,1,0,0,0,202,200,1,0,0,0,202,203,1,0,0,0,203,206,1,0,0,0,204, - 202,1,0,0,0,205,207,3,104,52,0,206,205,1,0,0,0,206,207,1,0,0,0,207,9,1, - 0,0,0,208,209,3,122,61,0,209,210,5,109,0,0,210,211,3,110,55,0,211,11,1, - 0,0,0,212,218,5,75,0,0,213,214,3,124,62,0,214,215,5,118,0,0,215,216,5, - 102,0,0,216,219,1,0,0,0,217,219,5,102,0,0,218,213,1,0,0,0,218,217,1,0, - 0,0,218,219,1,0,0,0,219,220,1,0,0,0,220,221,5,2,0,0,221,223,3,96,48,0, - 222,224,3,104,52,0,223,222,1,0,0,0,223,224,1,0,0,0,224,13,1,0,0,0,225, - 226,5,1,0,0,226,231,3,16,8,0,227,228,5,117,0,0,228,230,3,16,8,0,229,227, - 1,0,0,0,230,233,1,0,0,0,231,229,1,0,0,0,231,232,1,0,0,0,232,15,1,0,0,0, - 233,231,1,0,0,0,234,239,5,120,0,0,235,237,5,5,0,0,236,235,1,0,0,0,236, - 237,1,0,0,0,237,238,1,0,0,0,238,240,3,124,62,0,239,236,1,0,0,0,239,240, - 1,0,0,0,240,17,1,0,0,0,241,242,5,94,0,0,242,247,3,28,14,0,243,244,5,117, - 0,0,244,246,3,28,14,0,245,243,1,0,0,0,246,249,1,0,0,0,247,245,1,0,0,0, - 247,248,1,0,0,0,248,250,1,0,0,0,249,247,1,0,0,0,250,251,5,119,0,0,251, - 19,1,0,0,0,252,254,5,54,0,0,253,255,5,85,0,0,254,253,1,0,0,0,254,255,1, - 0,0,0,255,256,1,0,0,0,256,257,5,55,0,0,257,258,3,124,62,0,258,259,5,115, - 0,0,259,264,3,46,23,0,260,261,5,117,0,0,261,263,3,46,23,0,262,260,1,0, - 0,0,263,266,1,0,0,0,264,262,1,0,0,0,264,265,1,0,0,0,265,271,1,0,0,0,266, - 264,1,0,0,0,267,268,5,117,0,0,268,270,3,54,27,0,269,267,1,0,0,0,270,273, - 1,0,0,0,271,269,1,0,0,0,271,272,1,0,0,0,272,274,1,0,0,0,273,271,1,0,0, - 0,274,275,5,116,0,0,275,21,1,0,0,0,276,277,5,54,0,0,277,278,5,92,0,0,278, - 290,3,124,62,0,279,280,5,115,0,0,280,285,3,124,62,0,281,282,5,117,0,0, - 282,284,3,124,62,0,283,281,1,0,0,0,284,287,1,0,0,0,285,283,1,0,0,0,285, - 286,1,0,0,0,286,288,1,0,0,0,287,285,1,0,0,0,288,289,5,116,0,0,289,291, - 1,0,0,0,290,279,1,0,0,0,290,291,1,0,0,0,291,292,1,0,0,0,292,293,5,5,0, - 0,293,294,3,68,34,0,294,23,1,0,0,0,295,296,5,54,0,0,296,297,5,93,0,0,297, - 299,3,124,62,0,298,300,3,26,13,0,299,298,1,0,0,0,299,300,1,0,0,0,300,301, - 1,0,0,0,301,302,5,5,0,0,302,303,3,36,18,0,303,25,1,0,0,0,304,305,5,115, - 0,0,305,310,3,28,14,0,306,307,5,117,0,0,307,309,3,28,14,0,308,306,1,0, - 0,0,309,312,1,0,0,0,310,308,1,0,0,0,310,311,1,0,0,0,311,313,1,0,0,0,312, - 310,1,0,0,0,313,314,5,116,0,0,314,324,1,0,0,0,315,320,3,28,14,0,316,317, - 5,117,0,0,317,319,3,28,14,0,318,316,1,0,0,0,319,322,1,0,0,0,320,318,1, - 0,0,0,320,321,1,0,0,0,321,324,1,0,0,0,322,320,1,0,0,0,323,304,1,0,0,0, - 323,315,1,0,0,0,324,27,1,0,0,0,325,326,3,30,15,0,326,327,3,48,24,0,327, - 29,1,0,0,0,328,331,3,124,62,0,329,331,5,121,0,0,330,328,1,0,0,0,330,329, - 1,0,0,0,331,31,1,0,0,0,332,333,5,61,0,0,333,334,5,55,0,0,334,335,3,124, - 62,0,335,336,3,34,17,0,336,33,1,0,0,0,337,339,5,64,0,0,338,340,5,66,0, - 0,339,338,1,0,0,0,339,340,1,0,0,0,340,341,1,0,0,0,341,395,3,46,23,0,342, - 343,5,64,0,0,343,395,3,54,27,0,344,346,5,61,0,0,345,347,5,66,0,0,346,345, - 1,0,0,0,346,347,1,0,0,0,347,348,1,0,0,0,348,349,3,124,62,0,349,353,3,48, - 24,0,350,352,3,52,26,0,351,350,1,0,0,0,352,355,1,0,0,0,353,351,1,0,0,0, - 353,354,1,0,0,0,354,395,1,0,0,0,355,353,1,0,0,0,356,358,5,61,0,0,357,359, - 5,66,0,0,358,357,1,0,0,0,358,359,1,0,0,0,359,360,1,0,0,0,360,361,3,124, - 62,0,361,362,5,80,0,0,362,363,5,81,0,0,363,364,3,110,55,0,364,395,1,0, - 0,0,365,367,5,61,0,0,366,368,5,66,0,0,367,366,1,0,0,0,367,368,1,0,0,0, - 368,369,1,0,0,0,369,370,3,124,62,0,370,371,5,65,0,0,371,372,5,81,0,0,372, - 395,1,0,0,0,373,374,5,65,0,0,374,375,5,66,0,0,375,395,3,124,62,0,376,377, - 5,65,0,0,377,378,5,72,0,0,378,395,3,124,62,0,379,380,5,62,0,0,380,381, - 5,63,0,0,381,395,3,124,62,0,382,383,5,62,0,0,383,384,5,66,0,0,384,385, - 3,124,62,0,385,386,5,63,0,0,386,387,3,124,62,0,387,395,1,0,0,0,388,389, - 5,62,0,0,389,390,5,84,0,0,390,391,3,124,62,0,391,392,5,63,0,0,392,393, - 3,124,62,0,393,395,1,0,0,0,394,337,1,0,0,0,394,342,1,0,0,0,394,344,1,0, - 0,0,394,356,1,0,0,0,394,365,1,0,0,0,394,373,1,0,0,0,394,376,1,0,0,0,394, - 379,1,0,0,0,394,382,1,0,0,0,394,388,1,0,0,0,395,35,1,0,0,0,396,400,3,68, - 34,0,397,400,3,62,31,0,398,400,3,20,10,0,399,396,1,0,0,0,399,397,1,0,0, - 0,399,398,1,0,0,0,400,37,1,0,0,0,401,403,5,54,0,0,402,404,5,83,0,0,403, - 402,1,0,0,0,403,404,1,0,0,0,404,405,1,0,0,0,405,406,5,84,0,0,406,407,3, - 124,62,0,407,408,5,22,0,0,408,409,3,124,62,0,409,410,5,115,0,0,410,415, - 3,42,21,0,411,412,5,117,0,0,412,414,3,42,21,0,413,411,1,0,0,0,414,417, - 1,0,0,0,415,413,1,0,0,0,415,416,1,0,0,0,416,418,1,0,0,0,417,415,1,0,0, - 0,418,421,5,116,0,0,419,420,5,86,0,0,420,422,3,44,22,0,421,419,1,0,0,0, - 421,422,1,0,0,0,422,39,1,0,0,0,423,424,5,65,0,0,424,425,5,55,0,0,425,439, - 3,124,62,0,426,427,5,65,0,0,427,428,5,84,0,0,428,429,3,124,62,0,429,430, - 5,22,0,0,430,431,3,124,62,0,431,439,1,0,0,0,432,433,5,65,0,0,433,434,5, - 93,0,0,434,439,3,124,62,0,435,436,5,65,0,0,436,437,5,92,0,0,437,439,3, - 124,62,0,438,423,1,0,0,0,438,426,1,0,0,0,438,432,1,0,0,0,438,435,1,0,0, - 0,439,41,1,0,0,0,440,442,3,124,62,0,441,443,7,1,0,0,442,441,1,0,0,0,442, - 443,1,0,0,0,443,43,1,0,0,0,444,450,5,70,0,0,445,446,5,89,0,0,446,450,5, - 101,0,0,447,448,5,90,0,0,448,450,5,101,0,0,449,444,1,0,0,0,449,445,1,0, - 0,0,449,447,1,0,0,0,450,45,1,0,0,0,451,452,3,124,62,0,452,456,3,48,24, - 0,453,455,3,52,26,0,454,453,1,0,0,0,455,458,1,0,0,0,456,454,1,0,0,0,456, - 457,1,0,0,0,457,47,1,0,0,0,458,456,1,0,0,0,459,461,3,124,62,0,460,462, - 3,124,62,0,461,460,1,0,0,0,461,462,1,0,0,0,462,464,1,0,0,0,463,465,3,124, - 62,0,464,463,1,0,0,0,464,465,1,0,0,0,465,474,1,0,0,0,466,467,5,115,0,0, - 467,470,3,50,25,0,468,469,5,117,0,0,469,471,3,50,25,0,470,468,1,0,0,0, - 470,471,1,0,0,0,471,472,1,0,0,0,472,473,5,116,0,0,473,475,1,0,0,0,474, - 466,1,0,0,0,474,475,1,0,0,0,475,49,1,0,0,0,476,478,5,107,0,0,477,476,1, - 0,0,0,477,478,1,0,0,0,478,479,1,0,0,0,479,480,5,123,0,0,480,51,1,0,0,0, - 481,482,5,8,0,0,482,534,5,101,0,0,483,534,5,101,0,0,484,485,5,81,0,0,485, - 534,3,110,55,0,486,487,5,86,0,0,487,534,7,2,0,0,488,489,5,72,0,0,489,491, - 3,124,62,0,490,488,1,0,0,0,490,491,1,0,0,0,491,492,1,0,0,0,492,493,5,91, - 0,0,493,494,5,115,0,0,494,495,3,56,28,0,495,496,5,116,0,0,496,534,1,0, - 0,0,497,498,5,72,0,0,498,500,3,124,62,0,499,497,1,0,0,0,499,500,1,0,0, - 0,500,501,1,0,0,0,501,502,5,70,0,0,502,534,5,71,0,0,503,504,5,72,0,0,504, - 506,3,124,62,0,505,503,1,0,0,0,505,506,1,0,0,0,506,507,1,0,0,0,507,534, - 5,83,0,0,508,509,5,72,0,0,509,511,3,124,62,0,510,508,1,0,0,0,510,511,1, - 0,0,0,511,512,1,0,0,0,512,513,5,74,0,0,513,525,3,124,62,0,514,515,5,115, - 0,0,515,520,3,124,62,0,516,517,5,117,0,0,517,519,3,124,62,0,518,516,1, - 0,0,0,519,522,1,0,0,0,520,518,1,0,0,0,520,521,1,0,0,0,521,523,1,0,0,0, - 522,520,1,0,0,0,523,524,5,116,0,0,524,526,1,0,0,0,525,514,1,0,0,0,525, - 526,1,0,0,0,526,530,1,0,0,0,527,529,3,58,29,0,528,527,1,0,0,0,529,532, - 1,0,0,0,530,528,1,0,0,0,530,531,1,0,0,0,531,534,1,0,0,0,532,530,1,0,0, - 0,533,481,1,0,0,0,533,483,1,0,0,0,533,484,1,0,0,0,533,486,1,0,0,0,533, - 490,1,0,0,0,533,499,1,0,0,0,533,505,1,0,0,0,533,510,1,0,0,0,534,53,1,0, - 0,0,535,536,5,72,0,0,536,538,3,124,62,0,537,535,1,0,0,0,537,538,1,0,0, - 0,538,539,1,0,0,0,539,540,5,70,0,0,540,541,5,71,0,0,541,542,5,115,0,0, - 542,547,3,124,62,0,543,544,5,117,0,0,544,546,3,124,62,0,545,543,1,0,0, - 0,546,549,1,0,0,0,547,545,1,0,0,0,547,548,1,0,0,0,548,550,1,0,0,0,549, - 547,1,0,0,0,550,551,5,116,0,0,551,619,1,0,0,0,552,553,5,72,0,0,553,555, - 3,124,62,0,554,552,1,0,0,0,554,555,1,0,0,0,555,556,1,0,0,0,556,557,5,83, - 0,0,557,558,5,115,0,0,558,563,3,124,62,0,559,560,5,117,0,0,560,562,3,124, - 62,0,561,559,1,0,0,0,562,565,1,0,0,0,563,561,1,0,0,0,563,564,1,0,0,0,564, - 566,1,0,0,0,565,563,1,0,0,0,566,567,5,116,0,0,567,619,1,0,0,0,568,569, - 5,72,0,0,569,571,3,124,62,0,570,568,1,0,0,0,570,571,1,0,0,0,571,572,1, - 0,0,0,572,573,5,73,0,0,573,576,5,71,0,0,574,575,5,82,0,0,575,577,5,84, - 0,0,576,574,1,0,0,0,576,577,1,0,0,0,577,578,1,0,0,0,578,579,5,115,0,0, - 579,584,3,124,62,0,580,581,5,117,0,0,581,583,3,124,62,0,582,580,1,0,0, - 0,583,586,1,0,0,0,584,582,1,0,0,0,584,585,1,0,0,0,585,587,1,0,0,0,586, - 584,1,0,0,0,587,588,5,116,0,0,588,589,5,74,0,0,589,601,3,124,62,0,590, - 591,5,115,0,0,591,596,3,124,62,0,592,593,5,117,0,0,593,595,3,124,62,0, - 594,592,1,0,0,0,595,598,1,0,0,0,596,594,1,0,0,0,596,597,1,0,0,0,597,599, - 1,0,0,0,598,596,1,0,0,0,599,600,5,116,0,0,600,602,1,0,0,0,601,590,1,0, - 0,0,601,602,1,0,0,0,602,606,1,0,0,0,603,605,3,58,29,0,604,603,1,0,0,0, - 605,608,1,0,0,0,606,604,1,0,0,0,606,607,1,0,0,0,607,619,1,0,0,0,608,606, - 1,0,0,0,609,610,5,72,0,0,610,612,3,124,62,0,611,609,1,0,0,0,611,612,1, - 0,0,0,612,613,1,0,0,0,613,614,5,91,0,0,614,615,5,115,0,0,615,616,3,56, - 28,0,616,617,5,116,0,0,617,619,1,0,0,0,618,537,1,0,0,0,618,554,1,0,0,0, - 618,570,1,0,0,0,618,611,1,0,0,0,619,55,1,0,0,0,620,626,8,3,0,0,621,622, - 5,115,0,0,622,623,3,56,28,0,623,624,5,116,0,0,624,626,1,0,0,0,625,620, - 1,0,0,0,625,621,1,0,0,0,626,629,1,0,0,0,627,625,1,0,0,0,627,628,1,0,0, - 0,628,57,1,0,0,0,629,627,1,0,0,0,630,631,5,22,0,0,631,632,5,76,0,0,632, - 637,3,60,30,0,633,634,5,22,0,0,634,635,5,75,0,0,635,637,3,60,30,0,636, - 630,1,0,0,0,636,633,1,0,0,0,637,59,1,0,0,0,638,647,5,77,0,0,639,640,5, - 82,0,0,640,647,5,79,0,0,641,647,5,78,0,0,642,643,5,80,0,0,643,647,5,101, - 0,0,644,645,5,80,0,0,645,647,5,81,0,0,646,638,1,0,0,0,646,639,1,0,0,0, - 646,641,1,0,0,0,646,642,1,0,0,0,646,644,1,0,0,0,647,61,1,0,0,0,648,649, - 5,67,0,0,649,650,5,68,0,0,650,678,3,124,62,0,651,652,5,115,0,0,652,657, - 3,124,62,0,653,654,5,117,0,0,654,656,3,124,62,0,655,653,1,0,0,0,656,659, - 1,0,0,0,657,655,1,0,0,0,657,658,1,0,0,0,658,660,1,0,0,0,659,657,1,0,0, - 0,660,661,5,116,0,0,661,663,1,0,0,0,662,651,1,0,0,0,662,663,1,0,0,0,663, - 674,1,0,0,0,664,665,5,69,0,0,665,670,3,64,32,0,666,667,5,117,0,0,667,669, - 3,64,32,0,668,666,1,0,0,0,669,672,1,0,0,0,670,668,1,0,0,0,670,671,1,0, - 0,0,671,675,1,0,0,0,672,670,1,0,0,0,673,675,3,68,34,0,674,664,1,0,0,0, - 674,673,1,0,0,0,675,679,1,0,0,0,676,677,5,81,0,0,677,679,5,69,0,0,678, - 662,1,0,0,0,678,676,1,0,0,0,679,63,1,0,0,0,680,681,5,115,0,0,681,686,3, - 66,33,0,682,683,5,117,0,0,683,685,3,66,33,0,684,682,1,0,0,0,685,688,1, - 0,0,0,686,684,1,0,0,0,686,687,1,0,0,0,687,689,1,0,0,0,688,686,1,0,0,0, - 689,690,5,116,0,0,690,65,1,0,0,0,691,694,5,81,0,0,692,694,3,110,55,0,693, - 691,1,0,0,0,693,692,1,0,0,0,694,67,1,0,0,0,695,701,3,70,35,0,696,697,3, - 72,36,0,697,698,3,70,35,0,698,700,1,0,0,0,699,696,1,0,0,0,700,703,1,0, - 0,0,701,699,1,0,0,0,701,702,1,0,0,0,702,705,1,0,0,0,703,701,1,0,0,0,704, - 706,3,106,53,0,705,704,1,0,0,0,705,706,1,0,0,0,706,708,1,0,0,0,707,709, - 3,86,43,0,708,707,1,0,0,0,708,709,1,0,0,0,709,69,1,0,0,0,710,725,3,74, - 37,0,711,712,5,115,0,0,712,713,3,68,34,0,713,714,5,116,0,0,714,725,1,0, - 0,0,715,716,5,69,0,0,716,721,3,64,32,0,717,718,5,117,0,0,718,720,3,64, - 32,0,719,717,1,0,0,0,720,723,1,0,0,0,721,719,1,0,0,0,721,722,1,0,0,0,722, - 725,1,0,0,0,723,721,1,0,0,0,724,710,1,0,0,0,724,711,1,0,0,0,724,715,1, - 0,0,0,725,71,1,0,0,0,726,728,5,50,0,0,727,729,5,51,0,0,728,727,1,0,0,0, - 728,729,1,0,0,0,729,733,1,0,0,0,730,733,5,52,0,0,731,733,5,53,0,0,732, - 726,1,0,0,0,732,730,1,0,0,0,732,731,1,0,0,0,733,73,1,0,0,0,734,736,5,1, - 0,0,735,737,3,76,38,0,736,735,1,0,0,0,736,737,1,0,0,0,737,739,1,0,0,0, - 738,740,3,82,41,0,739,738,1,0,0,0,739,740,1,0,0,0,740,741,1,0,0,0,741, - 744,3,90,45,0,742,743,5,68,0,0,743,745,3,124,62,0,744,742,1,0,0,0,744, - 745,1,0,0,0,745,747,1,0,0,0,746,748,3,94,47,0,747,746,1,0,0,0,747,748, - 1,0,0,0,748,750,1,0,0,0,749,751,3,104,52,0,750,749,1,0,0,0,750,751,1,0, - 0,0,751,753,1,0,0,0,752,754,3,78,39,0,753,752,1,0,0,0,753,754,1,0,0,0, - 754,756,1,0,0,0,755,757,3,80,40,0,756,755,1,0,0,0,756,757,1,0,0,0,757, - 75,1,0,0,0,758,759,7,4,0,0,759,77,1,0,0,0,760,761,5,24,0,0,761,762,5,26, - 0,0,762,767,3,110,55,0,763,764,5,117,0,0,764,766,3,110,55,0,765,763,1, - 0,0,0,766,769,1,0,0,0,767,765,1,0,0,0,767,768,1,0,0,0,768,79,1,0,0,0,769, - 767,1,0,0,0,770,771,5,27,0,0,771,772,3,110,55,0,772,81,1,0,0,0,773,774, - 5,4,0,0,774,779,3,84,42,0,775,776,7,5,0,0,776,778,3,84,42,0,777,775,1, - 0,0,0,778,781,1,0,0,0,779,777,1,0,0,0,779,780,1,0,0,0,780,783,1,0,0,0, - 781,779,1,0,0,0,782,784,5,33,0,0,783,782,1,0,0,0,783,784,1,0,0,0,784,83, - 1,0,0,0,785,792,5,123,0,0,786,792,5,121,0,0,787,788,5,115,0,0,788,789, - 3,110,55,0,789,790,5,116,0,0,790,792,1,0,0,0,791,785,1,0,0,0,791,786,1, - 0,0,0,791,787,1,0,0,0,792,85,1,0,0,0,793,794,5,42,0,0,794,795,3,110,55, - 0,795,802,3,88,44,0,796,797,5,43,0,0,797,798,7,6,0,0,798,799,3,110,55, - 0,799,800,3,88,44,0,800,801,5,48,0,0,801,803,1,0,0,0,802,796,1,0,0,0,802, - 803,1,0,0,0,803,811,1,0,0,0,804,805,5,43,0,0,805,806,7,6,0,0,806,807,3, - 110,55,0,807,808,3,88,44,0,808,809,5,48,0,0,809,811,1,0,0,0,810,793,1, - 0,0,0,810,804,1,0,0,0,811,87,1,0,0,0,812,813,7,7,0,0,813,89,1,0,0,0,814, - 824,5,102,0,0,815,820,3,92,46,0,816,817,5,117,0,0,817,819,3,92,46,0,818, - 816,1,0,0,0,819,822,1,0,0,0,820,818,1,0,0,0,820,821,1,0,0,0,821,824,1, - 0,0,0,822,820,1,0,0,0,823,814,1,0,0,0,823,815,1,0,0,0,824,91,1,0,0,0,825, - 826,3,124,62,0,826,827,5,118,0,0,827,828,5,102,0,0,828,837,1,0,0,0,829, - 834,3,110,55,0,830,832,5,5,0,0,831,830,1,0,0,0,831,832,1,0,0,0,832,833, - 1,0,0,0,833,835,3,124,62,0,834,831,1,0,0,0,834,835,1,0,0,0,835,837,1,0, - 0,0,836,825,1,0,0,0,836,829,1,0,0,0,837,93,1,0,0,0,838,839,5,2,0,0,839, - 844,3,96,48,0,840,841,5,117,0,0,841,843,3,96,48,0,842,840,1,0,0,0,843, - 846,1,0,0,0,844,842,1,0,0,0,844,845,1,0,0,0,845,95,1,0,0,0,846,844,1,0, - 0,0,847,851,3,98,49,0,848,850,3,100,50,0,849,848,1,0,0,0,850,853,1,0,0, - 0,851,849,1,0,0,0,851,852,1,0,0,0,852,97,1,0,0,0,853,851,1,0,0,0,854,859, - 3,124,62,0,855,857,5,5,0,0,856,855,1,0,0,0,856,857,1,0,0,0,857,858,1,0, - 0,0,858,860,3,124,62,0,859,856,1,0,0,0,859,860,1,0,0,0,860,875,1,0,0,0, - 861,862,5,115,0,0,862,863,3,68,34,0,863,868,5,116,0,0,864,866,5,5,0,0, - 865,864,1,0,0,0,865,866,1,0,0,0,866,867,1,0,0,0,867,869,3,124,62,0,868, - 865,1,0,0,0,868,869,1,0,0,0,869,875,1,0,0,0,870,871,5,115,0,0,871,872, - 3,96,48,0,872,873,5,116,0,0,873,875,1,0,0,0,874,854,1,0,0,0,874,861,1, - 0,0,0,874,870,1,0,0,0,875,99,1,0,0,0,876,877,3,102,51,0,877,878,5,20,0, - 0,878,879,3,98,49,0,879,880,5,22,0,0,880,881,3,110,55,0,881,892,1,0,0, - 0,882,883,5,34,0,0,883,884,5,20,0,0,884,892,3,98,49,0,885,886,5,34,0,0, - 886,887,5,35,0,0,887,892,3,98,49,0,888,889,5,19,0,0,889,890,5,35,0,0,890, - 892,3,98,49,0,891,876,1,0,0,0,891,882,1,0,0,0,891,885,1,0,0,0,891,888, - 1,0,0,0,892,101,1,0,0,0,893,895,5,15,0,0,894,893,1,0,0,0,894,895,1,0,0, - 0,895,909,1,0,0,0,896,898,5,16,0,0,897,899,5,19,0,0,898,897,1,0,0,0,898, - 899,1,0,0,0,899,909,1,0,0,0,900,902,5,17,0,0,901,903,5,19,0,0,902,901, - 1,0,0,0,902,903,1,0,0,0,903,909,1,0,0,0,904,906,5,18,0,0,905,907,5,19, - 0,0,906,905,1,0,0,0,906,907,1,0,0,0,907,909,1,0,0,0,908,894,1,0,0,0,908, - 896,1,0,0,0,908,900,1,0,0,0,908,904,1,0,0,0,909,103,1,0,0,0,910,911,5, - 3,0,0,911,912,3,110,55,0,912,105,1,0,0,0,913,914,5,23,0,0,914,915,5,26, - 0,0,915,920,3,108,54,0,916,917,5,117,0,0,917,919,3,108,54,0,918,916,1, - 0,0,0,919,922,1,0,0,0,920,918,1,0,0,0,920,921,1,0,0,0,921,107,1,0,0,0, - 922,920,1,0,0,0,923,925,3,110,55,0,924,926,7,1,0,0,925,924,1,0,0,0,925, - 926,1,0,0,0,926,109,1,0,0,0,927,928,6,55,-1,0,928,929,5,8,0,0,929,936, - 3,110,55,16,930,931,5,12,0,0,931,936,3,110,55,15,932,933,5,107,0,0,933, - 936,3,110,55,14,934,936,3,112,56,0,935,927,1,0,0,0,935,930,1,0,0,0,935, - 932,1,0,0,0,935,934,1,0,0,0,936,1006,1,0,0,0,937,938,10,13,0,0,938,939, - 5,105,0,0,939,1005,3,110,55,14,940,941,10,12,0,0,941,942,7,8,0,0,942,1005, - 3,110,55,13,943,944,10,11,0,0,944,945,7,9,0,0,945,1005,3,110,55,12,946, - 947,10,10,0,0,947,948,7,10,0,0,948,1005,3,110,55,11,949,951,10,9,0,0,950, - 952,5,8,0,0,951,950,1,0,0,0,951,952,1,0,0,0,952,953,1,0,0,0,953,954,5, - 49,0,0,954,955,3,110,55,0,955,956,5,6,0,0,956,957,3,110,55,10,957,1005, - 1,0,0,0,958,960,10,8,0,0,959,961,5,8,0,0,960,959,1,0,0,0,960,961,1,0,0, - 0,961,962,1,0,0,0,962,963,5,13,0,0,963,1005,3,110,55,9,964,965,10,4,0, - 0,965,966,7,11,0,0,966,1005,3,110,55,5,967,968,10,3,0,0,968,969,5,6,0, - 0,969,1005,3,110,55,4,970,971,10,2,0,0,971,972,5,7,0,0,972,1005,3,110, - 55,3,973,975,10,7,0,0,974,976,5,8,0,0,975,974,1,0,0,0,975,976,1,0,0,0, - 976,977,1,0,0,0,977,978,5,21,0,0,978,979,5,115,0,0,979,980,3,68,34,0,980, - 981,5,116,0,0,981,1005,1,0,0,0,982,984,10,6,0,0,983,985,5,8,0,0,984,983, - 1,0,0,0,984,985,1,0,0,0,985,986,1,0,0,0,986,987,5,21,0,0,987,988,5,115, - 0,0,988,993,3,110,55,0,989,990,5,117,0,0,990,992,3,110,55,0,991,989,1, - 0,0,0,992,995,1,0,0,0,993,991,1,0,0,0,993,994,1,0,0,0,994,996,1,0,0,0, - 995,993,1,0,0,0,996,997,5,116,0,0,997,1005,1,0,0,0,998,999,10,5,0,0,999, - 1001,5,25,0,0,1000,1002,5,8,0,0,1001,1000,1,0,0,0,1001,1002,1,0,0,0,1002, - 1003,1,0,0,0,1003,1005,5,101,0,0,1004,937,1,0,0,0,1004,940,1,0,0,0,1004, - 943,1,0,0,0,1004,946,1,0,0,0,1004,949,1,0,0,0,1004,958,1,0,0,0,1004,964, - 1,0,0,0,1004,967,1,0,0,0,1004,970,1,0,0,0,1004,973,1,0,0,0,1004,982,1, - 0,0,0,1004,998,1,0,0,0,1005,1008,1,0,0,0,1006,1004,1,0,0,0,1006,1007,1, - 0,0,0,1007,111,1,0,0,0,1008,1006,1,0,0,0,1009,1029,3,126,63,0,1010,1029, - 3,114,57,0,1011,1029,3,118,59,0,1012,1029,3,122,61,0,1013,1029,5,121,0, - 0,1014,1029,5,120,0,0,1015,1016,5,28,0,0,1016,1017,5,115,0,0,1017,1018, - 3,68,34,0,1018,1019,5,116,0,0,1019,1029,1,0,0,0,1020,1021,5,115,0,0,1021, - 1022,3,68,34,0,1022,1023,5,116,0,0,1023,1029,1,0,0,0,1024,1025,5,115,0, - 0,1025,1026,3,110,55,0,1026,1027,5,116,0,0,1027,1029,1,0,0,0,1028,1009, - 1,0,0,0,1028,1010,1,0,0,0,1028,1011,1,0,0,0,1028,1012,1,0,0,0,1028,1013, - 1,0,0,0,1028,1014,1,0,0,0,1028,1015,1,0,0,0,1028,1020,1,0,0,0,1028,1024, - 1,0,0,0,1029,113,1,0,0,0,1030,1032,5,38,0,0,1031,1033,3,110,55,0,1032, - 1031,1,0,0,0,1032,1033,1,0,0,0,1033,1035,1,0,0,0,1034,1036,3,116,58,0, - 1035,1034,1,0,0,0,1036,1037,1,0,0,0,1037,1035,1,0,0,0,1037,1038,1,0,0, - 0,1038,1041,1,0,0,0,1039,1040,5,40,0,0,1040,1042,3,110,55,0,1041,1039, - 1,0,0,0,1041,1042,1,0,0,0,1042,1043,1,0,0,0,1043,1044,5,41,0,0,1044,115, - 1,0,0,0,1045,1046,5,39,0,0,1046,1047,3,110,55,0,1047,1048,5,30,0,0,1048, - 1049,3,110,55,0,1049,117,1,0,0,0,1050,1051,3,120,60,0,1051,1064,5,115, - 0,0,1052,1065,5,102,0,0,1053,1055,5,32,0,0,1054,1053,1,0,0,0,1054,1055, - 1,0,0,0,1055,1056,1,0,0,0,1056,1061,3,110,55,0,1057,1058,5,117,0,0,1058, - 1060,3,110,55,0,1059,1057,1,0,0,0,1060,1063,1,0,0,0,1061,1059,1,0,0,0, - 1061,1062,1,0,0,0,1062,1065,1,0,0,0,1063,1061,1,0,0,0,1064,1052,1,0,0, - 0,1064,1054,1,0,0,0,1064,1065,1,0,0,0,1065,1066,1,0,0,0,1066,1069,5,116, - 0,0,1067,1068,5,36,0,0,1068,1070,3,132,66,0,1069,1067,1,0,0,0,1069,1070, - 1,0,0,0,1070,119,1,0,0,0,1071,1078,3,124,62,0,1072,1078,5,16,0,0,1073, - 1078,5,17,0,0,1074,1078,5,97,0,0,1075,1078,5,45,0,0,1076,1078,5,37,0,0, - 1077,1071,1,0,0,0,1077,1072,1,0,0,0,1077,1073,1,0,0,0,1077,1074,1,0,0, - 0,1077,1075,1,0,0,0,1077,1076,1,0,0,0,1078,121,1,0,0,0,1079,1080,3,124, - 62,0,1080,1081,5,118,0,0,1081,1083,1,0,0,0,1082,1079,1,0,0,0,1082,1083, - 1,0,0,0,1083,1084,1,0,0,0,1084,1085,3,124,62,0,1085,123,1,0,0,0,1086,1087, - 7,12,0,0,1087,125,1,0,0,0,1088,1098,5,123,0,0,1089,1098,5,124,0,0,1090, - 1098,5,122,0,0,1091,1098,5,125,0,0,1092,1098,5,126,0,0,1093,1098,5,127, - 0,0,1094,1098,5,99,0,0,1095,1098,5,100,0,0,1096,1098,5,101,0,0,1097,1088, - 1,0,0,0,1097,1089,1,0,0,0,1097,1090,1,0,0,0,1097,1091,1,0,0,0,1097,1092, - 1,0,0,0,1097,1093,1,0,0,0,1097,1094,1,0,0,0,1097,1095,1,0,0,0,1097,1096, - 1,0,0,0,1098,127,1,0,0,0,1099,1101,5,56,0,0,1100,1102,7,13,0,0,1101,1100, - 1,0,0,0,1101,1102,1,0,0,0,1102,1112,1,0,0,0,1103,1105,5,57,0,0,1104,1106, - 7,13,0,0,1105,1104,1,0,0,0,1105,1106,1,0,0,0,1106,1112,1,0,0,0,1107,1109, - 5,58,0,0,1108,1110,7,13,0,0,1109,1108,1,0,0,0,1109,1110,1,0,0,0,1110,1112, - 1,0,0,0,1111,1099,1,0,0,0,1111,1103,1,0,0,0,1111,1107,1,0,0,0,1112,129, - 1,0,0,0,1113,1114,3,110,55,0,1114,1115,5,0,0,1,1115,131,1,0,0,0,1116,1127, - 5,115,0,0,1117,1118,5,37,0,0,1118,1119,5,26,0,0,1119,1124,3,110,55,0,1120, - 1121,5,117,0,0,1121,1123,3,110,55,0,1122,1120,1,0,0,0,1123,1126,1,0,0, - 0,1124,1122,1,0,0,0,1124,1125,1,0,0,0,1125,1128,1,0,0,0,1126,1124,1,0, - 0,0,1127,1117,1,0,0,0,1127,1128,1,0,0,0,1128,1130,1,0,0,0,1129,1131,3, - 106,53,0,1130,1129,1,0,0,0,1130,1131,1,0,0,0,1131,1132,1,0,0,0,1132,1133, - 5,116,0,0,1133,133,1,0,0,0,142,135,151,154,160,180,189,192,202,206,218, - 223,231,236,239,247,254,264,271,285,290,299,310,320,323,330,339,346,353, - 358,367,394,399,403,415,421,438,442,449,456,461,464,470,474,477,490,499, - 505,510,520,525,530,533,537,547,554,563,570,576,584,596,601,606,611,618, - 625,627,636,646,657,662,670,674,678,686,693,701,705,708,721,724,728,732, - 736,739,744,747,750,753,756,767,779,783,791,802,810,820,823,831,834,836, - 844,851,856,859,865,868,874,891,894,898,902,906,908,920,925,935,951,960, - 975,984,993,1001,1004,1006,1028,1032,1037,1041,1054,1061,1064,1069,1077, - 1082,1097,1101,1105,1109,1111,1124,1127,1130 + 2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,1,0,3,0,138,8,0,1,0,1,0,1,0,1, + 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,3,0,154,8,0,1,0,3,0,157,8,0, + 1,0,1,0,1,1,1,1,3,1,163,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1, + 2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,183,8,2,1,3,1,3,1,3,1,3,1,3,5,3,190, + 8,3,10,3,12,3,193,9,3,3,3,195,8,3,1,4,1,4,1,4,1,4,1,4,1,4,5,4,203,8,4, + 10,4,12,4,206,9,4,1,4,3,4,209,8,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6, + 1,6,3,6,221,8,6,1,6,1,6,1,6,3,6,226,8,6,1,7,1,7,1,7,1,7,5,7,232,8,7,10, + 7,12,7,235,9,7,1,8,1,8,3,8,239,8,8,1,8,3,8,242,8,8,1,9,1,9,1,9,1,9,5,9, + 248,8,9,10,9,12,9,251,9,9,1,9,1,9,1,10,1,10,3,10,257,8,10,1,10,1,10,1, + 10,1,10,1,10,1,10,5,10,265,8,10,10,10,12,10,268,9,10,1,10,1,10,5,10,272, + 8,10,10,10,12,10,275,9,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 5,11,286,8,11,10,11,12,11,289,9,11,1,11,1,11,3,11,293,8,11,1,11,1,11,1, + 11,1,12,1,12,1,12,1,12,3,12,302,8,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13, + 5,13,311,8,13,10,13,12,13,314,9,13,1,13,1,13,1,13,1,13,1,13,5,13,321,8, + 13,10,13,12,13,324,9,13,3,13,326,8,13,1,14,1,14,1,14,1,15,1,15,3,15,333, + 8,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,3,17,342,8,17,1,17,1,17,1,17,1, + 17,1,17,3,17,349,8,17,1,17,1,17,1,17,5,17,354,8,17,10,17,12,17,357,9,17, + 1,17,1,17,3,17,361,8,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,370,8, + 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, + 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,397,8,17, + 1,18,1,18,1,18,3,18,402,8,18,1,19,1,19,3,19,406,8,19,1,19,1,19,1,19,1, + 19,1,19,1,19,1,19,1,19,5,19,416,8,19,10,19,12,19,419,9,19,1,19,1,19,1, + 19,3,19,424,8,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20, + 1,20,1,20,1,20,1,20,3,20,441,8,20,1,21,1,21,3,21,445,8,21,1,22,1,22,1, + 22,1,22,1,22,3,22,452,8,22,1,23,1,23,1,23,3,23,457,8,23,1,23,5,23,460, + 8,23,10,23,12,23,463,9,23,1,24,1,24,1,24,1,24,1,24,1,25,1,25,3,25,472, + 8,25,1,25,3,25,475,8,25,1,25,1,25,1,25,1,25,3,25,481,8,25,1,25,1,25,3, + 25,485,8,25,1,26,3,26,488,8,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27, + 1,27,1,27,1,27,3,27,501,8,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,3,27,510, + 8,27,1,27,1,27,1,27,1,27,3,27,516,8,27,1,27,1,27,1,27,3,27,521,8,27,1, + 27,1,27,1,27,1,27,1,27,1,27,5,27,529,8,27,10,27,12,27,532,9,27,1,27,1, + 27,3,27,536,8,27,1,27,5,27,539,8,27,10,27,12,27,542,9,27,3,27,544,8,27, + 1,28,1,28,3,28,548,8,28,1,28,1,28,1,28,1,28,1,28,1,28,5,28,556,8,28,10, + 28,12,28,559,9,28,1,28,1,28,1,28,1,28,3,28,565,8,28,1,28,1,28,1,28,1,28, + 1,28,5,28,572,8,28,10,28,12,28,575,9,28,1,28,1,28,1,28,1,28,3,28,581,8, + 28,1,28,1,28,1,28,1,28,3,28,587,8,28,1,28,1,28,1,28,1,28,5,28,593,8,28, + 10,28,12,28,596,9,28,1,28,1,28,1,28,1,28,1,28,1,28,1,28,5,28,605,8,28, + 10,28,12,28,608,9,28,1,28,1,28,3,28,612,8,28,1,28,5,28,615,8,28,10,28, + 12,28,618,9,28,1,28,1,28,3,28,622,8,28,1,28,1,28,1,28,1,28,1,28,3,28,629, + 8,28,1,29,1,29,1,29,1,29,1,29,5,29,636,8,29,10,29,12,29,639,9,29,1,30, + 1,30,1,30,1,30,1,30,1,30,3,30,647,8,30,1,31,1,31,1,31,1,31,1,31,1,31,1, + 31,1,31,3,31,657,8,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,5,32,666,8,32, + 10,32,12,32,669,9,32,1,32,1,32,3,32,673,8,32,1,32,1,32,1,32,1,32,5,32, + 679,8,32,10,32,12,32,682,9,32,1,32,3,32,685,8,32,1,32,1,32,3,32,689,8, + 32,1,33,1,33,1,33,1,33,5,33,695,8,33,10,33,12,33,698,9,33,1,33,1,33,1, + 34,1,34,3,34,704,8,34,1,35,1,35,1,35,1,35,5,35,710,8,35,10,35,12,35,713, + 9,35,1,35,3,35,716,8,35,1,35,3,35,719,8,35,1,36,1,36,1,36,1,36,1,36,1, + 36,1,36,1,36,1,36,5,36,730,8,36,10,36,12,36,733,9,36,3,36,735,8,36,1,37, + 1,37,3,37,739,8,37,1,37,1,37,3,37,743,8,37,1,38,1,38,3,38,747,8,38,1,38, + 3,38,750,8,38,1,38,1,38,1,38,3,38,755,8,38,1,38,3,38,758,8,38,1,38,3,38, + 761,8,38,1,38,3,38,764,8,38,1,38,3,38,767,8,38,1,39,1,39,1,40,1,40,1,40, + 1,40,1,40,5,40,776,8,40,10,40,12,40,779,9,40,1,41,1,41,1,41,1,42,1,42, + 1,42,1,42,5,42,788,8,42,10,42,12,42,791,9,42,1,42,3,42,794,8,42,1,43,1, + 43,1,43,1,43,1,43,1,43,3,43,802,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44, + 1,44,1,44,3,44,813,8,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,821,8,44,1, + 45,1,45,1,46,1,46,1,46,1,46,5,46,829,8,46,10,46,12,46,832,9,46,3,46,834, + 8,46,1,47,1,47,1,47,1,47,1,47,1,47,3,47,842,8,47,1,47,3,47,845,8,47,3, + 47,847,8,47,1,48,1,48,1,48,1,48,5,48,853,8,48,10,48,12,48,856,9,48,1,49, + 1,49,5,49,860,8,49,10,49,12,49,863,9,49,1,50,1,50,3,50,867,8,50,1,50,3, + 50,870,8,50,1,50,1,50,1,50,1,50,3,50,876,8,50,1,50,3,50,879,8,50,1,50, + 1,50,1,50,1,50,3,50,885,8,50,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1, + 51,1,51,1,51,1,51,1,51,1,51,1,51,3,51,902,8,51,1,52,3,52,905,8,52,1,52, + 1,52,3,52,909,8,52,1,52,1,52,3,52,913,8,52,1,52,1,52,3,52,917,8,52,3,52, + 919,8,52,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54,5,54,929,8,54,10,54,12, + 54,932,9,54,1,55,1,55,3,55,936,8,55,1,56,1,56,1,56,1,56,1,56,1,56,1,56, + 1,56,3,56,946,8,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1, + 56,1,56,1,56,1,56,3,56,962,8,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,3,56, + 971,8,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1, + 56,3,56,986,8,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,3,56,995,8,56,1,56, + 1,56,1,56,1,56,1,56,5,56,1002,8,56,10,56,12,56,1005,9,56,1,56,1,56,1,56, + 1,56,1,56,3,56,1012,8,56,1,56,5,56,1015,8,56,10,56,12,56,1018,9,56,1,57, + 1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57, + 1,57,1,57,1,57,1,57,3,57,1039,8,57,1,58,1,58,3,58,1043,8,58,1,58,4,58, + 1046,8,58,11,58,12,58,1047,1,58,1,58,3,58,1052,8,58,1,58,1,58,1,59,1,59, + 1,59,1,59,1,59,1,60,1,60,1,60,1,60,3,60,1065,8,60,1,60,1,60,1,60,5,60, + 1070,8,60,10,60,12,60,1073,9,60,3,60,1075,8,60,1,60,1,60,1,60,3,60,1080, + 8,60,1,61,1,61,1,61,1,61,1,61,1,61,3,61,1088,8,61,1,62,1,62,1,62,3,62, + 1093,8,62,1,62,1,62,1,63,1,63,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64, + 1,64,3,64,1108,8,64,1,65,1,65,3,65,1112,8,65,1,65,1,65,3,65,1116,8,65, + 1,65,1,65,3,65,1120,8,65,3,65,1122,8,65,1,66,1,66,1,66,1,67,1,67,1,67, + 1,67,1,67,1,67,5,67,1133,8,67,10,67,12,67,1136,9,67,3,67,1138,8,67,1,67, + 3,67,1141,8,67,1,67,1,67,1,67,0,1,112,68,0,2,4,6,8,10,12,14,16,18,20,22, + 24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70, + 72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112, + 114,116,118,120,122,124,126,128,130,132,134,0,14,1,0,95,96,1,0,97,98,1, + 0,87,88,1,0,115,116,2,0,31,32,51,51,1,0,106,107,1,0,44,45,1,0,46,47,2, + 0,14,14,102,104,1,0,106,108,1,0,109,114,1,0,9,11,1,0,128,130,1,0,59,60, + 1304,0,137,1,0,0,0,2,160,1,0,0,0,4,182,1,0,0,0,6,184,1,0,0,0,8,196,1,0, + 0,0,10,210,1,0,0,0,12,214,1,0,0,0,14,227,1,0,0,0,16,236,1,0,0,0,18,243, + 1,0,0,0,20,254,1,0,0,0,22,278,1,0,0,0,24,297,1,0,0,0,26,325,1,0,0,0,28, + 327,1,0,0,0,30,332,1,0,0,0,32,334,1,0,0,0,34,396,1,0,0,0,36,401,1,0,0, + 0,38,403,1,0,0,0,40,440,1,0,0,0,42,442,1,0,0,0,44,451,1,0,0,0,46,453,1, + 0,0,0,48,464,1,0,0,0,50,469,1,0,0,0,52,487,1,0,0,0,54,543,1,0,0,0,56,628, + 1,0,0,0,58,637,1,0,0,0,60,646,1,0,0,0,62,656,1,0,0,0,64,658,1,0,0,0,66, + 690,1,0,0,0,68,703,1,0,0,0,70,705,1,0,0,0,72,734,1,0,0,0,74,742,1,0,0, + 0,76,744,1,0,0,0,78,768,1,0,0,0,80,770,1,0,0,0,82,780,1,0,0,0,84,783,1, + 0,0,0,86,801,1,0,0,0,88,820,1,0,0,0,90,822,1,0,0,0,92,833,1,0,0,0,94,846, + 1,0,0,0,96,848,1,0,0,0,98,857,1,0,0,0,100,884,1,0,0,0,102,901,1,0,0,0, + 104,918,1,0,0,0,106,920,1,0,0,0,108,923,1,0,0,0,110,933,1,0,0,0,112,945, + 1,0,0,0,114,1038,1,0,0,0,116,1040,1,0,0,0,118,1055,1,0,0,0,120,1060,1, + 0,0,0,122,1087,1,0,0,0,124,1092,1,0,0,0,126,1096,1,0,0,0,128,1107,1,0, + 0,0,130,1121,1,0,0,0,132,1123,1,0,0,0,134,1126,1,0,0,0,136,138,3,18,9, + 0,137,136,1,0,0,0,137,138,1,0,0,0,138,153,1,0,0,0,139,154,3,2,1,0,140, + 154,3,20,10,0,141,154,3,38,19,0,142,154,3,22,11,0,143,154,3,24,12,0,144, + 154,3,32,16,0,145,154,3,40,20,0,146,154,3,64,32,0,147,154,3,8,4,0,148, + 154,3,12,6,0,149,154,3,130,65,0,150,154,3,6,3,0,151,154,3,14,7,0,152,154, + 3,70,35,0,153,139,1,0,0,0,153,140,1,0,0,0,153,141,1,0,0,0,153,142,1,0, + 0,0,153,143,1,0,0,0,153,144,1,0,0,0,153,145,1,0,0,0,153,146,1,0,0,0,153, + 147,1,0,0,0,153,148,1,0,0,0,153,149,1,0,0,0,153,150,1,0,0,0,153,151,1, + 0,0,0,153,152,1,0,0,0,154,156,1,0,0,0,155,157,5,119,0,0,156,155,1,0,0, + 0,156,157,1,0,0,0,157,158,1,0,0,0,158,159,5,0,0,1,159,1,1,0,0,0,160,162, + 5,29,0,0,161,163,5,8,0,0,162,161,1,0,0,0,162,163,1,0,0,0,163,164,1,0,0, + 0,164,165,5,28,0,0,165,166,5,115,0,0,166,167,3,70,35,0,167,168,5,116,0, + 0,168,169,5,30,0,0,169,170,3,4,2,0,170,3,1,0,0,0,171,183,3,20,10,0,172, + 183,3,38,19,0,173,183,3,22,11,0,174,183,3,24,12,0,175,183,3,32,16,0,176, + 183,3,40,20,0,177,183,3,64,32,0,178,183,3,8,4,0,179,183,3,12,6,0,180,183, + 3,6,3,0,181,183,3,70,35,0,182,171,1,0,0,0,182,172,1,0,0,0,182,173,1,0, + 0,0,182,174,1,0,0,0,182,175,1,0,0,0,182,176,1,0,0,0,182,177,1,0,0,0,182, + 178,1,0,0,0,182,179,1,0,0,0,182,180,1,0,0,0,182,181,1,0,0,0,183,5,1,0, + 0,0,184,185,7,0,0,0,185,194,3,126,63,0,186,191,3,112,56,0,187,188,5,117, + 0,0,188,190,3,112,56,0,189,187,1,0,0,0,190,193,1,0,0,0,191,189,1,0,0,0, + 191,192,1,0,0,0,192,195,1,0,0,0,193,191,1,0,0,0,194,186,1,0,0,0,194,195, + 1,0,0,0,195,7,1,0,0,0,196,197,5,76,0,0,197,198,3,98,49,0,198,199,5,80, + 0,0,199,204,3,10,5,0,200,201,5,117,0,0,201,203,3,10,5,0,202,200,1,0,0, + 0,203,206,1,0,0,0,204,202,1,0,0,0,204,205,1,0,0,0,205,208,1,0,0,0,206, + 204,1,0,0,0,207,209,3,106,53,0,208,207,1,0,0,0,208,209,1,0,0,0,209,9,1, + 0,0,0,210,211,3,124,62,0,211,212,5,109,0,0,212,213,3,112,56,0,213,11,1, + 0,0,0,214,220,5,75,0,0,215,216,3,126,63,0,216,217,5,118,0,0,217,218,5, + 102,0,0,218,221,1,0,0,0,219,221,5,102,0,0,220,215,1,0,0,0,220,219,1,0, + 0,0,220,221,1,0,0,0,221,222,1,0,0,0,222,223,5,2,0,0,223,225,3,98,49,0, + 224,226,3,106,53,0,225,224,1,0,0,0,225,226,1,0,0,0,226,13,1,0,0,0,227, + 228,5,1,0,0,228,233,3,16,8,0,229,230,5,117,0,0,230,232,3,16,8,0,231,229, + 1,0,0,0,232,235,1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,15,1,0,0,0, + 235,233,1,0,0,0,236,241,5,120,0,0,237,239,5,5,0,0,238,237,1,0,0,0,238, + 239,1,0,0,0,239,240,1,0,0,0,240,242,3,126,63,0,241,238,1,0,0,0,241,242, + 1,0,0,0,242,17,1,0,0,0,243,244,5,94,0,0,244,249,3,28,14,0,245,246,5,117, + 0,0,246,248,3,28,14,0,247,245,1,0,0,0,248,251,1,0,0,0,249,247,1,0,0,0, + 249,250,1,0,0,0,250,252,1,0,0,0,251,249,1,0,0,0,252,253,5,119,0,0,253, + 19,1,0,0,0,254,256,5,54,0,0,255,257,5,85,0,0,256,255,1,0,0,0,256,257,1, + 0,0,0,257,258,1,0,0,0,258,259,5,55,0,0,259,260,3,126,63,0,260,261,5,115, + 0,0,261,266,3,46,23,0,262,263,5,117,0,0,263,265,3,46,23,0,264,262,1,0, + 0,0,265,268,1,0,0,0,266,264,1,0,0,0,266,267,1,0,0,0,267,273,1,0,0,0,268, + 266,1,0,0,0,269,270,5,117,0,0,270,272,3,56,28,0,271,269,1,0,0,0,272,275, + 1,0,0,0,273,271,1,0,0,0,273,274,1,0,0,0,274,276,1,0,0,0,275,273,1,0,0, + 0,276,277,5,116,0,0,277,21,1,0,0,0,278,279,5,54,0,0,279,280,5,92,0,0,280, + 292,3,126,63,0,281,282,5,115,0,0,282,287,3,126,63,0,283,284,5,117,0,0, + 284,286,3,126,63,0,285,283,1,0,0,0,286,289,1,0,0,0,287,285,1,0,0,0,287, + 288,1,0,0,0,288,290,1,0,0,0,289,287,1,0,0,0,290,291,5,116,0,0,291,293, + 1,0,0,0,292,281,1,0,0,0,292,293,1,0,0,0,293,294,1,0,0,0,294,295,5,5,0, + 0,295,296,3,70,35,0,296,23,1,0,0,0,297,298,5,54,0,0,298,299,5,93,0,0,299, + 301,3,126,63,0,300,302,3,26,13,0,301,300,1,0,0,0,301,302,1,0,0,0,302,303, + 1,0,0,0,303,304,5,5,0,0,304,305,3,36,18,0,305,25,1,0,0,0,306,307,5,115, + 0,0,307,312,3,28,14,0,308,309,5,117,0,0,309,311,3,28,14,0,310,308,1,0, + 0,0,311,314,1,0,0,0,312,310,1,0,0,0,312,313,1,0,0,0,313,315,1,0,0,0,314, + 312,1,0,0,0,315,316,5,116,0,0,316,326,1,0,0,0,317,322,3,28,14,0,318,319, + 5,117,0,0,319,321,3,28,14,0,320,318,1,0,0,0,321,324,1,0,0,0,322,320,1, + 0,0,0,322,323,1,0,0,0,323,326,1,0,0,0,324,322,1,0,0,0,325,306,1,0,0,0, + 325,317,1,0,0,0,326,27,1,0,0,0,327,328,3,30,15,0,328,329,3,50,25,0,329, + 29,1,0,0,0,330,333,3,126,63,0,331,333,5,121,0,0,332,330,1,0,0,0,332,331, + 1,0,0,0,333,31,1,0,0,0,334,335,5,61,0,0,335,336,5,55,0,0,336,337,3,126, + 63,0,337,338,3,34,17,0,338,33,1,0,0,0,339,341,5,64,0,0,340,342,5,66,0, + 0,341,340,1,0,0,0,341,342,1,0,0,0,342,343,1,0,0,0,343,397,3,46,23,0,344, + 345,5,64,0,0,345,397,3,56,28,0,346,348,5,61,0,0,347,349,5,66,0,0,348,347, + 1,0,0,0,348,349,1,0,0,0,349,350,1,0,0,0,350,351,3,126,63,0,351,355,3,50, + 25,0,352,354,3,54,27,0,353,352,1,0,0,0,354,357,1,0,0,0,355,353,1,0,0,0, + 355,356,1,0,0,0,356,397,1,0,0,0,357,355,1,0,0,0,358,360,5,61,0,0,359,361, + 5,66,0,0,360,359,1,0,0,0,360,361,1,0,0,0,361,362,1,0,0,0,362,363,3,126, + 63,0,363,364,5,80,0,0,364,365,5,81,0,0,365,366,3,112,56,0,366,397,1,0, + 0,0,367,369,5,61,0,0,368,370,5,66,0,0,369,368,1,0,0,0,369,370,1,0,0,0, + 370,371,1,0,0,0,371,372,3,126,63,0,372,373,5,65,0,0,373,374,5,81,0,0,374, + 397,1,0,0,0,375,376,5,65,0,0,376,377,5,66,0,0,377,397,3,126,63,0,378,379, + 5,65,0,0,379,380,5,72,0,0,380,397,3,126,63,0,381,382,5,62,0,0,382,383, + 5,63,0,0,383,397,3,126,63,0,384,385,5,62,0,0,385,386,5,66,0,0,386,387, + 3,126,63,0,387,388,5,63,0,0,388,389,3,126,63,0,389,397,1,0,0,0,390,391, + 5,62,0,0,391,392,5,84,0,0,392,393,3,126,63,0,393,394,5,63,0,0,394,395, + 3,126,63,0,395,397,1,0,0,0,396,339,1,0,0,0,396,344,1,0,0,0,396,346,1,0, + 0,0,396,358,1,0,0,0,396,367,1,0,0,0,396,375,1,0,0,0,396,378,1,0,0,0,396, + 381,1,0,0,0,396,384,1,0,0,0,396,390,1,0,0,0,397,35,1,0,0,0,398,402,3,70, + 35,0,399,402,3,64,32,0,400,402,3,20,10,0,401,398,1,0,0,0,401,399,1,0,0, + 0,401,400,1,0,0,0,402,37,1,0,0,0,403,405,5,54,0,0,404,406,5,83,0,0,405, + 404,1,0,0,0,405,406,1,0,0,0,406,407,1,0,0,0,407,408,5,84,0,0,408,409,3, + 126,63,0,409,410,5,22,0,0,410,411,3,126,63,0,411,412,5,115,0,0,412,417, + 3,42,21,0,413,414,5,117,0,0,414,416,3,42,21,0,415,413,1,0,0,0,416,419, + 1,0,0,0,417,415,1,0,0,0,417,418,1,0,0,0,418,420,1,0,0,0,419,417,1,0,0, + 0,420,423,5,116,0,0,421,422,5,86,0,0,422,424,3,44,22,0,423,421,1,0,0,0, + 423,424,1,0,0,0,424,39,1,0,0,0,425,426,5,65,0,0,426,427,5,55,0,0,427,441, + 3,126,63,0,428,429,5,65,0,0,429,430,5,84,0,0,430,431,3,126,63,0,431,432, + 5,22,0,0,432,433,3,126,63,0,433,441,1,0,0,0,434,435,5,65,0,0,435,436,5, + 93,0,0,436,441,3,126,63,0,437,438,5,65,0,0,438,439,5,92,0,0,439,441,3, + 126,63,0,440,425,1,0,0,0,440,428,1,0,0,0,440,434,1,0,0,0,440,437,1,0,0, + 0,441,41,1,0,0,0,442,444,3,126,63,0,443,445,7,1,0,0,444,443,1,0,0,0,444, + 445,1,0,0,0,445,43,1,0,0,0,446,452,5,70,0,0,447,448,5,89,0,0,448,452,5, + 101,0,0,449,450,5,90,0,0,450,452,5,101,0,0,451,446,1,0,0,0,451,447,1,0, + 0,0,451,449,1,0,0,0,452,45,1,0,0,0,453,454,3,126,63,0,454,456,3,50,25, + 0,455,457,3,48,24,0,456,455,1,0,0,0,456,457,1,0,0,0,457,461,1,0,0,0,458, + 460,3,54,27,0,459,458,1,0,0,0,460,463,1,0,0,0,461,459,1,0,0,0,461,462, + 1,0,0,0,462,47,1,0,0,0,463,461,1,0,0,0,464,465,5,5,0,0,465,466,5,115,0, + 0,466,467,3,112,56,0,467,468,5,116,0,0,468,49,1,0,0,0,469,471,3,126,63, + 0,470,472,3,126,63,0,471,470,1,0,0,0,471,472,1,0,0,0,472,474,1,0,0,0,473, + 475,3,126,63,0,474,473,1,0,0,0,474,475,1,0,0,0,475,484,1,0,0,0,476,477, + 5,115,0,0,477,480,3,52,26,0,478,479,5,117,0,0,479,481,3,52,26,0,480,478, + 1,0,0,0,480,481,1,0,0,0,481,482,1,0,0,0,482,483,5,116,0,0,483,485,1,0, + 0,0,484,476,1,0,0,0,484,485,1,0,0,0,485,51,1,0,0,0,486,488,5,107,0,0,487, + 486,1,0,0,0,487,488,1,0,0,0,488,489,1,0,0,0,489,490,5,123,0,0,490,53,1, + 0,0,0,491,492,5,8,0,0,492,544,5,101,0,0,493,544,5,101,0,0,494,495,5,81, + 0,0,495,544,3,112,56,0,496,497,5,86,0,0,497,544,7,2,0,0,498,499,5,72,0, + 0,499,501,3,126,63,0,500,498,1,0,0,0,500,501,1,0,0,0,501,502,1,0,0,0,502, + 503,5,91,0,0,503,504,5,115,0,0,504,505,3,58,29,0,505,506,5,116,0,0,506, + 544,1,0,0,0,507,508,5,72,0,0,508,510,3,126,63,0,509,507,1,0,0,0,509,510, + 1,0,0,0,510,511,1,0,0,0,511,512,5,70,0,0,512,544,5,71,0,0,513,514,5,72, + 0,0,514,516,3,126,63,0,515,513,1,0,0,0,515,516,1,0,0,0,516,517,1,0,0,0, + 517,544,5,83,0,0,518,519,5,72,0,0,519,521,3,126,63,0,520,518,1,0,0,0,520, + 521,1,0,0,0,521,522,1,0,0,0,522,523,5,74,0,0,523,535,3,126,63,0,524,525, + 5,115,0,0,525,530,3,126,63,0,526,527,5,117,0,0,527,529,3,126,63,0,528, + 526,1,0,0,0,529,532,1,0,0,0,530,528,1,0,0,0,530,531,1,0,0,0,531,533,1, + 0,0,0,532,530,1,0,0,0,533,534,5,116,0,0,534,536,1,0,0,0,535,524,1,0,0, + 0,535,536,1,0,0,0,536,540,1,0,0,0,537,539,3,60,30,0,538,537,1,0,0,0,539, + 542,1,0,0,0,540,538,1,0,0,0,540,541,1,0,0,0,541,544,1,0,0,0,542,540,1, + 0,0,0,543,491,1,0,0,0,543,493,1,0,0,0,543,494,1,0,0,0,543,496,1,0,0,0, + 543,500,1,0,0,0,543,509,1,0,0,0,543,515,1,0,0,0,543,520,1,0,0,0,544,55, + 1,0,0,0,545,546,5,72,0,0,546,548,3,126,63,0,547,545,1,0,0,0,547,548,1, + 0,0,0,548,549,1,0,0,0,549,550,5,70,0,0,550,551,5,71,0,0,551,552,5,115, + 0,0,552,557,3,126,63,0,553,554,5,117,0,0,554,556,3,126,63,0,555,553,1, + 0,0,0,556,559,1,0,0,0,557,555,1,0,0,0,557,558,1,0,0,0,558,560,1,0,0,0, + 559,557,1,0,0,0,560,561,5,116,0,0,561,629,1,0,0,0,562,563,5,72,0,0,563, + 565,3,126,63,0,564,562,1,0,0,0,564,565,1,0,0,0,565,566,1,0,0,0,566,567, + 5,83,0,0,567,568,5,115,0,0,568,573,3,126,63,0,569,570,5,117,0,0,570,572, + 3,126,63,0,571,569,1,0,0,0,572,575,1,0,0,0,573,571,1,0,0,0,573,574,1,0, + 0,0,574,576,1,0,0,0,575,573,1,0,0,0,576,577,5,116,0,0,577,629,1,0,0,0, + 578,579,5,72,0,0,579,581,3,126,63,0,580,578,1,0,0,0,580,581,1,0,0,0,581, + 582,1,0,0,0,582,583,5,73,0,0,583,586,5,71,0,0,584,585,5,82,0,0,585,587, + 5,84,0,0,586,584,1,0,0,0,586,587,1,0,0,0,587,588,1,0,0,0,588,589,5,115, + 0,0,589,594,3,126,63,0,590,591,5,117,0,0,591,593,3,126,63,0,592,590,1, + 0,0,0,593,596,1,0,0,0,594,592,1,0,0,0,594,595,1,0,0,0,595,597,1,0,0,0, + 596,594,1,0,0,0,597,598,5,116,0,0,598,599,5,74,0,0,599,611,3,126,63,0, + 600,601,5,115,0,0,601,606,3,126,63,0,602,603,5,117,0,0,603,605,3,126,63, + 0,604,602,1,0,0,0,605,608,1,0,0,0,606,604,1,0,0,0,606,607,1,0,0,0,607, + 609,1,0,0,0,608,606,1,0,0,0,609,610,5,116,0,0,610,612,1,0,0,0,611,600, + 1,0,0,0,611,612,1,0,0,0,612,616,1,0,0,0,613,615,3,60,30,0,614,613,1,0, + 0,0,615,618,1,0,0,0,616,614,1,0,0,0,616,617,1,0,0,0,617,629,1,0,0,0,618, + 616,1,0,0,0,619,620,5,72,0,0,620,622,3,126,63,0,621,619,1,0,0,0,621,622, + 1,0,0,0,622,623,1,0,0,0,623,624,5,91,0,0,624,625,5,115,0,0,625,626,3,58, + 29,0,626,627,5,116,0,0,627,629,1,0,0,0,628,547,1,0,0,0,628,564,1,0,0,0, + 628,580,1,0,0,0,628,621,1,0,0,0,629,57,1,0,0,0,630,636,8,3,0,0,631,632, + 5,115,0,0,632,633,3,58,29,0,633,634,5,116,0,0,634,636,1,0,0,0,635,630, + 1,0,0,0,635,631,1,0,0,0,636,639,1,0,0,0,637,635,1,0,0,0,637,638,1,0,0, + 0,638,59,1,0,0,0,639,637,1,0,0,0,640,641,5,22,0,0,641,642,5,76,0,0,642, + 647,3,62,31,0,643,644,5,22,0,0,644,645,5,75,0,0,645,647,3,62,31,0,646, + 640,1,0,0,0,646,643,1,0,0,0,647,61,1,0,0,0,648,657,5,77,0,0,649,650,5, + 82,0,0,650,657,5,79,0,0,651,657,5,78,0,0,652,653,5,80,0,0,653,657,5,101, + 0,0,654,655,5,80,0,0,655,657,5,81,0,0,656,648,1,0,0,0,656,649,1,0,0,0, + 656,651,1,0,0,0,656,652,1,0,0,0,656,654,1,0,0,0,657,63,1,0,0,0,658,659, + 5,67,0,0,659,660,5,68,0,0,660,688,3,126,63,0,661,662,5,115,0,0,662,667, + 3,126,63,0,663,664,5,117,0,0,664,666,3,126,63,0,665,663,1,0,0,0,666,669, + 1,0,0,0,667,665,1,0,0,0,667,668,1,0,0,0,668,670,1,0,0,0,669,667,1,0,0, + 0,670,671,5,116,0,0,671,673,1,0,0,0,672,661,1,0,0,0,672,673,1,0,0,0,673, + 684,1,0,0,0,674,675,5,69,0,0,675,680,3,66,33,0,676,677,5,117,0,0,677,679, + 3,66,33,0,678,676,1,0,0,0,679,682,1,0,0,0,680,678,1,0,0,0,680,681,1,0, + 0,0,681,685,1,0,0,0,682,680,1,0,0,0,683,685,3,70,35,0,684,674,1,0,0,0, + 684,683,1,0,0,0,685,689,1,0,0,0,686,687,5,81,0,0,687,689,5,69,0,0,688, + 672,1,0,0,0,688,686,1,0,0,0,689,65,1,0,0,0,690,691,5,115,0,0,691,696,3, + 68,34,0,692,693,5,117,0,0,693,695,3,68,34,0,694,692,1,0,0,0,695,698,1, + 0,0,0,696,694,1,0,0,0,696,697,1,0,0,0,697,699,1,0,0,0,698,696,1,0,0,0, + 699,700,5,116,0,0,700,67,1,0,0,0,701,704,5,81,0,0,702,704,3,112,56,0,703, + 701,1,0,0,0,703,702,1,0,0,0,704,69,1,0,0,0,705,711,3,72,36,0,706,707,3, + 74,37,0,707,708,3,72,36,0,708,710,1,0,0,0,709,706,1,0,0,0,710,713,1,0, + 0,0,711,709,1,0,0,0,711,712,1,0,0,0,712,715,1,0,0,0,713,711,1,0,0,0,714, + 716,3,108,54,0,715,714,1,0,0,0,715,716,1,0,0,0,716,718,1,0,0,0,717,719, + 3,88,44,0,718,717,1,0,0,0,718,719,1,0,0,0,719,71,1,0,0,0,720,735,3,76, + 38,0,721,722,5,115,0,0,722,723,3,70,35,0,723,724,5,116,0,0,724,735,1,0, + 0,0,725,726,5,69,0,0,726,731,3,66,33,0,727,728,5,117,0,0,728,730,3,66, + 33,0,729,727,1,0,0,0,730,733,1,0,0,0,731,729,1,0,0,0,731,732,1,0,0,0,732, + 735,1,0,0,0,733,731,1,0,0,0,734,720,1,0,0,0,734,721,1,0,0,0,734,725,1, + 0,0,0,735,73,1,0,0,0,736,738,5,50,0,0,737,739,5,51,0,0,738,737,1,0,0,0, + 738,739,1,0,0,0,739,743,1,0,0,0,740,743,5,52,0,0,741,743,5,53,0,0,742, + 736,1,0,0,0,742,740,1,0,0,0,742,741,1,0,0,0,743,75,1,0,0,0,744,746,5,1, + 0,0,745,747,3,78,39,0,746,745,1,0,0,0,746,747,1,0,0,0,747,749,1,0,0,0, + 748,750,3,84,42,0,749,748,1,0,0,0,749,750,1,0,0,0,750,751,1,0,0,0,751, + 754,3,92,46,0,752,753,5,68,0,0,753,755,3,126,63,0,754,752,1,0,0,0,754, + 755,1,0,0,0,755,757,1,0,0,0,756,758,3,96,48,0,757,756,1,0,0,0,757,758, + 1,0,0,0,758,760,1,0,0,0,759,761,3,106,53,0,760,759,1,0,0,0,760,761,1,0, + 0,0,761,763,1,0,0,0,762,764,3,80,40,0,763,762,1,0,0,0,763,764,1,0,0,0, + 764,766,1,0,0,0,765,767,3,82,41,0,766,765,1,0,0,0,766,767,1,0,0,0,767, + 77,1,0,0,0,768,769,7,4,0,0,769,79,1,0,0,0,770,771,5,24,0,0,771,772,5,26, + 0,0,772,777,3,112,56,0,773,774,5,117,0,0,774,776,3,112,56,0,775,773,1, + 0,0,0,776,779,1,0,0,0,777,775,1,0,0,0,777,778,1,0,0,0,778,81,1,0,0,0,779, + 777,1,0,0,0,780,781,5,27,0,0,781,782,3,112,56,0,782,83,1,0,0,0,783,784, + 5,4,0,0,784,789,3,86,43,0,785,786,7,5,0,0,786,788,3,86,43,0,787,785,1, + 0,0,0,788,791,1,0,0,0,789,787,1,0,0,0,789,790,1,0,0,0,790,793,1,0,0,0, + 791,789,1,0,0,0,792,794,5,33,0,0,793,792,1,0,0,0,793,794,1,0,0,0,794,85, + 1,0,0,0,795,802,5,123,0,0,796,802,5,121,0,0,797,798,5,115,0,0,798,799, + 3,112,56,0,799,800,5,116,0,0,800,802,1,0,0,0,801,795,1,0,0,0,801,796,1, + 0,0,0,801,797,1,0,0,0,802,87,1,0,0,0,803,804,5,42,0,0,804,805,3,112,56, + 0,805,812,3,90,45,0,806,807,5,43,0,0,807,808,7,6,0,0,808,809,3,112,56, + 0,809,810,3,90,45,0,810,811,5,48,0,0,811,813,1,0,0,0,812,806,1,0,0,0,812, + 813,1,0,0,0,813,821,1,0,0,0,814,815,5,43,0,0,815,816,7,6,0,0,816,817,3, + 112,56,0,817,818,3,90,45,0,818,819,5,48,0,0,819,821,1,0,0,0,820,803,1, + 0,0,0,820,814,1,0,0,0,821,89,1,0,0,0,822,823,7,7,0,0,823,91,1,0,0,0,824, + 834,5,102,0,0,825,830,3,94,47,0,826,827,5,117,0,0,827,829,3,94,47,0,828, + 826,1,0,0,0,829,832,1,0,0,0,830,828,1,0,0,0,830,831,1,0,0,0,831,834,1, + 0,0,0,832,830,1,0,0,0,833,824,1,0,0,0,833,825,1,0,0,0,834,93,1,0,0,0,835, + 836,3,126,63,0,836,837,5,118,0,0,837,838,5,102,0,0,838,847,1,0,0,0,839, + 844,3,112,56,0,840,842,5,5,0,0,841,840,1,0,0,0,841,842,1,0,0,0,842,843, + 1,0,0,0,843,845,3,126,63,0,844,841,1,0,0,0,844,845,1,0,0,0,845,847,1,0, + 0,0,846,835,1,0,0,0,846,839,1,0,0,0,847,95,1,0,0,0,848,849,5,2,0,0,849, + 854,3,98,49,0,850,851,5,117,0,0,851,853,3,98,49,0,852,850,1,0,0,0,853, + 856,1,0,0,0,854,852,1,0,0,0,854,855,1,0,0,0,855,97,1,0,0,0,856,854,1,0, + 0,0,857,861,3,100,50,0,858,860,3,102,51,0,859,858,1,0,0,0,860,863,1,0, + 0,0,861,859,1,0,0,0,861,862,1,0,0,0,862,99,1,0,0,0,863,861,1,0,0,0,864, + 869,3,126,63,0,865,867,5,5,0,0,866,865,1,0,0,0,866,867,1,0,0,0,867,868, + 1,0,0,0,868,870,3,126,63,0,869,866,1,0,0,0,869,870,1,0,0,0,870,885,1,0, + 0,0,871,872,5,115,0,0,872,873,3,70,35,0,873,878,5,116,0,0,874,876,5,5, + 0,0,875,874,1,0,0,0,875,876,1,0,0,0,876,877,1,0,0,0,877,879,3,126,63,0, + 878,875,1,0,0,0,878,879,1,0,0,0,879,885,1,0,0,0,880,881,5,115,0,0,881, + 882,3,98,49,0,882,883,5,116,0,0,883,885,1,0,0,0,884,864,1,0,0,0,884,871, + 1,0,0,0,884,880,1,0,0,0,885,101,1,0,0,0,886,887,3,104,52,0,887,888,5,20, + 0,0,888,889,3,100,50,0,889,890,5,22,0,0,890,891,3,112,56,0,891,902,1,0, + 0,0,892,893,5,34,0,0,893,894,5,20,0,0,894,902,3,100,50,0,895,896,5,34, + 0,0,896,897,5,35,0,0,897,902,3,100,50,0,898,899,5,19,0,0,899,900,5,35, + 0,0,900,902,3,100,50,0,901,886,1,0,0,0,901,892,1,0,0,0,901,895,1,0,0,0, + 901,898,1,0,0,0,902,103,1,0,0,0,903,905,5,15,0,0,904,903,1,0,0,0,904,905, + 1,0,0,0,905,919,1,0,0,0,906,908,5,16,0,0,907,909,5,19,0,0,908,907,1,0, + 0,0,908,909,1,0,0,0,909,919,1,0,0,0,910,912,5,17,0,0,911,913,5,19,0,0, + 912,911,1,0,0,0,912,913,1,0,0,0,913,919,1,0,0,0,914,916,5,18,0,0,915,917, + 5,19,0,0,916,915,1,0,0,0,916,917,1,0,0,0,917,919,1,0,0,0,918,904,1,0,0, + 0,918,906,1,0,0,0,918,910,1,0,0,0,918,914,1,0,0,0,919,105,1,0,0,0,920, + 921,5,3,0,0,921,922,3,112,56,0,922,107,1,0,0,0,923,924,5,23,0,0,924,925, + 5,26,0,0,925,930,3,110,55,0,926,927,5,117,0,0,927,929,3,110,55,0,928,926, + 1,0,0,0,929,932,1,0,0,0,930,928,1,0,0,0,930,931,1,0,0,0,931,109,1,0,0, + 0,932,930,1,0,0,0,933,935,3,112,56,0,934,936,7,1,0,0,935,934,1,0,0,0,935, + 936,1,0,0,0,936,111,1,0,0,0,937,938,6,56,-1,0,938,939,5,8,0,0,939,946, + 3,112,56,16,940,941,5,12,0,0,941,946,3,112,56,15,942,943,5,107,0,0,943, + 946,3,112,56,14,944,946,3,114,57,0,945,937,1,0,0,0,945,940,1,0,0,0,945, + 942,1,0,0,0,945,944,1,0,0,0,946,1016,1,0,0,0,947,948,10,13,0,0,948,949, + 5,105,0,0,949,1015,3,112,56,14,950,951,10,12,0,0,951,952,7,8,0,0,952,1015, + 3,112,56,13,953,954,10,11,0,0,954,955,7,9,0,0,955,1015,3,112,56,12,956, + 957,10,10,0,0,957,958,7,10,0,0,958,1015,3,112,56,11,959,961,10,9,0,0,960, + 962,5,8,0,0,961,960,1,0,0,0,961,962,1,0,0,0,962,963,1,0,0,0,963,964,5, + 49,0,0,964,965,3,112,56,0,965,966,5,6,0,0,966,967,3,112,56,10,967,1015, + 1,0,0,0,968,970,10,8,0,0,969,971,5,8,0,0,970,969,1,0,0,0,970,971,1,0,0, + 0,971,972,1,0,0,0,972,973,5,13,0,0,973,1015,3,112,56,9,974,975,10,4,0, + 0,975,976,7,11,0,0,976,1015,3,112,56,5,977,978,10,3,0,0,978,979,5,6,0, + 0,979,1015,3,112,56,4,980,981,10,2,0,0,981,982,5,7,0,0,982,1015,3,112, + 56,3,983,985,10,7,0,0,984,986,5,8,0,0,985,984,1,0,0,0,985,986,1,0,0,0, + 986,987,1,0,0,0,987,988,5,21,0,0,988,989,5,115,0,0,989,990,3,70,35,0,990, + 991,5,116,0,0,991,1015,1,0,0,0,992,994,10,6,0,0,993,995,5,8,0,0,994,993, + 1,0,0,0,994,995,1,0,0,0,995,996,1,0,0,0,996,997,5,21,0,0,997,998,5,115, + 0,0,998,1003,3,112,56,0,999,1000,5,117,0,0,1000,1002,3,112,56,0,1001,999, + 1,0,0,0,1002,1005,1,0,0,0,1003,1001,1,0,0,0,1003,1004,1,0,0,0,1004,1006, + 1,0,0,0,1005,1003,1,0,0,0,1006,1007,5,116,0,0,1007,1015,1,0,0,0,1008,1009, + 10,5,0,0,1009,1011,5,25,0,0,1010,1012,5,8,0,0,1011,1010,1,0,0,0,1011,1012, + 1,0,0,0,1012,1013,1,0,0,0,1013,1015,5,101,0,0,1014,947,1,0,0,0,1014,950, + 1,0,0,0,1014,953,1,0,0,0,1014,956,1,0,0,0,1014,959,1,0,0,0,1014,968,1, + 0,0,0,1014,974,1,0,0,0,1014,977,1,0,0,0,1014,980,1,0,0,0,1014,983,1,0, + 0,0,1014,992,1,0,0,0,1014,1008,1,0,0,0,1015,1018,1,0,0,0,1016,1014,1,0, + 0,0,1016,1017,1,0,0,0,1017,113,1,0,0,0,1018,1016,1,0,0,0,1019,1039,3,128, + 64,0,1020,1039,3,116,58,0,1021,1039,3,120,60,0,1022,1039,3,124,62,0,1023, + 1039,5,121,0,0,1024,1039,5,120,0,0,1025,1026,5,28,0,0,1026,1027,5,115, + 0,0,1027,1028,3,70,35,0,1028,1029,5,116,0,0,1029,1039,1,0,0,0,1030,1031, + 5,115,0,0,1031,1032,3,70,35,0,1032,1033,5,116,0,0,1033,1039,1,0,0,0,1034, + 1035,5,115,0,0,1035,1036,3,112,56,0,1036,1037,5,116,0,0,1037,1039,1,0, + 0,0,1038,1019,1,0,0,0,1038,1020,1,0,0,0,1038,1021,1,0,0,0,1038,1022,1, + 0,0,0,1038,1023,1,0,0,0,1038,1024,1,0,0,0,1038,1025,1,0,0,0,1038,1030, + 1,0,0,0,1038,1034,1,0,0,0,1039,115,1,0,0,0,1040,1042,5,38,0,0,1041,1043, + 3,112,56,0,1042,1041,1,0,0,0,1042,1043,1,0,0,0,1043,1045,1,0,0,0,1044, + 1046,3,118,59,0,1045,1044,1,0,0,0,1046,1047,1,0,0,0,1047,1045,1,0,0,0, + 1047,1048,1,0,0,0,1048,1051,1,0,0,0,1049,1050,5,40,0,0,1050,1052,3,112, + 56,0,1051,1049,1,0,0,0,1051,1052,1,0,0,0,1052,1053,1,0,0,0,1053,1054,5, + 41,0,0,1054,117,1,0,0,0,1055,1056,5,39,0,0,1056,1057,3,112,56,0,1057,1058, + 5,30,0,0,1058,1059,3,112,56,0,1059,119,1,0,0,0,1060,1061,3,122,61,0,1061, + 1074,5,115,0,0,1062,1075,5,102,0,0,1063,1065,5,32,0,0,1064,1063,1,0,0, + 0,1064,1065,1,0,0,0,1065,1066,1,0,0,0,1066,1071,3,112,56,0,1067,1068,5, + 117,0,0,1068,1070,3,112,56,0,1069,1067,1,0,0,0,1070,1073,1,0,0,0,1071, + 1069,1,0,0,0,1071,1072,1,0,0,0,1072,1075,1,0,0,0,1073,1071,1,0,0,0,1074, + 1062,1,0,0,0,1074,1064,1,0,0,0,1074,1075,1,0,0,0,1075,1076,1,0,0,0,1076, + 1079,5,116,0,0,1077,1078,5,36,0,0,1078,1080,3,134,67,0,1079,1077,1,0,0, + 0,1079,1080,1,0,0,0,1080,121,1,0,0,0,1081,1088,3,126,63,0,1082,1088,5, + 16,0,0,1083,1088,5,17,0,0,1084,1088,5,97,0,0,1085,1088,5,45,0,0,1086,1088, + 5,37,0,0,1087,1081,1,0,0,0,1087,1082,1,0,0,0,1087,1083,1,0,0,0,1087,1084, + 1,0,0,0,1087,1085,1,0,0,0,1087,1086,1,0,0,0,1088,123,1,0,0,0,1089,1090, + 3,126,63,0,1090,1091,5,118,0,0,1091,1093,1,0,0,0,1092,1089,1,0,0,0,1092, + 1093,1,0,0,0,1093,1094,1,0,0,0,1094,1095,3,126,63,0,1095,125,1,0,0,0,1096, + 1097,7,12,0,0,1097,127,1,0,0,0,1098,1108,5,123,0,0,1099,1108,5,124,0,0, + 1100,1108,5,122,0,0,1101,1108,5,125,0,0,1102,1108,5,126,0,0,1103,1108, + 5,127,0,0,1104,1108,5,99,0,0,1105,1108,5,100,0,0,1106,1108,5,101,0,0,1107, + 1098,1,0,0,0,1107,1099,1,0,0,0,1107,1100,1,0,0,0,1107,1101,1,0,0,0,1107, + 1102,1,0,0,0,1107,1103,1,0,0,0,1107,1104,1,0,0,0,1107,1105,1,0,0,0,1107, + 1106,1,0,0,0,1108,129,1,0,0,0,1109,1111,5,56,0,0,1110,1112,7,13,0,0,1111, + 1110,1,0,0,0,1111,1112,1,0,0,0,1112,1122,1,0,0,0,1113,1115,5,57,0,0,1114, + 1116,7,13,0,0,1115,1114,1,0,0,0,1115,1116,1,0,0,0,1116,1122,1,0,0,0,1117, + 1119,5,58,0,0,1118,1120,7,13,0,0,1119,1118,1,0,0,0,1119,1120,1,0,0,0,1120, + 1122,1,0,0,0,1121,1109,1,0,0,0,1121,1113,1,0,0,0,1121,1117,1,0,0,0,1122, + 131,1,0,0,0,1123,1124,3,112,56,0,1124,1125,5,0,0,1,1125,133,1,0,0,0,1126, + 1137,5,115,0,0,1127,1128,5,37,0,0,1128,1129,5,26,0,0,1129,1134,3,112,56, + 0,1130,1131,5,117,0,0,1131,1133,3,112,56,0,1132,1130,1,0,0,0,1133,1136, + 1,0,0,0,1134,1132,1,0,0,0,1134,1135,1,0,0,0,1135,1138,1,0,0,0,1136,1134, + 1,0,0,0,1137,1127,1,0,0,0,1137,1138,1,0,0,0,1138,1140,1,0,0,0,1139,1141, + 3,108,54,0,1140,1139,1,0,0,0,1140,1141,1,0,0,0,1141,1142,1,0,0,0,1142, + 1143,5,116,0,0,1143,135,1,0,0,0,143,137,153,156,162,182,191,194,204,208, + 220,225,233,238,241,249,256,266,273,287,292,301,312,322,325,332,341,348, + 355,360,369,396,401,405,417,423,440,444,451,456,461,471,474,480,484,487, + 500,509,515,520,530,535,540,543,547,557,564,573,580,586,594,606,611,616, + 621,628,635,637,646,656,667,672,680,684,688,696,703,711,715,718,731,734, + 738,742,746,749,754,757,760,763,766,777,789,793,801,812,820,830,833,841, + 844,846,854,861,866,869,875,878,884,901,904,908,912,916,918,930,935,945, + 961,970,985,994,1003,1011,1014,1016,1038,1042,1047,1051,1064,1071,1074, + 1079,1087,1092,1107,1111,1115,1119,1121,1134,1137,1140 }; public static readonly ATN _ATN = diff --git a/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlVisitor.cs b/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlVisitor.cs index df8d8f9b..fc4d7ae7 100644 --- a/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlVisitor.cs +++ b/src/LibRed/LibRed.Sql/Grammar/Generated/AccessSqlVisitor.cs @@ -278,6 +278,12 @@ public interface IAccessSqlVisitor : IParseTreeVisitor { /// The visitor result. Result VisitColumnDefinition([NotNull] AccessSqlParser.ColumnDefinitionContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitCalculatedClause([NotNull] AccessSqlParser.CalculatedClauseContext context); + /// /// Visit a parse tree produced by . /// /// The parse tree. diff --git a/src/LibRed/LibRed.Sql/Parsing/AstBuilder.cs b/src/LibRed/LibRed.Sql/Parsing/AstBuilder.cs index 5c97a49c..cc608803 100644 --- a/src/LibRed/LibRed.Sql/Parsing/AstBuilder.cs +++ b/src/LibRed/LibRed.Sql/Parsing/AstBuilder.cs @@ -285,9 +285,13 @@ private static ColumnDefinition BuildColumnDefinition(ColumnDefinitionContext ct // matching Access — e.g. "42", "'hi'"). Re-parsed and evaluated when a column is omitted on insert. string? defaultSql = ctx.columnConstraint().OfType() .FirstOrDefault()?.expression().GetText(); + // OriginalText, not GetText: the expression is stored verbatim and re-read by whichever engine opens + // the file, so its spacing and quoting have to survive the round trip through the parser. + string? calculated = ctx.calculatedClause() is { } calc ? OriginalText(calc.expression()) : null; return new ColumnDefinition( - Identifier(ctx.name), typeName, size, scale, notNull, primaryKey, defaultSql, compressed); + Identifier(ctx.name), typeName, size, scale, notNull, primaryKey, defaultSql, compressed, + calculated); } private static SqlStatement BuildCreateIndex(CreateIndexStatementContext ctx) diff --git a/src/LibRed/docs/format/README.md b/src/LibRed/docs/format/README.md index c6b73b3e..47e79350 100644 --- a/src/LibRed/docs/format/README.md +++ b/src/LibRed/docs/format/README.md @@ -18,9 +18,11 @@ Implemented by `src/LibRed/LibRed.Core/`. The canonical offsets live in > **This reference is split across several files** — one per page type, plus cross-cutting topics; each is > self-contained (its structures *and* its read/write mechanics live together). Most describe the **on-disk -> format**; [page-02c-default-values.md](page-02c-default-values.md) is the exception — it covers `DEFAULT` -> **semantics** (engine behaviour), sitting with the column pages because it's a column feature. This README -> is the map. For a bare field-layout lookup with no prose, see the [structures appendix](appendix-structures.md). +> format**; [page-02c-default-values.md](page-02c-default-values.md) and +> [page-02e-calculated-columns.md](page-02e-calculated-columns.md) are the exceptions — they cover `DEFAULT` +> and calculated-column **semantics** (engine behaviour), sitting with the column pages because both are +> column features. This README is the map. For a bare field-layout lookup with no prose, see the +> [structures appendix](appendix-structures.md). --- @@ -34,6 +36,7 @@ Implemented by `src/LibRed/LibRed.Core/`. The canonical offsets live in | [page-02b-columns.md](page-02b-columns.md) | TDEF **columns**: the 25-byte descriptor, and column maintenance incl. the in-place **`ALTER COLUMN`** type/length change | | [page-02c-default-values.md](page-02c-default-values.md) | Column **`DEFAULT`** value *semantics* — what an expression may contain, the DDL-parser-vs-expression-service split (engine behaviour; the on-disk `LvProp` storage is in [system-catalog.md](system-catalog.md)) | | [page-02d-constraints.md](page-02d-constraints.md) | TDEF **indexes / keys / constraints**: index-data, index-info and stats blocks (PK / unique / FK metadata) | +| [page-02e-calculated-columns.md](page-02e-calculated-columns.md) | **Calculated column** *semantics* — the expression language ACE accepts, when the cached result is recomputed, and what DDL may do to one (engine behaviour; the descriptor and value envelope are in [page-02b](page-02b-columns.md)) | | [page-03-04-index-btree.md](page-03-04-index-btree.md) | Index B-tree pages (types `0x03` node / `0x04` leaf): header, entries, prefix compression, key encoding, splitting | | [page-05-usage-maps.md](page-05-usage-maps.md) | Per-table owned/free usage maps, `0x05` bitmap pages, and the global free-pages map (allocation) | | [long-values.md](long-values.md) | Memo / OLE long values, LVAL pages, and the per-column usage-map list | diff --git a/src/LibRed/docs/format/page-02b-columns.md b/src/LibRed/docs/format/page-02b-columns.md index 4d80f658..4e0fa122 100644 --- a/src/LibRed/docs/format/page-02b-columns.md +++ b/src/LibRed/docs/format/page-02b-columns.md @@ -86,14 +86,34 @@ variable-length**, and its slot holds a fixed envelope around the result ACE las | Offset | Size | Meaning | | --- | --- | --- | -| `0x00` | 16 | Reserved; zero in every row measured | +| `0x00` | 4 | **VBA error number**, little-endian — zero when the expression produced a value (or Null) | +| `0x04` | 12 | Reserved; zero in every row measured | | `0x10` | 4 | Payload length, little-endian | | `0x14` | *n* | Payload — the value in its ordinary on-disk encoding for its type | | `0x14`+*n* | 3 | Padding; zero in every row measured | -so a stored value occupies *n* + 23 bytes. The payload is encoded exactly as the same value would be in an -ordinary column — text keeps the usual compressed (`FF FE` prefix) or raw UTF-16LE choice — so it can go -straight to the normal type codec. +> **An error is stored, and it is not the same as Null.** The expression service raises rather than +> propagating in some cases — notably the conversions, which is why `CDbl(Null)` is an error and not a Null +> result — and ACE caches the failure instead of a value. Measured on a `Double`-result column: +> +> | expression, over the bad input | envelope | +> | --- | --- | +> | `[Qty]/3` over Null (propagates) | all 23 bytes zero — a zero-length payload, i.e. Null | +> | `CDbl([Qty])/3` over Null | starts `5E 00 00 00`, 38 bytes — **94**, VBA "Invalid use of Null" | +> | `CDbl([A])` over `'hello'` | starts `0D 00 00 00`, 38 bytes — **13**, VBA "Type mismatch" | +> +> So the leading field is the VBA runtime error number, and an error envelope is 38 bytes against 23 for a +> Null. Reading such a column through OLE DB fails with *"Multiple-step OLE DB operation generated errors"* — +> ACE will not hand back a row whose calculated column is in an error state. Anything decoding the payload +> alone reads it as Null, which is what LibRed does today and is a silent disagreement, not a Null. + +so a stored value occupies *n* + 23 bytes. The payload is encoded as the same value would be in an ordinary +column, with one measured exception: **text compression follows the declared type, not the payload.** A +calculated **Text** payload takes the usual compressed (`FF FE` prefix) form, and takes it even though the +column's extended flags carry `0xC0` and not `0x01` — so the compressed-capable flag does not gate it here, +the same exemption inline long values get. A calculated **Memo** payload is **never** compressed, at any +length. Measured: `"hello-x"` in a Text column stores as 9 compressed bytes, `"hello-memo"` in a Memo column +as 20 bytes of raw UTF-16LE. > **The descriptor's type is a *storage* type, not the result type.** ACE widens the declared type to the > next one in its family and stores the payload at the result's natural width, so reading `0x17` bytes for @@ -116,7 +136,14 @@ straight to the normal type codec. > A Null result is a zero-length payload — the null-bitmap bit stays **set**, so the bit means "present" > here and nothing more. That also makes a calculated **Boolean** a trap: an ordinary Boolean *is* its > bitmap bit, but a calculated one carries a real payload (`FF`/`00`) and its bit is set even when the -> value is False. The declared length at `0x17` is `39` for these columns and is not the payload size. +> value is False. +> +> **The declared length at `0x17` is a constant per result-type family, not a payload size.** Swept across +> every type DAO will create: `0` for a Memo result, `509` for Text at *any* requested size (10, 60 and 255 +> all give 509), `510` for Binary, and `39` for everything else including GUID — which, like Memo and Binary, +> takes descriptor type `0x0A` Text, so only the length tells the three apart. Nothing moves these: not the +> size requested, not the length of the expression. Because the requested size is discarded, ACE does **not** +> truncate — a `Text(5)` calculated column stores and returns a much longer result in full. > > **A calculated Memo arrives through the long-value machinery.** ACE declares it `0x0A` Text with a > declared length of `0`, gives it a **long-value map entry**, and stores a long-value descriptor in the @@ -124,10 +151,19 @@ straight to the normal type codec. > declared type is not Memo/OLE — a guard that assumed otherwise rejected the TDEF, and because the catalog > loads every TDEF that made the whole database unopenable. > +> That descriptor obeys the ordinary long-value rules: the value inlines while it is at most 64 bytes and +> otherwise takes its own LVAL page. What is measured against that limit is the **whole envelope**, 23 bytes +> of frame plus the uncompressed payload, so a calculated Memo crosses it sooner than the text alone +> suggests — `"hello-memo"` inlines at 43 bytes, while a 36-character result is 95 and spills. +> > Measured against ACE-authored columns of every type DAO will create (`CalculatedColumnAccessTests`), and > against `AdventureWorks_Learn_To_Write_DAX.accdb`, a database in the wild whose `fctSales.OrderDate` is -> a calculated `DateTime`. LibRed **reads** these values; it does not create calculated columns or -> re-evaluate an expression, so a row it writes cannot refresh one. +> a calculated `DateTime`. LibRed reads **and writes** these values: it evaluates the expression itself and +> refreshes the cache on exactly the writes ACE would — when an UPDATE touches a column the expression reads, +> and not otherwise. It also **creates** them, and ACE accepts, evaluates and recomputes the result for every +> result type (`Creates_a_calculated_column_ace_accepts`). Three things must agree or Access reads the payload +> at the wrong width: the descriptor's promoted type, the constant declared length, and `ResultType` in the +> blob. A Memo result additionally needs long-value maps, which its *declared* type does not indicate. > `0x0B`–`0x0C` is a union keyed by type: for a Decimal/Numeric column (type `0x10`) it holds > the **precision** (`0x0B`) and **scale** (`0x0C`) — verified with a `DECIMAL(12,3)` column, diff --git a/src/LibRed/docs/format/page-02c-default-values.md b/src/LibRed/docs/format/page-02c-default-values.md index ef288dc5..c1b2d60e 100644 --- a/src/LibRed/docs/format/page-02c-default-values.md +++ b/src/LibRed/docs/format/page-02c-default-values.md @@ -61,6 +61,16 @@ capabilities. 2. **The expression *service*** (used to *evaluate* a stored default at insert, and by field validation rules) handles the full expression language. +> **They do not even share a lexer.** ACE's SQL parser accepts `` `backtick` `` identifier quoting — it is +> what EF Core's Jet provider emits for every identifier — and the expression service does **not**. It reads +> `` `Qty` `` as a field whose name literally includes the backticks and fails with *"Could not find field +> '`Qty`'"*. Measured in two unrelated features: a calculated column's `Expression`, and a `CHECK` constraint, +> where `ALTER TABLE … CHECK (`Qty` > 0)` is **accepted and stored** and every later INSERT is then refused. +> That is the same smuggling route as the compound defaults above, but it lands the other way round: the DDL +> parser stores something the service cannot evaluate, so the table ends up unusable rather than usefully +> extended. Any expression text LibRed writes into `LvProp` therefore has to be in the service's own syntax — +> brackets, not backticks — whatever quoting the SQL it came from used. + Consequence: a compound default that the DDL parser refuses can still be **stored** (via the table designer, DAO, or LibRed writing `LvProp` directly) and is then **read and applied** by ACE at insert. Verified: `"INV-" & Year(Now())` → `INV-2026`, `1 + 2` → `3`, `Year(Now())` → `2026`, `CBool(Choose(1,0,1,2))` → `False`, diff --git a/src/LibRed/docs/format/page-02e-calculated-columns.md b/src/LibRed/docs/format/page-02e-calculated-columns.md new file mode 100644 index 00000000..7fccc6cc --- /dev/null +++ b/src/LibRed/docs/format/page-02e-calculated-columns.md @@ -0,0 +1,446 @@ +# Calculated columns — semantics + +Column **`AS `** *semantics*: the expression language ACE accepts, how the cached result is +encoded, and when it is recomputed. Like [page-02c-default-values.md](page-02c-default-values.md) this +describes **engine behaviour** rather than on-disk layout; the 25-byte descriptor, the value envelope and the +long-value route live in [page-02b-columns §3.4a](page-02b-columns.md), and the `LvProp` property blob that +carries the expression is in [system-catalog.md](system-catalog.md). + +Everything here is **measured** — against ACE-authored columns of every type DAO will create +(`CalculatedColumnAccessTests`), against `AdventureWorks_Learn_To_Write_DAX.accdb` from the wild, and from +the write side by having ACE read back what LibRed produced. + +> **There is no single "what ACE does" to match.** Four independent gatekeepers enforce different rules and +> do not share a rulebook: **DAO** is the only thing that can author a calculated column and refuses to +> modify one afterwards; the **SQL/OLE DB** layer cannot declare one but will happily `ALTER` around it, and +> is the only layer that refuses to write one directly; the **storage engine** enforces the function +> whitelist, and errors on every read of a column whose expression it dislikes; and Access's **Expression +> Builder** offers `$` name variants the other three cannot sustain. Several behaviours below are therefore a +> *choice* of which layer to follow — each is flagged where it arises. + +## What LibRed does + +Reads, writes, creates and alters them. It decodes the cached value by the column's `ResultType`, evaluates +the expression itself, and refreshes the cache on exactly the writes ACE would — no more, because the stored +value is a cache of ACE's own evaluation and anything else there produces a file that disagrees with itself. + +- the envelope is decoded and encoded (`CalculatedValue`), including the long-value route a calculated Memo + takes, and the long-value map admits a calculated column whatever its declared type; +- `ResultType` decides how the payload is read, rather than it being inferred from the payload's width; +- `CalculatedExpression` parses and validates, `CalculatedEvaluator` evaluates — every function on the + whitelist below, with Access's null semantics and its per-function argument rules; +- `RowEncoder` recomputes on insert; `RowInserter.Update` does so only when a column the expression reads is + in the changed set; +- a Memo result too large to inline spills to a long-value page through a callback `RowInserter` hands the + encoder — a calculated column is the one value the encoder *derives* rather than receives, so it cannot + have been materialised before the row arrived the way a plain memo is. Recomputing frees the pages the + previous result held; +- `ColumnSpec.Calculated` authors one, and `DELETE` frees a calculated Memo's pages. + +**Not done:** changing an existing calculated column's expression or result type (see [Still +open](#still-open)), and any SQL syntax for declaring one — Access SQL has none, so it would need LibRed's +extended mode. + +## What the file actually carries + +Three places, and all three must agree. Measured with DAO-authored columns of every type it will create +(`CalculatedColumnAccessTests`). + +**1. The column descriptor** — a *promoted storage type*, the `0xC0` extended flag, always variable-length, +declared length `39` for a value type and `0` when the result is a Memo. + +**2. The value envelope** in the variable slot — `[reserved:16][length:4][payload:n][padding:3]`. + +**3. The table's property blob (`LvProp`)**, which is where the real semantics live: + +| Property | Type | Meaning | +| --- | --- | --- | +| `Expression` | Memo | the expression text, e.g. `[Qty]*2`, `[A] & "-memo"` | +| `ResultType` | Byte | the **real** result type as a Jet type code | +| `FCMinReadVer` / `FCMinWriteVer` / `FCMinDesignVer` | Text | `14.0.0000.0000`, non-DDL — the Access floor a calculated column forces | + +`ResultType` is the authority on how to read the payload, and it is the Jet type code of the type the +column was **declared** with: `01` Boolean, `02` Byte, `03` Int16, `04` Int32, `05` Currency, `06` Single, +`07` Double, `08` DateTime, `0A` Text, `0C` Memo. + +The descriptor's type is something else again — the promoted static type of **the expression**, which need +not agree with the declared type at all. A `CDbl(...)` expression on a column declared `dbLong` gets +descriptor `Double`, `ResultType` `Int32`, and a 4-byte Int32 payload. So: + +> **descriptor type = promotion of the expression's type · `ResultType` = the declared type · payload is +> encoded per `ResultType`.** + +**This makes Phase 1 a bug fix, not a refinement.** `CalculatedValue.StoredType` infers the payload type +from the declared type and the payload width, which only works while the two agree. Where they diverge it +is wrong, and measurably so: + +| column | descriptor | `ResultType` | payload | LibRed today | +| --- | --- | --- | --- | --- | +| `CDbl([Qty])` declared `dbLong` | Double | Int32 | 4 bytes | **`1E-44`** — reads the Int32 as a Single | +| `CDbl([Qty])` declared `dbCurrency` | Double | Currency | 8 bytes | **`3.45846E-319`** — reads the scaled int64 as a Double | +| `CDbl([Qty])` declared `dbInteger` | Double | Int16 | 2 bytes | **throws** `has 2 bytes; expected 8` | +| `CDbl([Qty])` declared `dbText` | Double | Text | *n* | **throws** | +| `CDbl([Qty])` declared `dbBoolean` | Double | Boolean | 1 byte | **throws** | + +The corpus did not contain such a column, and every DAO-authored case in `CalculatedColumnAccessTests` +has the declared and expression types agreeing, which is why this passed. Reading `ResultType` removes the +guess entirely. + +## The expression language ACE accepts + +Enumerated over every scalar function [functions.md](../functions.md) catalogues plus every operator — 147 +candidates, **72 accepted**. This is the whole surface, not a sample. + +**Operators** — `+` `-` `*` `/` `^` `&`, `+` as concatenation, `=` `<>` `<` `>` `<=` `>=`, `And`, `Or`, +`Not`, `Is Null`, `Like`, `In`, unary minus, parentheses, literal-only expressions. + +**Math** — `Abs` `Sgn` `Int` `Fix` `Round` `Sqr` `Exp` `Log` `Sin` `Cos` `Tan` `Atn`. + +**String** — `Len` `LCase` `UCase` `Trim` `Left` `Right` `Mid` `InStr` `Space` `String` `Str` `Asc`. + +**Date** — `DateSerial` `TimeSerial` `Year` `Month` `Day` `Hour` `Minute` `Second` `Weekday` `MonthName` +`WeekdayName`, plus date arithmetic (`[D1]+1`, `[D1]-[D1]`). + +**Conditional and inspection** — `IIf`, `Choose`, `IsNull`, `IsEmpty`. + +**Conversion** — `CDbl`, and *only* `CDbl`. + +**Financial** — all ten: `Pmt` `FV` `PV` `NPer` `Rate` `IPmt` `PPmt` `SLN` `SYD` `DDB`. + +Everything else is refused, in one of **four** distinct ways — a validator has to reproduce all four: + +| Message | Cases | +| --- | --- | +| `The expression cannot be used in a calculated column.` | the policy whitelist — 69 cases, listed below | +| `Expression not supported for conversion` | `Eqv`, `Imp`, `Between` | +| `Syntax error in expression.` | a call with a **missing optional argument** (below), and `CDec`, which the parser does not know at all | +| `The expression cannot be saved because it refers to another table.` / `... refers to itself.` | scope violations | + +### Cross-checked against Access's own Expression Builder + +Access's Expression Builder, opened on a calculated column, lists the functions it will offer. Its list and +the 49 functions measured above agree **exactly** — every function the builder shows was found accepted, and +nothing found accepted is missing from it. That is a genuinely independent confirmation: one list comes from +the UI, the other from driving DAO. + +It also exposed two things the sweep never tried, both of which turned out to matter. + +**`IsEmpty` is accepted, and is a constant.** VBA's `IsEmpty` asks whether a Variant was never initialised, +which a stored column value never is: ACE returns `False` for a column holding a value *and* for one holding +Null. It is on the whitelist but can only ever be `False`. + +**The `$` name variants are a trap.** The builder offers `LCase$` `Left$` `Mid$` `Right$` `Space$` `Str$` +`String$` `Trim$` `UCase$`, and the designer **accepts** them — but ACE then fails **every** insert into that +table with *"Error evaluating CHECK constraint"*, while the plain name works on an otherwise identical +table. So a `$` variant produces a column that cannot be populated in Access either. This is the same shape +as indexing a calculated column: accepted at design time, unusable in practice. LibRed refuses them with a +message pointing at the plain name — that is matching ACE, not falling short of it. + +### Optional arguments must be supplied — but only for some functions + +[MSDN ff945943](https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2010/ff945943(v=office.14)) +states it twice: *"Although the third parameter for the Mid method is optional in VBA, calculated fields +require you to supply all parameter values"*, and *"you must supply all parameters for methods that you +call, even if the parameters are optional."* + +It is real, and it is why `InStr` first measured as refused — `InStr([A],"a")` is a **syntax error**, while +`InStr(1,[A],"a")` and `InStr(1,[A],"a",0)` are both **accepted**. `Mid` behaves the same way: `Mid([A],2)` +is a syntax error, `Mid([A],2,3)` is fine, which is the article's own example. A calculated-column parser +therefore has to enforce arity, and must report a wrong count as a *syntax* error rather than a policy +refusal. + +> **A syntax error means the wrong ARITY, not an unknown name — the opposite of the obvious reading.** +> Measured with the discriminating pair: `NotAFunction([Qty])`, a name nothing could know, gets the *policy* +> message; `Abs([Qty],2)` and `Abs()`, a whitelisted name with the wrong count, get *"Syntax error in +> expression."* So "syntax error" says nothing about whether ACE knows the function. `CDec` is the one case +> that resists the rule: at one argument it is still a syntax error rather than a policy refusal, which sets +> it apart from every other rejected conversion. +> +> **`InStr` takes three or four arguments here, never two** — its behaviour otherwise is the ordinary one in +> [functions.md](../functions.md). The other three-argument shape, `InStr([A],"a",1)`, is accepted at design +> time and then caches a value ACE cannot read, because `start` receives a non-numeric — the same trap as the +> `$` variants and an index on a calculated column. + +But the rule is **not universal**, whatever the article says. `Weekday([D1])`, `MonthName(1)`, +`WeekdayName(1)` and `Round([Price])` are all accepted with their optionals omitted. So it is per-function, +and the only safe course is to record the required arity of each whitelisted function by measurement. + +Measured for the financial ten as well, each in its shortest legal VBA form and again with every argument +supplied — `Pmt` `FV` `PV` `NPer` `Rate` `IPmt` `PPmt` `DDB` all accept the short form, and `SLN`/`SYD` have +no optionals to omit; all 18 shapes were accepted +(`Records_which_financial_functions_accept_an_omitted_optional`). So on everything measured so far **`Mid` +and `InStr` are the only two functions that demand every argument** — they are the exception to the +article's rule, not an illustration of it. + +Supplying every optional does **not** rescue anything on the policy list: `Replace`, `StrComp`, `InStrRev`, +`StrConv`, `Format`, `FormatCurrency`, `FormatNumber`, `FormatPercent`, `FormatDateTime`, `DatePart`, +`DateDiff`, `DLookup`, `DCount`, `Rnd` and `Nz` were all re-tested in full form and are still refused. The +two rules are independent. + +The article also notes that a calculated field **cannot call a user-defined function**, only built-ins — +consistent with everything measured, and with the whitelist being fixed rather than extensible. + +Refused by policy: `\` `Mod` `Xor`; every conversion except `CDbl` (`CBool` `CByte` `CInt` `CLng` `CSng` +`CCur` `CStr` `CDate` `CVar`); `Rnd` `Timer`; `LTrim` `RTrim` `InStrRev` `Replace` `StrReverse` `StrComp` +`StrConv` `Val` `Chr` `Hex` `Oct`; `Format` `FormatCurrency` `FormatNumber` `FormatPercent` +`FormatDateTime` `Partition`; `Now` `Date` `Time` `DateAdd` `DateDiff` `DatePart` `DateValue` `TimeValue`; +`Switch`; `IsNumeric` `IsDate` `IsError` `TypeName` `VarType`; `RGB` `QBColor`; every byte/wide variant +(`AscB` `LenB` `LeftB` `RightB` `MidB` `InStrB` `ChrB` `AscW` `ChrW`); `Nz` `Environ` `CurDir` +`CurrentUser` `DLookup` `DCount`; and every aggregate (`Sum` `Count` `Avg` `Min` `Max` `First` `StDev` +`Var`). + +**Why `CDbl` and nothing else?** The first sweep gave each conversion a declared type that did *not* match +its result, and only `CDbl` happened to match — so the obvious suspicion was that the rule was about +agreement, not about `CDbl`. Re-running each conversion against its **matching** declared type kills that: +`CBool→dbBoolean`, `CByte→dbByte`, `CInt→dbInteger`, `CLng→dbLong`, `CCur→dbCurrency`, `CSng→dbSingle`, +`CDate→dbDate`, `CStr→dbText` are all still refused, and `CDbl` is accepted against `dbDouble`, `dbLong`, +`dbCurrency` and `dbSingle` alike. It really is `CDbl` and only `CDbl`, regardless of the declared type. + +The reading most consistent with the evidence — offered as a hypothesis, not a measured fact — is that the +evaluator's native numeric type **is** Double (OA's `R8`), so `CDbl` is an identity assertion rather than a +conversion: it asks the engine for the type it already computes in. Every other `C*` asks it to *produce* a +different runtime type, and the declared type already does that job through `ResultType`, so they are both +redundant and unsupported. The descriptor evidence fits: `CDbl` against any declared type yields descriptor +`Double`, i.e. the expression's own type. It does not explain everything — `Val` also returns Double and is +refused — so the curation is still partly historical. + +"Deterministic, row-local, no I/O" explains the big exclusions — `Rnd`/`Timer`/`Now`/`Date`/`Time` are +volatile, `DLookup`/`DCount`/aggregates and other-table references leave the row, `Environ`/`CurDir`/ +`CurrentUser` are environment. It does **not** explain the edges, which have to be taken as measured: +`Trim` is in but `LTrim`/`RTrim` are out; `Right` is in but `InStr` is out; `Asc` is in but `Chr` is out; +`Str` is in but `Val` is out; `CDbl` is in but every other conversion is out; `MonthName`/`WeekdayName` +are in but `Format` is out; `Like` and `In` are in but `Between` is out; and all ten financial functions +are in. + +## How it is implemented + +**Two evaluators, deliberately.** `LibRed.Engine` has an expression evaluator already, but the dependency +runs `Engine → Core` and this evaluation happens in **Core**, at row-encode time. A dedicated Core evaluator +was chosen over inverting with an interface Engine supplies, because inversion buys nothing here: the layer +that needs the answer is the one that cannot reach the implementation, so a Core-only caller +(`JetDatabase.Insert` is public API) would still have to refuse. The subset is small, frozen by ACE, and +semantically its own language — the Access *expression service*, not Access SQL — and it must match ACE +exactly, including null propagation, Currency scaling and the compressed-vs-raw text choice, so it wants its +own focused tests wherever the code lives. The financial functions and the two name functions are **ported** +from `ExpressionEvaluator` rather than re-derived, so one formula cannot answer differently through SQL than +through a calculated column. Moving the shared primitives down into Core remains the answer if the +duplication starts to bite. + +**Authoring.** `ColumnSpec.Calculated` builds one: promoted storage type in the descriptor, `0xC0`, variable +slot, the constant declared length. `CREATE TABLE` and `ADD COLUMN` write the +`Expression`/`ResultType`/`FCMin*Ver` properties. A Memo result gets its long-value maps, keyed off the +**result** type because the declared type is `Text` and says nothing — which also needed the write-side guard +in `TdefBuilder` relaxed, since it demanded a map's owner be Memo/OLE, the same assumption the reader had +already had to drop. The ACE-14 gate goes through `EnsureFormatAtLeast`, raising the file rather than +refusing, as `BIGINT`/`DATETIME2` already do. + +**Validation runs before anything is written** (`CalculatedExpression.ParseValidated`): the whitelist below, +plus self-reference, an unknown column, and the `$` name variants. It is mandatory rather than a courtesy — +an expression ACE rejects does not produce a merely odd file, it produces a column ACE refuses to read at +all. Measured end to end: ACE accepts, evaluates and *recomputes* a column LibRed authored, for every result +type including a spilled Memo (`Creates_a_calculated_column_ace_accepts`). + +**`ALTER` is measured, not assumed.** `ADD COLUMN`, `DROP COLUMN`, `ALTER COLUMN` (retype) and +`RenameColumn` all leave a calculated column working — the last only since the reference-repointing fix. +Dropping a column an expression reads is **refused**, which ACE does not do; see the probe below. + +**Text compression follows the declared type**, and the encoding rule is in +[page-02b-columns §3.4a](page-02b-columns.md) with the rest of the layout. It is called out here because it +is not cosmetic: compressing shrank a 36-character Memo result from 95 bytes to 61, back under the inline +limit, so the value never reached a long-value page at all. + +## What the probes settled + +**The cache is authoritative, and recomputation is narrow.** Poking a wrong value straight into the stored +envelope and asking ACE for it returns *the wrong value* — ACE does not re-evaluate on read. Updating a +column the expression does **not** reference leaves the poked value in place. Updating one it **does** +reference recomputes, even when the written value is unchanged: + +| step | ACE returns | +| --- | --- | +| after `INSERT` with `Qty=7`, `C = [Qty]*2` | `14` | +| after poking `999` into the envelope | `999` | +| after `UPDATE T SET A='changed'` (not referenced) | `999` | +| after `UPDATE T SET Qty=7` (referenced, same value) | `14` | +| after `UPDATE T SET Qty=10` | `20` | + +So Phase 3 must recompute **exactly when a referenced column is in the changed set** — `RowInserter.Update` +already receives that set. Recomputing unconditionally would write bytes ACE would not have written, and +recomputing never would leave a stale cache that ACE would have refreshed. It also means a stale cache is a +legitimate on-disk state, so LibRed reading it back verbatim is right. + +**A calculated column cannot be written directly, and the refusal is uniform.** ACE rejects an `INSERT` that +names one and an `UPDATE` that sets one with the same message — *"Cannot update 'C'; field not updateable."* +— so a value for it is an error rather than something to override or ignore. LibRed refuses both +(`RejectExplicitCalculatedValues`). The two paths must test different things: on `INSERT` a value in the +slot is the signal, because nothing else puts one there, while on `UPDATE` it has to be membership of the +changed set, since callers hand back the whole row they just read and the slot legitimately still holds the +cached value. + +**ACE has no route to change an existing calculated column's expression.** DAO refuses to mutate any field +of a *saved* `TableDef` — *"Operation is not supported for this type of object."* — and that refusal is +generic, reproduced on an ordinary column as a control, so it says nothing about calculated columns +specifically. Access's own designer must reach it by a path DAO does not expose. There is therefore no +oracle for "alter the expression", and anything LibRed offers there is its own extension rather than +ACE-matching behaviour. + +**ACE does not protect a reference; every ALTER is accepted, two of them destructively.** Measured through +ACE SQL, each on its own table: + +| operation | ACE | the calculated column afterwards | +| --- | --- | --- | +| `ADD COLUMN Extra LONG` | accepted | evaluates | +| `ALTER COLUMN Qty DOUBLE` (a column it reads) | accepted | evaluates | +| `DROP COLUMN Qty` (a column it reads) | accepted | **unreadable** | +| `DROP COLUMN ` | accepted | gone | +| `ALTER COLUMN A TEXT(60)` (unrelated) | accepted | evaluates | + +So dropping a column an expression reads is not refused — it simply leaves a calculated column ACE can no +longer evaluate. **LibRed deliberately does not match this**, and refuses the drop: + +> Column 'Qty' cannot be dropped because 'C' is a calculated column that reads it. Drop it first. + +ACE's permissiveness here is a one-way door. The drop is accepted, the calculated column becomes +unevaluatable, and there is no repair short of recreating it — because, per the finding above, ACE has no +route to edit an expression at all. Refusing keeps the file readable and costs a caller who genuinely wants +the column gone one extra statement. An expression that fails to parse counts as reading nothing rather than +throwing: a safeguard must not become a blanket refusal to drop anything because some unrelated column's +expression is malformed. + +**Renaming a referenced column must repoint the expression, and LibRed did not.** `RenameColumn` renamed the +column and left the expression naming the old one, so ACE failed every read of the calculated column — a +table broken by an operation that named a *different* column, and invisible from LibRed's own side, which +went on reading the stale cache happily. Now fixed +(`CalculatedExpression.RenameColumnReference`, `Libred_alter_keeps_a_calculated_column_working`). The rewrite +is textual so the author's spacing and bracketing survive, which means it has to know where a name is *not* +a reference: inside a string or `#date#` literal, before a `(` as a function name, or as a prefix of a +longer name. + +**A TDEF rebuild keeps the column calculated.** `ADD COLUMN` and `DROP COLUMN` both rebuild the definition, +and the expression lives in the table's property blob rather than the 25-byte descriptor, so there was a +real risk of carrying the `0xC0` flag across while losing the expression — a column ACE could no longer +evaluate. Measured: both preserve `IsCalculated`, the expression and the result type, and ACE still +evaluates the column afterwards (`Rebuilding_a_tdef_preserves_a_calculated_column`). + +**Indexing one is refused, and that matches Access rather than diverging from it.** Access's *designer* does +not offer a calculated column in the Indexes dialog at all, and will not let it be the primary key — the one +field in the table for which that option is absent. The *storage engine* agrees, refusing every insert into a +table where one is indexed. Only **ACE via SQL** accepts it, which is why the trap is reachable at all: you +cannot construct this state by clicking, only by writing SQL — exactly where LibRed lives. LibRed refuses on +every route: `CREATE INDEX`, `CREATE UNIQUE INDEX`, a composite that merely includes one, a table-level +`CONSTRAINT … PRIMARY KEY`/`UNIQUE`, and the inline `col type PRIMARY KEY` form. + +**Indexing a calculated column is a trap, not a feature.** ACE accepts `CREATE INDEX` and even +`CREATE UNIQUE INDEX` on one — and then refuses every `INSERT` into the table with *"Operation is not +supported for this type of object."* Measured for Int16 and Int32 result types, and with the index created +both before and after rows exist. So the index-key-type question is moot: such an index can never be +populated. LibRed should refuse to create one rather than reproduce a state that bricks the table. + +**Declared length is a constant, and the requested size is discarded.** `39` for every value type, `509` for +Text whatever size was asked for (10, 60 and 255 all give 509), `0` plus a long-value map for Memo. `39` is +not a payload ceiling tied to any type — a calculated GUID lands on Text/39 as well. Because the requested +size is not kept, **ACE does not truncate**: a `Text(5)` calculated column holding a much longer result +stores and returns it in full, and LibRed already agrees byte for byte. + +**A zero-length payload means Null — except for text, where it means the empty string.** The two are the +same bytes on disk, because an empty string also encodes to nothing, and ACE resolves the ambiguity by +type: `Left([A],2)` over a Null `[A]` stores an empty payload and reads back `""`, while the same empty +payload under a `DateTime` result type reads back Null. Reading it as Null in both cases is a silent +disagreement about a value nothing ever recomputes. + +**The envelope does not consume fixed-region budget.** 250 `Double` columns — 2000 bytes, the documented +record cap — are accepted both with and without a calculated column on top. The true ceiling was not +bracketed, so this rules out a *fixed-region* cost rather than establishing the exact limit. + +**The function whitelist is larger than the first sample and arbitrary at the edges.** 81 candidates probed, +43 accepted. Beyond the first sweep, also accepted: `Right`, `LCase`, `Space`, `String`, `Asc`, `Sqr`, +`Exp`, `Log`, `Sin`, `Cos`, `Tan`, `Atn`, `Fix`, `Month`, `Day`, `Hour`, `Minute`, `Second`, `Weekday`, +`DateSerial`, `TimeSerial`, `CDbl`, `Is Null`, `Like`, `In`. Also rejected: `LTrim`, `RTrim`, `StrReverse`, +`InStr`, `InStrRev`, `StrComp`, `Chr`, `Rnd`, `DateValue`, `CDate`, `CInt`, `CCur`, `CBool`, `CVar`, +`IsNumeric`, `IsDate`, `IsError`, `Between`, `Partition`, `Environ`, `CurrentUser`. + +The edges do not follow from the "deterministic, row-local" rule and must be enumerated rather than +reasoned about: **`Trim` is accepted but `LTrim` and `RTrim` are not**; `Right` is accepted but `InStr` is +not; `Asc` is accepted but `Chr` is not; `CDbl` is accepted but every other `C*` conversion is not; `Like` +and `In` are accepted but `Between` is not. `Rnd()` being rejected does fit the rule, as do `Date()` and +`Now()`. + +**The engine evaluates the stored text, and enforces the whitelist itself.** Authoring a column with an +allowed expression and then patching the stored `Expression` property on the page to another string of the +same length — bypassing DAO entirely — shows both halves: + +| patched to | LibRed reads Expression | ACE reads cached row | ACE inserts a row | ACE recomputes | +| --- | --- | --- | --- | --- | +| `[Qty]*3` (allowed) | `[Qty]*3` | `14`, the stale cache | `21` = 7×3 | `30` = 10×3 | +| `CInt(9)` (refused) | `CInt(9)` | **error** | row inserted, value **empty** | **error** | +| `Now()+0` (refused) | `Now()+0` | **error** | row inserted, value **empty** | **error** | + +The control proves the engine really reads and evaluates the property text — not a compiled form cached +elsewhere — so the expression string is the source of truth for writes and the envelope is the source of +truth for reads. The other two prove the whitelist is **not** a DAO-side courtesy: ACE raises +*"This calculated column contains an invalid expression."* on every read of that column, and inserts leave +the value empty. + +Two consequences. **Validation is mandatory, not optional** — an unvalidated expression does not produce a +merely odd file, it produces a column ACE cannot read at all. And **LibRed is currently more permissive +than ACE**: it read the stale `14` and a `null` from files ACE refuses outright, because it never looks at +the expression. That is arguably right for a reader, but it is a divergence and should be a decision rather +than an accident. + +## Still open + +1. ~~**Where `39` and `509` come from**~~ — **as far as measurement can take it** + (`Records_the_declared_length_of_every_calculated_type`). There are **four** constants, not two: `0` for + Memo, `509` for Text at any requested size, **`510` for Binary** — which nothing had ever created, so the + earlier sampling missed it — and `39` for everything else, GUID included. Nothing moves them: not the + requested size, not the length of the expression. *Why* those particular numbers is not something ACE can + be asked; what matters for writing them is that they are fixed, and now they are known to be. +2. **Should LibRed refuse to read what ACE refuses?** Two cases, and they have now been decided differently. + A **cached error** throws, matching ACE, which will not hand back such a row at all — settled, and the + precedent for the rest. An **unwhitelisted expression** is still read: the cached value is perfectly + well-formed, and nothing has been measured that says ACE's refusal there protects anything on disk. + + The tension between the two — strictness for correctness against leniency for recovery — is better + resolved by a **lenient "recovery" mode** than by softening the default. Reading a damaged or + engine-rejected file is a real use, but it is a *different* use from being a faithful engine, and letting + it dictate the default is what produces a reader that quietly invents values. A recovery mode would be + engine-wide rather than a calculated-column feature: surface the error rather than throwing on it, keep + enumerating past rows that cannot be decoded, and report what was skipped. Noted as a future direction, + not scheduled. +3. ~~**`InStr` and `CDec` fail as a *syntax* error**~~ — **answered**, and the guess behind it was wrong: a + syntax error means the wrong arity, not an unknown name. See the note above; the finding also fixed + `InStr`, which LibRed had been refusing at three arguments. +4. ~~**The full ACE value-matrix parity test**~~ — **done** + (`Computes_the_same_values_as_ace_across_the_matrix`). Fifteen expressions over five rows — nulls, the + empty string, zeros, negatives, a tiny Currency, a non-ASCII character and two pre-epoch times — agree + with ACE in 74 of 75 cases. + + The one exception is a **LibRed divergence**, and it is still open. **The VBA conversion functions do not + propagate Null, they raise on it**, so `CDbl(Null)` is an error rather than a Null result. LibRed applies + one blanket rule — any Null argument yields Null — which is right for every other whitelisted function and + wrong for `CDbl`, the only conversion on the list. + + The bytes settle what "an error" means on disk, and it is **not** the same as Null: the envelope's leading + field holds the **VBA error number** (94 "Invalid use of Null", 13 "Type mismatch"), and an error envelope + is 38 bytes against 23 for a Null — see [page-02b §3.4a](page-02b-columns.md). + + **Reading** is settled: a non-zero status throws rather than decoding as Null, naming the VBA error and + the expression that raised it. Zero is that field's success code, so a value and a propagated Null both + read exactly as before. + + **Writing** is settled too, and diverges deliberately: **LibRed refuses the row.** ACE accepts the insert + and caches the failure, after which its own reader rejects that row — and the state is **sticky**. + Measured: a compact-and-repair does *not* clear it (still error 94 afterwards, both rows intact); the only + thing that does is an `UPDATE` writing a column the expression reads, forcing a recompute — which needs a + value for the very column that was Null. So writing it produces a row that neither engine can read and + that the obvious repair does not fix. Refusing costs the caller a guard and keeps the file readable, the + same trade as refusing to drop a column an expression reads. +5. **Changing an existing column's expression or result type — out of scope by decision, not unfinished.** + ACE offers no route to it at all, so LibRed would be *defining* the behaviour rather than matching any, + including having to recompute every existing row at once (nothing re-derives a cached value on read). + **Drop the calculated column and add it again** instead: both halves are supported, neither touches the + data columns, and the result is indistinguishable from one ACE authored. Refusing to drop a column an + expression reads is what keeps that the only way the two can get out of step. +6. **No SQL syntax to declare one.** Access SQL has none, so this needs LibRed's extended mode (something + like `ADD COLUMN c AS ()`), and then a decision about whether EF's `HasComputedColumnSql` maps + onto it. diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Migrations/MigrationsLibRedTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Migrations/MigrationsLibRedTest.cs index a0396c23..5760d34d 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Migrations/MigrationsLibRedTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Migrations/MigrationsLibRedTest.cs @@ -136,18 +136,18 @@ public override async Task Create_table_with_multiline_comments() public override async Task Create_table_with_computed_column(bool? stored) { - await base.Create_table_with_computed_column(stored); + Assert.SkipWhen(stored == false, "Jet/ACE has no virtual computed column; the value is always stored."); - var storedSql = stored == true ? " PERSISTED" : ""; + await base.Create_table_with_computed_column(stored); AssertSql( - $""" -CREATE TABLE [People] ( - [Id] int NOT NULL IDENTITY, - [Sum] AS [X] + [Y]{storedSql}, - [X] int NOT NULL, - [Y] int NOT NULL, - CONSTRAINT [PK_People] PRIMARY KEY ([Id]) + """ +CREATE TABLE `People` ( + `Id` counter NOT NULL, + `Sum` varchar(255) AS (`X` + `Y`), + `X` integer NOT NULL, + `Y` integer NOT NULL, + CONSTRAINT `PK_People` PRIMARY KEY (`Id`) ); """); } @@ -563,8 +563,8 @@ public override async Task Add_column_with_computedSql(bool? stored) var computedColumnTypeSql = stored == true ? " PERSISTED" : ""; AssertSql( - $""" -ALTER TABLE [People] ADD [Sum] AS [X] + [Y]{computedColumnTypeSql}; + """ +ALTER TABLE `People` ADD `Sum` varchar(255) AS (`X` + `Y`); """); } @@ -580,13 +580,13 @@ await Test( var table = Assert.Single(model.Tables); Assert.Equal(2, table.Columns.Count); var column = Assert.Single(table.Columns, c => c.Name == "IdPlusOne"); - Assert.Equal("([Id]+(1))", column.ComputedColumnSql); + Assert.Equal("[Id] + 1", column.ComputedColumnSql); }, migrationsSqlGenerationOptions: MigrationsSqlGenerationOptions.Idempotent); AssertSql( """ -EXEC(N'ALTER TABLE [People] ADD [IdPlusOne] AS [Id] + 1'); +ALTER TABLE `People` ADD `IdPlusOne` integer AS ([Id] + 1); """); } @@ -861,15 +861,10 @@ public override async Task Alter_column_make_computed(bool? stored) var computedColumnTypeSql = stored == true ? " PERSISTED" : ""; AssertSql( - $""" -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] + [Y]{computedColumnTypeSql}; + """ +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer AS (`X` + `Y`); """); } @@ -879,14 +874,9 @@ public override async Task Alter_column_change_computed() AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] - [Y]; +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer AS (`X` - `Y`); """); } @@ -896,19 +886,14 @@ public override async Task Alter_column_change_computed_recreates_indexes() AssertSql( """ -DROP INDEX [IX_People_Sum] ON [People]; -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] - [Y]; +DROP INDEX `IX_People_Sum` ON `People`; +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer AS (`X` - `Y`); """, // """ -CREATE INDEX [IX_People_Sum] ON [People] ([Sum]); +CREATE INDEX `IX_People_Sum` ON `People` (`Sum`); """); } @@ -917,16 +902,7 @@ public override async Task Alter_column_change_computed_type() await base.Alter_column_change_computed_type(); AssertSql( - """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] + [Y] PERSISTED; -"""); +); } public override async Task Alter_column_make_non_computed() @@ -935,14 +911,9 @@ public override async Task Alter_column_make_non_computed() AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] int NOT NULL; +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer NOT NULL; """); } @@ -1217,23 +1188,13 @@ public override async Task Drop_column_computed_and_non_computed_with_dependency AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Y'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Y]; +ALTER TABLE `People` ALTER COLUMN `Y` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Y`; """, // """ -DECLARE @var1 sysname; -SELECT @var1 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'X'); -IF @var1 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var1 + '];'); -ALTER TABLE [People] DROP COLUMN [X]; +ALTER TABLE `People` ALTER COLUMN `X` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `X`; """); } diff --git a/test/EFCore.LibRed.Extended.FunctionalTests/Scaffolding/LibRedDatabaseModelFactoryTest.cs b/test/EFCore.LibRed.Extended.FunctionalTests/Scaffolding/LibRedDatabaseModelFactoryTest.cs index 30a653da..cd80d1ed 100644 --- a/test/EFCore.LibRed.Extended.FunctionalTests/Scaffolding/LibRedDatabaseModelFactoryTest.cs +++ b/test/EFCore.LibRed.Extended.FunctionalTests/Scaffolding/LibRedDatabaseModelFactoryTest.cs @@ -1235,15 +1235,15 @@ C datetime2 DEFAULT ((CONVERT([datetime2],('12-01-16 12:32')))) var columns = dbModel.Tables.Single().Columns; var column = columns.Single(c => c.Name == "A"); - Assert.Equal("(CONVERT([datetime2],getdate()))", column.DefaultValueSql); + Assert.Equal("(CONVERT([datetime2],(getdate())))", column.DefaultValueSql); Assert.Null(column.FindAnnotation(RelationalAnnotationNames.DefaultValue)); column = columns.Single(c => c.Name == "B"); - Assert.Equal("(getdate())", column.DefaultValueSql); + Assert.Equal("getdate()", column.DefaultValueSql); Assert.Null(column.FindAnnotation(RelationalAnnotationNames.DefaultValue)); column = columns.Single(c => c.Name == "C"); - Assert.Equal("(CONVERT([datetime2],'12-01-16 12:32'))", column.DefaultValueSql); + Assert.Equal("((CONVERT([datetime2],('12-01-16 12:32'))))", column.DefaultValueSql); Assert.Null(column.FindAnnotation(RelationalAnnotationNames.DefaultValue)); }, "DROP TABLE MyTable;"); diff --git a/test/EFCore.LibRed.FunctionalTests/Migrations/MigrationsLibRedTest.cs b/test/EFCore.LibRed.FunctionalTests/Migrations/MigrationsLibRedTest.cs index 06368996..a8f2e0c5 100644 --- a/test/EFCore.LibRed.FunctionalTests/Migrations/MigrationsLibRedTest.cs +++ b/test/EFCore.LibRed.FunctionalTests/Migrations/MigrationsLibRedTest.cs @@ -141,13 +141,13 @@ public override async Task Create_table_with_computed_column(bool? stored) var storedSql = stored == true ? " PERSISTED" : ""; AssertSql( - $""" -CREATE TABLE [People] ( - [Id] int NOT NULL IDENTITY, - [Sum] AS [X] + [Y]{storedSql}, - [X] int NOT NULL, - [Y] int NOT NULL, - CONSTRAINT [PK_People] PRIMARY KEY ([Id]) + """ +CREATE TABLE `People` ( + `Id` counter NOT NULL, + `Sum` varchar(255) AS (`X` + `Y`), + `X` integer NOT NULL, + `Y` integer NOT NULL, + CONSTRAINT `PK_People` PRIMARY KEY (`Id`) ); """); } @@ -563,8 +563,8 @@ public override async Task Add_column_with_computedSql(bool? stored) var computedColumnTypeSql = stored == true ? " PERSISTED" : ""; AssertSql( - $""" -ALTER TABLE [People] ADD [Sum] AS [X] + [Y]{computedColumnTypeSql}; + """ +ALTER TABLE `People` ADD `Sum` varchar(255) AS (`X` + `Y`); """); } @@ -861,15 +861,10 @@ public override async Task Alter_column_make_computed(bool? stored) var computedColumnTypeSql = stored == true ? " PERSISTED" : ""; AssertSql( - $""" -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] + [Y]{computedColumnTypeSql}; + """ +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer AS (`X` + `Y`); """); } @@ -879,14 +874,9 @@ public override async Task Alter_column_change_computed() AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] - [Y]; +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer AS (`X` - `Y`); """); } @@ -917,16 +907,7 @@ public override async Task Alter_column_change_computed_type() await base.Alter_column_change_computed_type(); AssertSql( - """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] AS [X] + [Y] PERSISTED; -"""); +); } public override async Task Alter_column_make_non_computed() @@ -935,14 +916,9 @@ public override async Task Alter_column_make_non_computed() AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Sum'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Sum]; -ALTER TABLE [People] ADD [Sum] int NOT NULL; +ALTER TABLE `People` ALTER COLUMN `Sum` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Sum`; +ALTER TABLE `People` ADD `Sum` integer NOT NULL; """); } @@ -1217,23 +1193,13 @@ public override async Task Drop_column_computed_and_non_computed_with_dependency AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'Y'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] DROP COLUMN [Y]; +ALTER TABLE `People` ALTER COLUMN `Y` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `Y`; """, // """ -DECLARE @var1 sysname; -SELECT @var1 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'X'); -IF @var1 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var1 + '];'); -ALTER TABLE [People] DROP COLUMN [X]; +ALTER TABLE `People` ALTER COLUMN `X` DROP DEFAULT; +ALTER TABLE `People` DROP COLUMN `X`; """); } diff --git a/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs b/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs index 2e24c99f..ae9b8850 100644 --- a/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs +++ b/test/LibRed.Core.AccessTests/CalculatedColumnAccessTests.cs @@ -90,11 +90,68 @@ public void Decodes_the_same_calculated_values_as_ace() finally { TemporaryDatabase.Delete(path); } } - // Reading these tables is new, which makes writing one newly reachable — and a write would put a bare - // value where ACE expects an envelope, corrupting the column silently. Refusing is the honest outcome - // while only ACE can evaluate the expression. - [Fact] - public void Refuses_to_write_a_row_containing_a_calculated_column() + // Every case above has the declared type and the expression's type agreeing, which is the only shape DAO + // produces by default -- and while they agree, the payload's width is enough to recover its type. CDbl is + // the one conversion ACE allows in a calculated column, and it accepts it against ANY declared type, so it + // is the way to build a column where the descriptor (the promoted type of the expression) and the real + // result type disagree. That is where a width-derived guess reads the wrong type or throws, and only the + // ResultType property gets it right. + [Theory] + [InlineData(DbLong, "Int32")] // descriptor Double, ResultType Int32, 4-byte payload + [InlineData(DbCurrency, "Currency")] // descriptor Double, ResultType Currency, 8-byte payload + [InlineData(DbSingle, "Single")] // descriptor Double, ResultType Single, 4-byte payload + [InlineData(DbInteger, "Int16")] // descriptor Double, ResultType Int16, 2-byte payload + public void Decodes_a_calculated_column_whose_declared_and_expression_types_differ(int declaredType, string expected) + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calculated-mismatch-"); + try + { + CreateTable(engine!, path, "C", declaredType, 0, "CDbl([Qty])"); + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = "INSERT INTO T_C (Id, Qty, Price, A, D1) VALUES (1, 7, 1, 'a', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + using var db = JetDatabase.Open(path, readOnly: true); + Table table = db.OpenTable("T_C"); + ColumnDef column = table.Definition.FindColumn("C")!; + + output.WriteLine($"descriptor={column.Type} ResultType={column.CalculatedResultType} " + + $"expression=\"{column.CalculatedExpression}\""); + + // The descriptor really does disagree -- otherwise this theory proves nothing. + Assert.Equal(JetDataType.Double, column.Type); + Assert.Equal(expected, column.CalculatedResultType?.ToString()); + Assert.Equal("CDbl([Qty])", column.CalculatedExpression); + + object? value = table.Rows().Single()[column.Index]; + Assert.NotNull(value); + Assert.Equal(7m, Convert.ToDecimal(value)); + } + finally { TemporaryDatabase.Delete(path); } + } + + // The write side. A row LibRed inserts must be byte-identical to the one ACE writes for the same inputs: + // the stored value is a cache neither engine re-derives on read, so anything less than byte parity is a + // divergence nothing would report. + [Theory] + [InlineData("CLong")] + [InlineData("CInt")] + [InlineData("CByte")] + [InlineData("CDbl")] + [InlineData("CSng")] + [InlineData("CCur")] + [InlineData("CBool")] + [InlineData("CText")] + // A calculated Memo comparable byte for byte too, as long as its result still inlines: the slot then + // carries the payload rather than a page number, and nothing in it varies between the two writers. + [InlineData("CMemo")] + public void Writes_the_same_envelope_ace_writes(string name) { object? engine = CreateDbEngine(); Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); @@ -102,21 +159,510 @@ public void Refuses_to_write_a_row_containing_a_calculated_column() string path = TemporaryDatabase.CreatePath("calculated-write-"); try { - string[] created = CreateFixture(engine!, path); - Assert.Contains("CLong", created); + (int type, int size, string expression) = Calculated.Single(c => c.Name == name) is var spec + ? (spec.Type, spec.Size, spec.Expression) : default; + CreateTable(engine!, path, name, type, size, expression); + string table = "T_" + name; + + // Row 1 written by ACE, row 2 by LibRed, from identical inputs. + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + $"INSERT INTO {table} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + using (var db = JetDatabase.Open(path, readOnly: false)) + { + Table t = db.OpenTable(table); + var values = new object?[t.Definition.Columns.Count]; + values[t.Definition.FindColumn("Id")!.Index] = 2; + values[t.Definition.FindColumn("Qty")!.Index] = 7; + values[t.Definition.FindColumn("Price")!.Index] = 12.5m; + values[t.Definition.FindColumn("A")!.Index] = "hello"; + values[t.Definition.FindColumn("D1")!.Index] = new DateTime(2003, 9, 29); + t.Insert(values); + } + + (byte[] fromAce, byte[] fromLibRed) = StoredEnvelopes(path, table, name); + output.WriteLine($"ACE {Convert.ToHexString(fromAce)}"); + output.WriteLine($"LibRed {Convert.ToHexString(fromLibRed)}"); + Assert.Equal(fromAce, fromLibRed); + + // And ACE must read its own value back out of the row LibRed wrote. + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = $"SELECT [{name}] FROM [{table}] ORDER BY Id"; + using var reader = select.ExecuteReader(); + var read = new List(); + while (reader.Read()) read.Add(reader.IsDBNull(0) ? null : reader.GetValue(0)); + Assert.Equal(2, read.Count); + Assert.Equal(Describe(read[0]), Describe(read[1])); + } + finally { TemporaryDatabase.Delete(path); } + } + + // A calculated Memo result outgrows the row exactly as a plain memo does, and then has to reach an LVAL + // page. Unlike the value types above, the two slots CANNOT be compared byte for byte -- each descriptor + // names the page its own value landed on -- so what is asserted is the thing that actually matters: both + // sides really spilled rather than inlined, and ACE reads its own answer back out of the row LibRed + // wrote. A wrongly formed payload (or one compressed when ACE would not have) fails that last step. + [Fact] + public void Spills_an_oversized_calculated_memo_to_a_long_value_page() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + const string name = "CMemoLong"; + const string expected = "hello" + " long enough to outgrow the row"; + string path = TemporaryDatabase.CreatePath("calculated-spill-"); + try + { + CreateTable(engine!, path, name, DbMemo, 0, "[A] & \" long enough to outgrow the row\""); + string table = "T_" + name; + + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + $"INSERT INTO {table} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + using (var db = JetDatabase.Open(path, readOnly: false)) + { + Table t = db.OpenTable(table); + var values = new object?[t.Definition.Columns.Count]; + values[t.Definition.FindColumn("Id")!.Index] = 2; + values[t.Definition.FindColumn("Qty")!.Index] = 7; + values[t.Definition.FindColumn("Price")!.Index] = 12.5m; + values[t.Definition.FindColumn("A")!.Index] = "hello"; + values[t.Definition.FindColumn("D1")!.Index] = new DateTime(2003, 9, 29); + t.Insert(values); + } + + (byte[] fromAce, byte[] fromLibRed) = StoredEnvelopes(path, table, name); + output.WriteLine($"ACE {Convert.ToHexString(fromAce)}"); + output.WriteLine($"LibRed {Convert.ToHexString(fromLibRed)}"); + + // A bare 12-byte descriptor with a non-inline flag is the proof it spilled; an inline slot would + // carry its payload with it and the test would be passing on a value that never left the row. + Assert.Equal(LibRed.Formats.LongValueFormat.DescriptorSize, fromAce.Length); + Assert.Equal(LibRed.Formats.LongValueFormat.DescriptorSize, fromLibRed.Length); + Assert.NotEqual( + LibRed.Formats.LongValueFormat.FlagInline, + (byte)(fromLibRed[3] & LibRed.Formats.LongValueFormat.FlagMask)); + + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = $"SELECT [{name}] FROM [{table}] ORDER BY Id"; + using var reader = select.ExecuteReader(); + var read = new List(); + while (reader.Read()) read.Add(reader.IsDBNull(0) ? null : reader.GetValue(0)); + Assert.Equal(2, read.Count); + Assert.Equal(expected, read[0]); + Assert.Equal(read[0], read[1]); + } + finally { TemporaryDatabase.Delete(path); } + } + + // Which text payloads ACE compresses inside a calculated envelope. A calculated TEXT is compressed; a + // calculated MEMO never is. StoredType folds Memo onto Text, which hid the difference and had LibRed + // compressing both -- and that is not cosmetic, because compressing shrinks the envelope back under the + // 64-byte inline limit and so decides whether the value ever reaches a long-value page. + [Theory] + [InlineData("PText", DbText, 40, "[A] & \"-x\"", true)] + [InlineData("PMemoShort", DbMemo, 0, "[A] & \"-memo\"", false)] + public void Records_when_ace_compresses_a_calculated_text_payload( + string name, int type, int size, string expression, bool compressed) + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-compress-"); + try + { + CreateTable(engine!, path, name, type, size, expression); + string table = "T_" + name; + using (var connection = AceTestDatabase.Open(path)) + { + foreach (int id in (int[])[1, 2]) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + $"INSERT INTO {table} (Id, Qty, Price, A, D1) " + + $"VALUES ({id}, 7, 12.5, 'hello', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + } + + // Both shapes here store the payload in the row, so the compressed-text marker FFFE is visible in + // the slot itself. It cannot occur by accident: UTF-16LE of ASCII always has 00 in the high byte. + (byte[] first, _) = StoredEnvelopes(path, table, name); + string hex = Convert.ToHexString(first); + output.WriteLine($"{name,-11} {hex}"); + Assert.Equal(compressed, hex.Contains("FFFE", StringComparison.Ordinal)); + } + finally { TemporaryDatabase.Delete(path); } + } + + // A calculated column's expression lives in the table's property blob, NOT in its 25-byte descriptor, so + // a DDL operation that rebuilds the TDEF can carry the 0xC0 flag across and still lose the expression -- + // leaving a column ACE cannot evaluate. ADD COLUMN and DROP COLUMN both rebuild, so both are asked. + [Theory] + [InlineData("add")] + [InlineData("drop")] + public void Rebuilding_a_tdef_preserves_a_calculated_column(string operation) + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + const string name = "CLong"; + string path = TemporaryDatabase.CreatePath("calc-rebuild-"); + try + { + CreateTable(engine!, path, name, DbLong, 0, "[Qty]*2"); + string table = "T_" + name; + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + $"INSERT INTO {table} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + using (var db = JetDatabase.Open(path, readOnly: false)) + { + if (operation == "add") + db.AddColumn(table, new ColumnSpec("Extra", JetDataType.Int32, 4, IsFixedLength: true)); + else + db.DropColumn(table, "Price"); + } + + using (var db = JetDatabase.Open(path, readOnly: true)) + { + ColumnDef column = db.OpenTable(table).Definition.FindColumn(name)!; + output.WriteLine($"after {operation}: calculated={column.IsCalculated} " + + $"expression={column.CalculatedExpression ?? "(lost)"} " + + $"resultType={column.CalculatedResultType?.ToString() ?? "(lost)"}"); + Assert.True(column.IsCalculated); + Assert.Equal("[Qty]*2", column.CalculatedExpression); + Assert.Equal(JetDataType.Int32, column.CalculatedResultType); + } + + // The engine that has to live with the result gets the last word. + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = $"SELECT [{name}] FROM [{table}]"; + Assert.Equal(14, Convert.ToInt32(select.ExecuteScalar())); + } + finally { TemporaryDatabase.Delete(path); } + } + + // A calculated column is derived, so writing one directly is refused rather than obeyed or silently + // dropped. Measured: ACE rejects an INSERT that names one and an UPDATE that sets one alike, with + // "Cannot update 'x'; field not updateable." LibRed used to accept both and quietly compute the value + // instead -- which is the worse of the two failures, because the caller's value simply vanishes. + [Fact] + public void Refuses_an_explicit_value_for_a_calculated_column() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + const string name = "CLong"; + string path = TemporaryDatabase.CreatePath("calc-explicit-"); + try + { + CreateTable(engine!, path, name, DbLong, 0, "[Qty]*2"); + string table = "T_" + name; + + using (var connection = AceTestDatabase.Open(path)) + { + using (var seed = connection.CreateCommand()) + { + seed.CommandText = + $"INSERT INTO {table} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)"; + seed.ExecuteNonQuery(); + } + + string aceInsert = Attempt(connection, + $"INSERT INTO {table} (Id, Qty, [{name}]) VALUES (2, 3, 99)"); + string aceUpdate = Attempt(connection, + $"UPDATE {table} SET [{name}] = 99 WHERE Id = 1"); + output.WriteLine($" ACE INSERT: {aceInsert}"); + output.WriteLine($" ACE UPDATE: {aceUpdate}"); + Assert.Contains("not updateable", aceInsert, StringComparison.OrdinalIgnoreCase); + Assert.Contains("not updateable", aceUpdate, StringComparison.OrdinalIgnoreCase); + } + + using (var db = JetDatabase.Open(path, readOnly: false)) + { + Table t = db.OpenTable(table); + ColumnDef calculated = t.Definition.FindColumn(name)!; + + var values = new object?[t.Definition.Columns.Count]; + values[t.Definition.FindColumn("Id")!.Index] = 2; + values[t.Definition.FindColumn("Qty")!.Index] = 5; + values[calculated.Index] = 99; // explicit, and wrong: [Qty]*2 would be 10 + var onInsert = Assert.Throws(() => t.Insert(values)); + Assert.Contains("not updateable", onInsert.Message, StringComparison.OrdinalIgnoreCase); + + // On UPDATE the slot always holds the cached value -- callers hand back the row they read -- + // so it is naming the column as changed that is refused, not the value being there. + var (id, row) = t.Rows().WithIds().Single(); + row[calculated.Index] = 99; + var onUpdate = Assert.Throws( + () => t.Update(id, row, new HashSet { calculated.Index })); + Assert.Contains("not updateable", onUpdate.Message, StringComparison.OrdinalIgnoreCase); + } + + // Nothing got through either engine: the seeded row still holds ACE's own answer, alone. + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = $"SELECT Id, [{name}] FROM [{table}] ORDER BY Id"; + using var reader = select.ExecuteReader(); + var rows = new List<(int Id, int Value)>(); + while (reader.Read()) rows.Add((reader.GetInt32(0), Convert.ToInt32(reader.GetValue(1)))); + Assert.Equal([(1, 14)], rows); + } + finally { TemporaryDatabase.Delete(path); } + } + + private static string Attempt(System.Data.Common.DbConnection connection, string sql) + { + try + { + using var command = connection.CreateCommand(); + command.CommandText = sql; + command.ExecuteNonQuery(); + return "ACCEPTED"; + } + catch (Exception ex) { return $"refused -- {ex.Message.Trim()}"; } + } + + // The other direction: a calculated column LibRed AUTHORS, which ACE has to accept, evaluate, and + // recompute. Access SQL has no syntax for one, so DAO's object model was previously the only way to get + // one into a file at all -- meaning nothing here can be cross-checked short of asking ACE to read it. + [Theory] + [InlineData(JetDataType.Int32, "[Qty]*2", 14, 6)] + [InlineData(JetDataType.Int16, "[Qty]+1", 8, 4)] + [InlineData(JetDataType.Double, "[Qty]/4", 1.75, 0.75)] + // Each expression must give a DIFFERENT answer at Qty=7 and Qty=3, so the re-read below proves ACE + // recomputed rather than handing back the cache LibRed wrote. + [InlineData(JetDataType.Boolean, "[Qty]>5", true, false)] + [InlineData(JetDataType.Text, "\"n=\" & [Qty]", "n=7", "n=3")] + // A Memo result reaches its value through a long-value descriptor, so this one also exercises the map + // being created for a column whose DECLARED type is Text. + [InlineData(JetDataType.Memo, "\"n=\" & [Qty] & \" and a tail long enough to outgrow the row\"", + "n=7 and a tail long enough to outgrow the row", "n=3 and a tail long enough to outgrow the row")] + public void Creates_a_calculated_column_ace_accepts( + JetDataType resultType, string expression, object atSeven, object atThree) + { + string path = TemporaryDatabase.CreatePath("calc-create-"); + try + { + DatabaseCreator.CreateEmpty(path); + using (var db = JetDatabase.Open(path, readOnly: false)) + { + db.CreateTable("T", [ + new ColumnSpec("Id", JetDataType.Int32, 4, IsFixedLength: true), + new ColumnSpec("Qty", JetDataType.Int32, 4, IsFixedLength: true), + ColumnSpec.Calculated("C", resultType, expression), + ]); + + Table t = db.OpenTable("T"); + var values = new object?[t.Definition.Columns.Count]; + values[t.Definition.FindColumn("Id")!.Index] = 1; + values[t.Definition.FindColumn("Qty")!.Index] = 7; + t.Insert(values); + } + + // A calculated column forces the Access 2010 floor its own FCMinReadVer declares, so the file + // must have been raised from the 2007 version byte it was created with. + using (var db = JetDatabase.Open(path, readOnly: true)) + { + Assert.True(db.Format.Version >= LibRed.Formats.JetVersion.Version14_2010, + $"version {db.Format.Version}"); + ColumnDef c = db.OpenTable("T").Definition.FindColumn("C")!; + Assert.True(c.IsCalculated); + Assert.Equal(expression, c.CalculatedExpression); + Assert.Equal(resultType, c.CalculatedResultType); + } + + // Compared as text: ACE hands an Int16 result back as Int16 and a Boolean as Boolean, so the + // CLR type of the InlineData literal is not the thing under test -- the value is. + using var connection = AceTestDatabase.Open(path); + using (var select = connection.CreateCommand()) + { + select.CommandText = "SELECT C FROM T"; + object? read = select.ExecuteScalar(); + output.WriteLine($"{resultType,-8} {expression,-10} Qty=7 -> {read}"); + Assert.Equal(atSeven.ToString(), read?.ToString()); + } + // And ACE must RECOMPUTE it, not merely read back the cache LibRed wrote. + using (var update = connection.CreateCommand()) + { + update.CommandText = "UPDATE T SET Qty = 3"; + update.ExecuteNonQuery(); + } + using (var select = connection.CreateCommand()) + { + select.CommandText = "SELECT C FROM T"; + object? read = select.ExecuteScalar(); + output.WriteLine($"{resultType,-8} {expression,-10} Qty=3 -> {read}"); + Assert.Equal(atThree.ToString(), read?.ToString()); + } + } + finally { TemporaryDatabase.Delete(path); } + } + + // Validation is mandatory, not a courtesy: an expression ACE rejects produces a column it refuses to read + // at all, so LibRed must never author one. These are the four refusal shapes ACE has. + [Theory] + [InlineData("CInt([Qty])", "cannot be used")] // policy whitelist -- only CDbl converts + [InlineData("Now()+0", "cannot be used")] // volatile + [InlineData("Left$([A], 2)", "'$'")] // accepted by the designer, unpopulatable + [InlineData("[C]*2", "refers to itself")] + [InlineData("[Missing]*2", "refers to another table")] + public void Refuses_to_author_an_expression_ace_would_reject(string expression, string expected) + { + string path = TemporaryDatabase.CreatePath("calc-invalid-"); + try + { + DatabaseCreator.CreateEmpty(path); using var db = JetDatabase.Open(path, readOnly: false); - Table table = db.OpenTable("T_CLong"); - var values = new object?[table.Definition.Columns.Count]; - values[table.Definition.FindColumn("Id")!.Index] = 1; + var ex = Assert.Throws( + () => db.CreateTable("T", [ + new ColumnSpec("Qty", JetDataType.Int32, 4, IsFixedLength: true), + new ColumnSpec("A", JetDataType.Text, 40, IsFixedLength: false), + ColumnSpec.Calculated("C", JetDataType.Int32, expression), + ])); + output.WriteLine($"{expression,-16} -> {ex.Message}"); + Assert.Contains(expected, ex.Message, StringComparison.OrdinalIgnoreCase); + } + finally { TemporaryDatabase.Delete(path); } + } + + // ACE recomputes a calculated column only when the UPDATE writes a column its expression READS, and + // leaves the cached value alone otherwise. LibRed has to match both halves: recomputing always would + // write bytes ACE never would, and never recomputing would leave a value ACE would have refreshed. + [Fact] + public void Recomputes_only_when_a_referenced_column_changes() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); - var ex = Assert.Throws(() => table.Insert(values)); - output.WriteLine(ex.Message); - Assert.Contains("CLong", ex.Message); + string path = TemporaryDatabase.CreatePath("calculated-update-"); + try + { + CreateTable(engine!, path, "C", DbLong, 0, "[Qty]*2"); + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = "INSERT INTO T_C (Id, Qty, Price, A, D1) VALUES (1, 7, 1, 'a', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + using (var db = JetDatabase.Open(path, readOnly: false)) + { + Table t = db.OpenTable("T_C"); + ColumnDef a = t.Definition.FindColumn("A")!; + ColumnDef qty = t.Definition.FindColumn("Qty")!; + ColumnDef c = t.Definition.FindColumn("C")!; + + // 'A' is not referenced by [Qty]*2, so the cache must survive untouched. + var (id, values) = t.Rows().WithIds().Single(); + values[a.Index] = "changed"; + t.Update(id, values, new HashSet { a.Index }); + Assert.Equal(14, Convert.ToInt32(t.Rows().Single()[c.Index])); + + // 'Qty' is referenced, so this must recompute. + (id, values) = t.Rows().WithIds().Single(); + values[qty.Index] = 10; + t.Update(id, values, new HashSet { qty.Index }); + Assert.Equal(20, Convert.ToInt32(t.Rows().Single()[c.Index])); + } + + // ACE is the arbiter that the rows LibRed rewrote are still coherent. + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = "SELECT A, C FROM T_C WHERE Id = 1"; + using var reader = select.ExecuteReader(); + Assert.True(reader.Read()); + Assert.Equal("changed", reader.GetValue(0)); + Assert.Equal(20, Convert.ToInt32(reader.GetValue(1))); } finally { TemporaryDatabase.Delete(path); } } + // A zero-length payload is Null for a value type but the EMPTY STRING for a text one -- on disk the two + // are the same bytes, since an empty string also encodes to nothing, and ACE resolves the ambiguity + // towards "". Reading it back as null instead would be a silent disagreement about a value that is + // never recomputed. + [Theory] + [InlineData("Left([A],2)", DbText, "")] // text result over a Null input -> "" + [InlineData("[D1]+1", DbDate, null)] // date result over a Null input -> Null + public void Reads_an_empty_payload_the_way_ace_does(string expression, int declaredType, string? expected) + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calculated-empty-"); + try + { + CreateTable(engine!, path, "C", declaredType, declaredType == DbText ? 60 : 0, expression); + object? fromAce; + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = "INSERT INTO T_C (Id, Qty, Price, A, D1) VALUES (1, 7, 1, NULL, NULL)"; + insert.ExecuteNonQuery(); + + using var select = connection.CreateCommand(); + select.CommandText = "SELECT C FROM T_C WHERE Id = 1"; + object? read = select.ExecuteScalar(); + fromAce = read is DBNull ? null : read; + } + + using var db = JetDatabase.Open(path, readOnly: true); + Table t = db.OpenTable("T_C"); + object? fromLibRed = t.Rows().Single()[t.Definition.FindColumn("C")!.Index]; + + output.WriteLine($"ACE {Describe(fromAce)} LibRed {Describe(fromLibRed)}"); + Assert.Equal(expected, fromLibRed); + Assert.Equal(fromAce, fromLibRed); + } + finally { TemporaryDatabase.Delete(path); } + } + + /// The raw stored slot for the calculated column of rows 1 and 2 — ACE's, then LibRed's. + private static (byte[] Ace, byte[] LibRed) StoredEnvelopes(string path, string table, string column) + { + using var db = JetDatabase.Open(path, readOnly: true); + Table t = db.OpenTable(table); + int index = t.Definition.FindColumn(column)!.Index; + ColumnDef id = t.Definition.FindColumn("Id")!; + var decoder = new RowDecoder(t.Definition.Columns, t.Channel.Format); + + // Deliberately NOT t.Rows(): decoding a row whose calculated column holds a cached error throws by + // design, and the probes that need those bytes are exactly the ones that produce them. Only the raw + // slot and the Id are wanted here, and Id is a fixed Int32 immediately after the 2-byte column count. + var byId = new Dictionary(); + foreach (int pageNumber in t.UsageMap.DataPages()) + { + LibRed.Pages.DataPage page = db.ReadDataPage(pageNumber); + for (int row = 0; row < page.RowCount; row++) + { + if (page.Rows[row].IsDeleted) continue; + byte[] raw = page.GetRow(row).ToArray(); + byId[BitConverter.ToInt32(raw, 2 + id.FixedOffset)] = decoder.CalculatedRaw(raw)[index]; + } + } + return (byId[1], byId[2]); + } + // DELETE does not encode a row, so it is still allowed — but it frees the deleted row's long values, // and a calculated Memo reaches its pages through a descriptor while being declared Text. Keying that // off the declared type walked past it and orphaned the pages; ACE must still read the table after. @@ -171,20 +717,7 @@ private string[] CreateFixture(object engine, string path) { try { - object tdf = Invoke(database, "CreateTableDef", "T_" + name)!; - object fields = GetProperty(tdf, "Fields")!; - Invoke(fields, "Append", Invoke(tdf, "CreateField", "Id", DbLong)!); - Invoke(fields, "Append", Invoke(tdf, "CreateField", "Qty", DbLong)!); - Invoke(fields, "Append", Invoke(tdf, "CreateField", "Price", DbCurrency)!); - Invoke(fields, "Append", Invoke(tdf, "CreateField", "A", DbText, 20)!); - Invoke(fields, "Append", Invoke(tdf, "CreateField", "D1", DbDate)!); - - object field = size > 0 - ? Invoke(tdf, "CreateField", name, type, size)! - : Invoke(tdf, "CreateField", name, type)!; - SetProperty(field, "Expression", expression); - Invoke(fields, "Append", field); - Invoke(GetProperty(database, "TableDefs")!, "Append", tdf); + AppendCalculatedTable(database, name, type, size, expression); created.Add(name); } catch (TargetInvocationException ex) @@ -198,6 +731,107 @@ private string[] CreateFixture(object engine, string path) return [.. created]; } + /// Each financial function in its shortest legal VBA form and again with every argument + /// supplied. MSDN says a calculated field must supply every parameter even when VBA makes it optional, + /// but Round, Weekday, MonthName and WeekdayName are all measured accepted without theirs — so the rule + /// is per-function and these ten have to be asked rather than assumed. + private static readonly (string Name, string Expression)[] FinancialArity = + [ + ("PmtMin", "Pmt(0.005, 60, [Qty])"), + ("PmtFull", "Pmt(0.005, 60, [Qty], 0, 0)"), + ("FvMin", "FV(0.005, 60, [Qty])"), + ("FvFull", "FV(0.005, 60, [Qty], 0, 0)"), + ("PvMin", "PV(0.005, 60, [Qty])"), + ("PvFull", "PV(0.005, 60, [Qty], 0, 0)"), + ("NPerMin", "NPer(0.005, -100, [Qty])"), + ("NPerFull", "NPer(0.005, -100, [Qty], 0, 0)"), + ("RateMin", "Rate(60, -100, [Qty])"), + ("RateFull", "Rate(60, -100, [Qty], 0, 0, 0.1)"), + ("IPmtMin", "IPmt(0.005, 1, 60, [Qty])"), + ("IPmtFull", "IPmt(0.005, 1, 60, [Qty], 0, 0)"), + ("PPmtMin", "PPmt(0.005, 1, 60, [Qty])"), + ("PPmtFull", "PPmt(0.005, 1, 60, [Qty], 0, 0)"), + ("DdbMin", "DDB([Qty], 100, 5, 1)"), + ("DdbFull", "DDB([Qty], 100, 5, 1, 2)"), + ("Sln", "SLN([Qty], 100, 5)"), // no optional arguments at all + ("Syd", "SYD([Qty], 100, 5, 1)"), // likewise + ]; + + // Which optional arguments a calculated column lets you leave out decides what LibRed's evaluator must + // accept. Guessing it the permissive way would let LibRed author an expression ACE then refuses; guessing + // it strict would refuse one ACE allows. Only ACE can say, so ask it. + [Fact] + public void Records_which_financial_functions_accept_an_omitted_optional() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-arity-"); + try + { + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + + var accepted = new List(); + foreach ((string name, string expression) in FinancialArity) + { + try + { + AppendCalculatedTable(database, name, DbDouble, 0, expression); + accepted.Add(name); + output.WriteLine($" {name,-9} ACCEPTED {expression}"); + } + catch (TargetInvocationException ex) + { + output.WriteLine($" {name,-9} refused {expression}" + + $" -- {ex.InnerException?.Message.Trim()}"); + } + } + + Invoke(database, "Close"); + + // Measured: ACE accepts all ten in both forms. So Mid and InStr are the EXCEPTIONS to MSDN's + // "supply every parameter" rule rather than examples of it, and the evaluator is right to take + // these optionals as optional. The Full rows double as the control -- a refusal there would mean + // the probe was malformed rather than the arity rule being interesting. + Assert.Equal(FinancialArity.Select(f => f.Name).ToList(), accepted); + } + finally { TemporaryDatabase.Delete(path); } + } + + /// Creates a database holding a single table with one calculated column. + private static void CreateTable(object engine, string path, string name, int type, int size, string expression) + { + object workspace = Invoke(engine, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + AppendCalculatedTable(database, name, type, size, expression); + Invoke(database, "Close"); + } + + /// Appends table T_<name>: the base columns every expression reads from, plus the + /// one calculated column under test. + private static void AppendCalculatedTable(object database, string name, int type, int size, string expression) + { + object tdf = Invoke(database, "CreateTableDef", "T_" + name)!; + object fields = GetProperty(tdf, "Fields")!; + Invoke(fields, "Append", Invoke(tdf, "CreateField", "Id", DbLong)!); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "Qty", DbLong)!); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "Price", DbCurrency)!); + // DAO defaults AllowZeroLength to False, which makes ACE reject '' outright — and the empty string is + // exactly what separates "Null" from "empty" in a calculated result, so the fixture has to permit it. + object textField = Invoke(tdf, "CreateField", "A", DbText, 20)!; + SetProperty(textField, "AllowZeroLength", true); + Invoke(fields, "Append", textField); + Invoke(fields, "Append", Invoke(tdf, "CreateField", "D1", DbDate)!); + + object field = size > 0 + ? Invoke(tdf, "CreateField", name, type, size)! + : Invoke(tdf, "CreateField", name, type)!; + SetProperty(field, "Expression", expression); + Invoke(fields, "Append", field); + Invoke(GetProperty(database, "TableDefs")!, "Append", tdf); + } + /// Seeds the base columns through ACE — which computes and caches each result — then reads the /// calculated values back the same way, so the expectation is ACE's own answer. private static Dictionary> SeedAndReadWithAce(string path, string[] created) @@ -257,6 +891,694 @@ private static bool Matches(object? ace, object? libred) return null; } + // What ACE writes for a conversion over Null. CDbl does NOT propagate Null the way every other function + // here does -- the VBA conversions raise on it -- so ACE is caching an error state rather than a value, + // and its own reader then refuses the column. Worth having the bytes: they say whether an "error" is + // distinguishable on disk from a Null, which is the only way LibRed could reproduce it. + [Fact] + public void Records_what_ace_stores_for_a_conversion_over_null() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-cdblnull-"); + try + { + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + AppendCalculatedTable(database, "CvNull", DbDouble, 0, "CDbl([Qty])/3"); // raises on Null + AppendCalculatedTable(database, "PlainNull", DbDouble, 0, "[Qty]/3"); // propagates Null + AppendCalculatedTable(database, "CvText", DbDouble, 0, "CDbl([A])"); // raises on non-numeric + // Does the expression service SHORT-CIRCUIT IIf? VBA's does not -- it evaluates both branches, so + // this idiom would still raise -- but the expression service is not VBA, and if it does short + // circuit then this is the guard to point people at. + AppendCalculatedTable(database, "CvGuard", DbDouble, 0, "IIf(IsNull([Qty]), 0, CDbl([Qty]))"); + Invoke(database, "Close"); + + // Row 1 is the good case for each, row 2 the bad one: a Null argument for the first two, and a + // non-numeric string for the third, which is a DIFFERENT error from the same function. + using (var connection = AceTestDatabase.Open(path)) + foreach (string table in (string[])["T_CvNull", "T_PlainNull", "T_CvText", "T_CvGuard"]) + foreach ((int id, string qty, string a) in ((int, string, string)[]) + [(1, "7", "'12'"), (2, "NULL", "'hello'")]) + { + using var insert = connection.CreateCommand(); + insert.CommandText = $"INSERT INTO {table} (Id, Qty, Price, A, D1) VALUES " + + $"({id}, {qty}, 12.5, {a}, #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + foreach ((string table, string column) in ((string, string)[]) + [("T_CvNull", "CvNull"), ("T_PlainNull", "PlainNull"), ("T_CvText", "CvText")]) + { + (byte[] good, byte[] bad) = StoredEnvelopes(path, table, column); + output.WriteLine($" {column,-10} ok {Convert.ToHexString(good)}"); + output.WriteLine($" {column,-10} bad {Convert.ToHexString(bad)}"); + } + + // The status field carries the VBA error number, and 0 is its success code. 94 is "invalid use + // of Null" and 13 is "type mismatch" -- the two ways CDbl can fail -- while a function that + // PROPAGATES Null leaves the field zero and simply stores no payload. + Assert.Equal(94u, Status(path, "T_CvNull", "CvNull")); + Assert.Equal(13u, Status(path, "T_CvText", "CvText")); + Assert.Equal(0u, Status(path, "T_PlainNull", "PlainNull")); + + // And the expression service SHORT-CIRCUITS IIf: the CDbl arm is never reached over a Null, so + // this stores a clean 0 rather than error 94. (Access's VBA-side IIf does not short circuit, but + // VBA is not what computes a calculated column.) That makes the guard a real remedy, which is + // why LibRed's evaluator takes only the selected branch too. + Assert.Equal(0u, Status(path, "T_CvGuard", "CvGuard")); + Assert.Equal("0", AceScalar(path, "SELECT CvGuard FROM T_CvGuard WHERE Id = 2")); + + // And LibRed must not read an error back as Null: the payload is empty in both cases, so only + // the status tells them apart, and a wrong answer here is invisible. + using var db = JetDatabase.Open(path, readOnly: true); + var ex = Assert.Throws( + () => db.OpenTable("T_CvNull").Rows().ToList()); + output.WriteLine($" LibRed reads it as: {ex.Message}"); + Assert.Contains("invalid use of Null", ex.Message, StringComparison.OrdinalIgnoreCase); + + // The propagating one still reads as a plain Null, so the guard has not swallowed that case. + Table plain = db.OpenTable("T_PlainNull"); + int index = plain.Definition.FindColumn("PlainNull")!.Index; + Assert.Null(plain.Rows().Last()[index]); + } + finally { TemporaryDatabase.Delete(path); } + } + + /// The envelope's leading status for the second (bad-input) row of a probe table. + private static uint Status(string path, string table, string column) + { + (_, byte[] bad) = StoredEnvelopes(path, table, column); + return bad.Length >= 4 ? BitConverter.ToUInt32(bad, 0) : 0; + } + + // Does compact-and-repair clear a cached error? It is the reason LibRed refuses to WRITE one: if the + // only way out of the state is a compact, then writing it is close to unrecoverable for a caller who + // cannot run Access. Worth knowing whether that assumption holds. + [Fact] + public void Records_whether_compacting_clears_a_cached_error() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-compact-"); + string compacted = path.Replace(".accdb", "-c.accdb", StringComparison.OrdinalIgnoreCase); + try + { + CreateTable(engine!, path, "CvNull", DbDouble, 0, "CDbl([Qty])/3"); + using (var connection = AceTestDatabase.Open(path)) + foreach ((int id, string qty) in ((int, string)[])[(1, "7"), (2, "NULL")]) + { + using var insert = connection.CreateCommand(); + insert.CommandText = $"INSERT INTO T_CvNull (Id, Qty, Price, A, D1) VALUES " + + $"({id}, {qty}, 12.5, 'hello', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + output.WriteLine($" before: status {Status(path, "T_CvNull", "CvNull")}, " + + $"ACE reads {AceScalar(path, "SELECT CvNull FROM T_CvNull WHERE Id = 2")}"); + + string outcome; + try { Invoke(engine!, "CompactDatabase", path, compacted); outcome = "ACCEPTED"; } + catch (TargetInvocationException ex) + { outcome = $"refused -- {ex.InnerException?.Message.Trim()}"; } + output.WriteLine($" compact: {outcome}"); + + if (outcome != "ACCEPTED") return; + uint afterCompact = Status(compacted, "T_CvNull", "CvNull"); + output.WriteLine($" after : status {afterCompact}, " + + $"ACE reads {AceScalar(compacted, "SELECT CvNull FROM T_CvNull WHERE Id = 2")}"); + output.WriteLine($" rows : {AceScalar(compacted, "SELECT COUNT(*) FROM T_CvNull")}"); + + // Compacting does NOT clear it, and the row survives intact. What clears it is an UPDATE that + // writes a column the expression READS, forcing a recompute -- which works even though the row + // cannot be SELECTed, because the update never has to read the calculated column. + output.WriteLine($" update: {AceExec(compacted, "UPDATE T_CvNull SET Qty = 9 WHERE Id = 2")}"); + uint afterUpdate = Status(compacted, "T_CvNull", "CvNull"); + output.WriteLine($" fixed : status {afterUpdate}, " + + $"ACE reads {AceScalar(compacted, "SELECT CvNull FROM T_CvNull WHERE Id = 2")}"); + + // The reason the write-side refusal earns its divergence: the state is STICKY. A compact leaves + // it, and the only way out is supplying a value for the very column that was Null. + Assert.Equal(94u, Status(path, "T_CvNull", "CvNull")); + Assert.Equal(94u, afterCompact); + Assert.Equal(0u, afterUpdate); + } + finally { TemporaryDatabase.Delete(path); TemporaryDatabase.Delete(compacted); } + } + + // Where ACE's constant declared lengths come from, or at least whether they ever move. 39 for a value + // type, 509 for Text whatever size was asked for, 0 for a Memo result -- sampled before, swept here + // across every type DAO will create, three Text sizes, and an expression long enough to rule out any + // dependence on the expression itself. + [Fact] + public void Records_the_declared_length_of_every_calculated_type() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-lengths-"); + try + { + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + + const string longExpression = "[Qty]*2+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0"; + (string Name, int Type, int Size, string Expression)[] cases = + [ + ("LBool", DbBoolean, 0, "[Qty]>1"), ("LByte", DbByte, 0, "[Qty]+2"), + ("LInt", DbInteger, 0, "[Qty]+1"), ("LLong", DbLong, 0, "[Qty]*2"), + ("LCur", DbCurrency, 0, "[Price]*2"), ("LSng", DbSingle, 0, "[Qty]/8"), + ("LDbl", DbDouble, 0, "[Qty]/4"), ("LDate", DbDate, 0, "[D1]+1"), + ("LTxt1", DbText, 1, "[A] & \"x\""), ("LTxt60", DbText, 60, "[A] & \"x\""), + ("LTxt255", DbText, 255, "[A] & \"x\""), ("LMemo", DbMemo, 0, "[A] & \"m\""), + ("LGuid", 15, 0, "[A] & \"g\""), ("LBin", 9, 0, "[A] & \"b\""), + ("LLongExpr", DbLong, 0, longExpression), + ]; + var made = new List(); + foreach ((string name, int type, int size, string expression) in cases) + { + try { AppendCalculatedTable(database, name, type, size, expression); made.Add(name); } + catch (TargetInvocationException ex) + { output.WriteLine($" {name,-10} not created: {ex.InnerException?.Message.Trim()}"); } + } + Invoke(database, "Close"); + + using var db = JetDatabase.Open(path, readOnly: true); + var lengths = new List(); + foreach (string name in made) + { + ColumnDef c = db.OpenTable("T_" + name).Definition.FindColumn(name)!; + output.WriteLine($" {name,-10} descriptor {c.Type,-9} length {c.Length,-4} " + + $"result {c.CalculatedResultType?.ToString() ?? "-"}"); + lengths.Add(c.Length); + } + + // Nothing moves them: not the requested Text size, not the expression's length, not the type + // beyond the four-way split. Binary's 510 is the one the earlier sampling missed, because + // nothing had ever created a calculated Binary column. + Assert.All(lengths, l => Assert.Contains(l, (int[])[0, 39, 509, 510])); + Assert.Equal(509, db.OpenTable("T_LTxt255").Definition.FindColumn("LTxt255")!.Length); + Assert.Equal(510, db.OpenTable("T_LBin").Definition.FindColumn("LBin")!.Length); + Assert.Equal(39, db.OpenTable("T_LGuid").Definition.FindColumn("LGuid")!.Length); + } + finally { TemporaryDatabase.Delete(path); } + } + + // ---- value-matrix parity ------------------------------------------------------------------------ + // + // Byte-parity elsewhere covers one row of ordinary inputs, and the whitelist is enumerated function by + // function -- but every function is otherwise trusted on its VBA definition rather than measured against + // ACE per value. This pushes a matrix of the values that actually break things through BOTH engines and + // requires them to agree: nulls, the empty string, zero, negatives, a tiny Currency, a non-ASCII + // character, and the pre-epoch dates whose time fraction runs backwards. + // + // ACE writes rows 1-5 and LibRed writes 101-105 from identical inputs; ACE then reads all ten, so the + // comparison is between ACE's own answer and LibRed's, seen through one reader. + private static readonly (int Id, object? Qty, object? Price, string? A, DateTime? D1)[] Matrix = + [ + (1, 7, 12.5m, "hello", new DateTime(2003, 9, 29)), + (2, 0, 0m, "", new DateTime(1899, 12, 30)), // zeros, empty string, the epoch + (3, -5, -3.25m, " pad ", new DateTime(1899, 12, 29, 18, 0, 0)), // negatives, padding, pre-epoch PM + (4, null, null, null, null), // every input Null + (5, 3, 0.0001m, "ß", new DateTime(1899, 12, 29, 6, 0, 0)), // tiny Currency, non-ASCII, pre-epoch AM + ]; + + private static readonly (string Name, int Type, int Size, string Expression)[] MatrixColumns = + [ + ("PQtyX2", DbLong, 0, "[Qty]*2"), + ("PQtyDiv", DbDouble, 0, "[Qty]/4"), + ("PRound", DbCurrency, 0, "Round([Price]*3, 2)"), // the OA double->decimal rounding scar + ("PAmp", DbText, 40, "[A] & \"-x\""), // '&' swallows Null + ("PPlus", DbText, 40, "[A] + \"-x\""), // '+' propagates it + ("PTrim", DbText, 40, "Trim([A])"), + ("PLen", DbLong, 0, "Len([A])"), // 0 for empty, Null for Null + ("PDate", DbDate, 0, "[D1]+1"), + ("PYear", DbLong, 0, "Year([D1])"), + ("PIif", DbText, 40, "IIf([Qty]>0, \"pos\", \"non\")"), + ("PSgn", DbInteger, 0, "Sgn([Qty])"), + ("PAbs", DbCurrency, 0, "Abs([Price])"), + ("PCDbl", DbDouble, 0, "CDbl([Qty])/3"), + ("PStr", DbText, 40, "Str([Qty])"), + ("PLeft", DbText, 40, "Left([A],2)"), + ]; + + [Fact] + public void Computes_the_same_values_as_ace_across_the_matrix() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-matrix-"); + try + { + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + var created = new List<(string Name, string Expression)>(); + foreach ((string name, int type, int size, string expression) in MatrixColumns) + { + try { AppendCalculatedTable(database, name, type, size, expression); created.Add((name, expression)); } + catch (TargetInvocationException ex) + { + output.WriteLine($" {name,-8} not authored: {ex.InnerException?.Message.Trim()}"); + } + } + Invoke(database, "Close"); + Assert.NotEmpty(created); + + var mismatches = new List(); + var aceCannotReadItself = new List(); + foreach ((string name, string expression) in created) + { + string table = "T_" + name; + using (var connection = AceTestDatabase.Open(path)) + foreach (var row in Matrix) + { + using var insert = connection.CreateCommand(); + insert.CommandText = $"INSERT INTO {table} (Id, Qty, Price, A, D1) VALUES " + + $"({row.Id}, {Literal(row.Qty)}, {Literal(row.Price)}, {Literal(row.A)}, {Literal(row.D1)})"; + insert.ExecuteNonQuery(); + } + + var refused = new HashSet(); + using (var db = JetDatabase.Open(path, readOnly: false)) + { + Table t = db.OpenTable(table); + foreach (var row in Matrix) + { + var values = new object?[t.Definition.Columns.Count]; + values[t.Definition.FindColumn("Id")!.Index] = row.Id + 100; + values[t.Definition.FindColumn("Qty")!.Index] = row.Qty; + values[t.Definition.FindColumn("Price")!.Index] = row.Price; + values[t.Definition.FindColumn("A")!.Index] = row.A; + values[t.Definition.FindColumn("D1")!.Index] = row.D1; + // LibRed refuses a row whose calculated value would be a cached ERROR rather than a + // value -- see the CDbl-over-Null note below. ACE accepts such a row and writes the + // unreadable state, so a refusal here is the divergence, not a failure. + try { t.Insert(values); } + catch (LibRed.Storage.Calculated.CalculatedExpressionException) { refused.Add(row.Id); } + } + } + + // Read row by row and record a failure as a value: a row ACE cannot read is itself a result, + // and which SIDE it lands on is the whole point -- ACE's own row failing means the expression + // is at fault, only LibRed's failing means the bytes are. + Dictionary byId = []; + using (var connection = AceTestDatabase.Open(path)) + foreach (int id in Matrix.SelectMany(r => (int[])[r.Id, r.Id + 100])) + { + using var select = connection.CreateCommand(); + select.CommandText = $"SELECT [{name}] FROM [{table}] WHERE Id = {id}"; + try + { + using var reader = select.ExecuteReader(); + byId[id] = reader.Read() + ? reader.IsDBNull(0) ? "(null)" : Describe(reader.GetValue(0)) + : "(missing)"; + } + catch (Exception ex) { byId[id] = $"UNREADABLE: {ex.Message.Split('.')[0]}"; } + } + + foreach (var row in Matrix) + { + string ace = byId.GetValueOrDefault(row.Id, "(missing)"); + string libred = byId.GetValueOrDefault(row.Id + 100, "(missing)"); + output.WriteLine($" {name,-8} row {row.Id} ACE {ace,-28} LibRed {libred}"); + + if (ace.StartsWith("UNREADABLE", StringComparison.Ordinal)) + { + aceCannotReadItself.Add($"{name} row {row.Id}"); + // LibRed must not merely disagree here — it must have declined to write the row at + // all, which is the whole point of the divergence. + Assert.Contains(row.Id, refused); + continue; + } + Assert.DoesNotContain(row.Id, refused); // nothing else may be refused + if (ace != libred) mismatches.Add($"{name} [{expression}] row {row.Id}: ACE {ace}, LibRed {libred}"); + } + } + + Assert.Empty(mismatches); + + // A deliberate LibRed divergence, not an ACE defect. The VBA conversions do NOT propagate Null, + // they raise on it, so CDbl(Null) is an error rather than a Null result -- and CDbl is the only + // conversion a calculated column may contain. ACE accepts the row and caches the error, after + // which its own reader refuses that row and only a compact-and-repair clears it. LibRed refuses + // the INSERT instead, so the unreadable state never reaches the file. Pinned exactly, so a NEW + // unreadable case shows up rather than being absorbed into this one. + Assert.Equal(["PCDbl row 4"], aceCannotReadItself); + } + finally { TemporaryDatabase.Delete(path); } + } + + /// An Access SQL literal for a matrix value, so ACE is seeded with exactly what LibRed is. + private static string Literal(object? value) => value switch + { + null => "NULL", + string s => $"'{s.Replace("'", "''", StringComparison.Ordinal)}'", + DateTime d => $"#{d:yyyy-MM-dd HH:mm:ss}#", + decimal m => m.ToString(System.Globalization.CultureInfo.InvariantCulture), + _ => Convert.ToString(value, System.Globalization.CultureInfo.InvariantCulture)!, + }; + + // Why InStr and CDec fail as a SYNTAX error rather than the policy refusal every other rejected function + // gets. The standing guess was that the calculated-column parser does not know those names at all -- but + // InStr in its four-argument form IS accepted, so it must know that one. The discriminator is whether a + // KNOWN function called with the wrong arity produces the same message as an unknown name: if it does, + // "syntax error" says nothing about the name, and our grammar should not treat the two differently. + [Fact] + public void Records_how_ace_distinguishes_a_syntax_error_from_a_policy_refusal() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-syntax-"); + try + { + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + object database = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + + var accepted = new List(); + Dictionary outcomes = []; + foreach ((string name, string expression) in ((string, string)[]) + [ + ("i2", "InStr([A],\"a\")"), // known short: reported as a syntax error + ("i3", "InStr(1,[A],\"a\")"), + ("i3alt", "InStr([A],\"a\",1)"), + ("i4", "InStr(1,[A],\"a\",0)"), // known accepted + // With 'H' against "hello" the compare mode is visible: binary gives 0, text gives 1. + ("i3case", "InStr(1,[A],\"H\")"), + ("i4case0", "InStr(1,[A],\"H\",0)"), + ("i4case1", "InStr(1,[A],\"H\",1)"), + ("cdec", "CDec([Qty])"), + ("unknown", "NotAFunction([Qty])"), // a name nothing could know + ("policy", "CInt([Qty])"), // known, refused by policy + ("toomany", "Abs([Qty],2)"), // whitelisted name, wrong arity + ("toofew", "Abs()"), + ("control", "Abs([Qty])"), // whitelisted name, right arity + // Does the EXPRESSION service accept SQL's backtick identifier quoting? It is not the SQL + // parser, so it may only know [brackets] -- and that decides whether LibRed can store a + // backtick expression verbatim or must rewrite it. + ("backtick", "`Qty`*2"), + ]) + { + string outcome; + try { AppendCalculatedTable(database, name, DbLong, 0, expression); outcome = "ACCEPTED"; } + catch (TargetInvocationException ex) + { outcome = ex.InnerException?.Message.Trim() ?? ex.Message.Trim(); } + output.WriteLine($" {name,-8} {expression,-22} -> {outcome}"); + if (outcome == "ACCEPTED") accepted.Add(name); + outcomes[name] = outcome; + } + + Invoke(database, "Close"); + + // The discriminator. An UNKNOWN name gets the policy refusal, while a WHITELISTED name called + // with the wrong number of arguments gets "Syntax error in expression" -- so a syntax error says + // nothing about whether ACE knows the function, which is the reverse of the obvious reading. + Assert.Contains("cannot be used", outcomes["unknown"], StringComparison.Ordinal); + Assert.Contains("cannot be used", outcomes["policy"], StringComparison.Ordinal); + Assert.Contains("Syntax error", outcomes["toomany"], StringComparison.Ordinal); + Assert.Contains("Syntax error", outcomes["toofew"], StringComparison.Ordinal); + Assert.Contains("Syntax error", outcomes["i2"], StringComparison.Ordinal); // InStr with two + Assert.Contains("Syntax error", outcomes["cdec"], StringComparison.Ordinal); + Assert.Equal("ACCEPTED", outcomes["i3"]); // ...but three is fine + Assert.Equal("ACCEPTED", outcomes["i4"]); + + // Design-time acceptance has repeatedly not meant usable here -- the '$' variants and an index on + // a calculated column are both accepted and then reject every insert -- so ask what each accepted + // form actually DOES with a row before treating it as a shape LibRed must support. + Dictionary values = []; + foreach (string name in accepted) + { + string insert = AceExec(path, + $"INSERT INTO T_{name} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)"); + values[name] = insert == "ACCEPTED" ? AceScalar(path, $"SELECT [{name}] FROM T_{name}") : "-"; + output.WriteLine($" {name,-8} insert: {insert,-12} value: {values[name]}"); + } + + // Three-argument InStr is genuinely usable, not merely accepted, and its omitted compare defaults + // to case-INSENSITIVE -- 'H' finds "hello" at 1, while an explicit 0 does not find it at all. + Assert.Equal("0", values["i3"]); + Assert.Equal("1", values["i3case"]); + Assert.Equal("0", values["i4case0"]); + Assert.Equal("1", values["i4case1"]); + + // The other three-argument shape is the familiar trap: accepted at design time, and then its + // cached value cannot be read, because 'start' got a non-numeric. Same family as the '$' variants + // and an index on a calculated column. + Assert.StartsWith("error", values["i3alt"], StringComparison.Ordinal); + } + finally { TemporaryDatabase.Delete(path); } + } + + // Is backtick quoting rejected by the EXPRESSION SERVICE generally, or only in a calculated column? ACE's + // SQL parser accepts backticks everywhere -- EF Core's Jet provider quotes every identifier that way -- + // so if a CHECK constraint (also stored as expression text in LvProp, also evaluated by the service) + // rejects them too, the difference is the service's lexer rather than anything calculated-specific. + [Fact] + public void Records_whether_the_expression_service_knows_backtick_quoting() + { + string path = TemporaryDatabase.CreatePath("calc-tick-"); + try + { + DatabaseCreator.CreateEmpty(path); + using (var connection = AceTestDatabase.Open(path)) + { + Execute(connection, "CREATE TABLE T (Id LONG, Qty LONG)"); + Execute(connection, "INSERT INTO T (Id, Qty) VALUES (1, 5)"); + + // Query context: the SQL parser, which does know backticks. + using var select = connection.CreateCommand(); + select.CommandText = "SELECT `Qty` FROM `T` WHERE `Qty` > 1"; + output.WriteLine($" query : {select.ExecuteScalar()}"); + } + + // Expression-service context: a CHECK constraint over the same identifier. + output.WriteLine($" check `` : {AceExec(path, "ALTER TABLE T ADD CONSTRAINT ck CHECK (`Qty` > 0)")}"); + output.WriteLine($" check [] : {AceExec(path, "ALTER TABLE T ADD CONSTRAINT ck2 CHECK ([Qty] > 0)")}"); + output.WriteLine($" insert : {AceExec(path, "INSERT INTO T (Id, Qty) VALUES (2, 7)")}"); + } + finally { TemporaryDatabase.Delete(path); } + } + + private static void Execute(System.Data.Common.DbConnection connection, string sql) + { + using var command = connection.CreateCommand(); + command.CommandText = sql; + command.ExecuteNonQuery(); + } + + // ---- ALTER probes ------------------------------------------------------------------------------- + // + // Three things decide what LibRed's ALTER paths have to do, and none is guessable: + // 1. renaming a column a calculated expression READS -- does ACE rewrite the stored expression text, + // or does it leave a dangling reference? + // 2. changing the expression on a table that already has rows -- are the cached values recomputed at + // once, or left stale until something touches each row? + // 3. can the result type be changed at all, and can an ordinary column become calculated? + [Fact] + public void Records_what_ace_does_when_a_calculated_column_is_altered() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-alter-"); + try + { + CreateTable(engine!, path, "CLong", DbLong, 0, "[Qty]*2"); + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + "INSERT INTO T_CLong (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'hello', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + + // Control first: DAO refuses to mutate a field of a SAVED TableDef whether or not anything is + // calculated, so a refusal there says nothing about calculated columns. + output.WriteLine($" [control] DAO rename an ordinary column: {DaoField(workspace, path, + "T_CLong", "A", f => SetProperty(f, "Name", "Renamed"))}"); + output.WriteLine($" [control] DAO set Expression : {DaoField(workspace, path, + "T_CLong", "CLong", f => SetProperty(f, "Expression", "[Qty]*3"))}"); + + // What LibRed actually implements is reachable through ACE SQL, so ask about those instead. Each + // gets its own table, so one refusal cannot decide the next. + // StillReads: what ACE returns for the calculated column afterwards, or null where the operation + // leaves it unreadable. ACE does NOT protect the reference -- dropping a column an expression + // reads is accepted and simply breaks the calculated column, which is worth knowing before + // deciding whether LibRed should refuse where ACE does not. + (string Name, string Sql, string? StillReads)[] operations = + [ + ("AltAdd", "ALTER TABLE T_AltAdd ADD COLUMN Extra LONG", "14"), + ("AltRetype", "ALTER TABLE T_AltRetype ALTER COLUMN Qty DOUBLE", "14"), // a column it READS + ("AltDropRef", "ALTER TABLE T_AltDropRef DROP COLUMN Qty", null), // ditto, removed + ("AltDropCal", "ALTER TABLE T_AltDropCal DROP COLUMN AltDropCal", null), // the calculated one + ("AltWiden", "ALTER TABLE T_AltWiden ALTER COLUMN A TEXT(60)", "14"), // unrelated column + ]; + + object database = Invoke(workspace, "OpenDatabase", path)!; + foreach ((string name, _, _) in operations) + AppendCalculatedTable(database, name, DbLong, 0, "[Qty]*2"); + Invoke(database, "Close"); + + foreach ((string name, string sql, string? stillReads) in operations) + { + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + $"INSERT INTO T_{name} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'x', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + string outcome = AceExec(path, sql); + string read = AceScalar(path, $"SELECT [{name}] FROM T_{name}"); + output.WriteLine($" {name,-11}: {outcome}"); + output.WriteLine($" expression : {LibRedExpression(path, "T_" + name, name)}"); + output.WriteLine($" ACE reads : {read}"); + + // Every one of these is ACCEPTED -- including the two that break the calculated column. + Assert.Equal("ACCEPTED", outcome); + if (stillReads is not null) Assert.Equal(stillReads, read); + else Assert.StartsWith("error", read, StringComparison.Ordinal); + } + } + finally { TemporaryDatabase.Delete(path); } + } + + // LibRed's OWN alter paths over a table that has a calculated column. ADD and DROP of an unrelated column + // are covered above; these rebuild around it, rename what it reads, or remove it. + // + // The rename case is a fixed bug, and a nasty shape: renaming Qty left the expression saying [Qty]*2, so + // an operation naming a DIFFERENT column silently made the calculated one unreadable to ACE. Nothing but + // asking ACE would have shown it -- LibRed read the table back quite happily. + [Fact] + public void Libred_alter_keeps_a_calculated_column_working() + { + object? engine = CreateDbEngine(); + Assert.SkipWhen(engine is null, "DAO is unavailable in this process; it authors the fixture."); + + string path = TemporaryDatabase.CreatePath("calc-libalter-"); + try + { + object workspace = Invoke(engine!, "CreateWorkspace", "", "admin", "", UseJet)!; + object created = Invoke(workspace, "CreateDatabase", path, ";LANGID=0x0409;CP=1252;COUNTRY=0", 128)!; + foreach (string name in (string[])["LibRetype", "LibRename", "LibDropCalc"]) + AppendCalculatedTable(created, name, DbLong, 0, "[Qty]*2"); + Invoke(created, "Close"); + + foreach (string name in (string[])["LibRetype", "LibRename", "LibDropCalc"]) + using (var connection = AceTestDatabase.Open(path)) + { + using var insert = connection.CreateCommand(); + insert.CommandText = + $"INSERT INTO T_{name} (Id, Qty, Price, A, D1) VALUES (1, 7, 12.5, 'x', #2003-09-29#)"; + insert.ExecuteNonQuery(); + } + + // Retyping a column the expression reads leaves the expression alone and ACE still evaluates it, + // which is what ACE's own ALTER COLUMN does. + Apply("LibRetype", db => db.AlterColumn( + "T_LibRetype", "Price", new ColumnSpec("Price", JetDataType.Double, 8, IsFixedLength: true))); + Assert.Equal("[Qty]*2 / Int32", LibRedExpression(path, "T_LibRetype", "LibRetype")); + Assert.Equal("14", AceScalar(path, "SELECT [LibRetype] FROM T_LibRetype")); + + // Renaming one REPOINTS the expression, so the column keeps working. + Apply("LibRename", db => db.RenameColumn("T_LibRename", "Qty", "Amount")); + Assert.Equal("[Amount]*2 / Int32", LibRedExpression(path, "T_LibRename", "LibRename")); + Assert.Equal("14", AceScalar(path, "SELECT [LibRename] FROM T_LibRename")); + + // And the calculated column itself can be dropped, leaving a table ACE still opens. + Apply("LibDropCalc", db => db.DropColumn("T_LibDropCalc", "LibDropCalc")); + Assert.Equal("(column gone)", LibRedExpression(path, "T_LibDropCalc", "LibDropCalc")); + Assert.Equal("7", AceScalar(path, "SELECT Qty FROM T_LibDropCalc")); + + // Dropping a column an expression READS is refused -- deliberately unlike ACE, which accepts it + // and leaves a calculated column nothing can evaluate or repair. Dropping the calculated column + // first is the way through, and then the referenced column goes freely. + using (var db = JetDatabase.Open(path, readOnly: false)) + { + var refused = Assert.Throws( + () => db.DropColumn("T_LibRetype", "Qty")); + output.WriteLine($" drop a referenced column: {refused.Message}"); + Assert.Contains("calculated column that reads", refused.Message, StringComparison.Ordinal); + + db.DropColumn("T_LibRetype", "LibRetype"); + Assert.True(db.DropColumn("T_LibRetype", "Qty")); + } + Assert.Equal("1", AceScalar(path, "SELECT Id FROM T_LibRetype")); + + void Apply(string label, Action operation) + { + using var db = JetDatabase.Open(path, readOnly: false); + operation(db); + output.WriteLine($" {label} applied"); + } + } + finally { TemporaryDatabase.Delete(path); } + } + + /// Opens the database with DAO, applies to one field of a saved + /// TableDef, and reports what happened. + private static string DaoField(object workspace, string path, string table, string column, Action mutate) + { + object? database = null; + try + { + database = Invoke(workspace, "OpenDatabase", path)!; + object tdf = Invoke(GetProperty(database, "TableDefs")!, "Item", table)!; + object field = Invoke(GetProperty(tdf, "Fields")!, "Item", column)!; + mutate(field); + return "ACCEPTED"; + } + catch (Exception ex) + { + return $"refused -- {(ex as TargetInvocationException)?.InnerException?.Message.Trim() ?? ex.Message.Trim()}"; + } + finally { if (database is not null) try { Invoke(database, "Close"); } catch { /* already closed */ } } + } + + private static string AceExec(string path, string sql) + { + try + { + using var connection = AceTestDatabase.Open(path); + using var command = connection.CreateCommand(); + command.CommandText = sql; + command.ExecuteNonQuery(); + return "ACCEPTED"; + } + catch (Exception ex) { return $"refused -- {ex.Message.Trim()}"; } + } + + private static string AceScalar(string path, string sql) + { + try + { + using var connection = AceTestDatabase.Open(path); + using var command = connection.CreateCommand(); + command.CommandText = sql; + return Convert.ToString(command.ExecuteScalar()) ?? "(null)"; + } + catch (Exception ex) { return $"error -- {ex.Message.Trim()}"; } + } + + private static string LibRedExpression(string path, string table, string column) + { + try + { + using var db = JetDatabase.Open(path, readOnly: true); + ColumnDef? c = db.OpenTable(table).Definition.FindColumn(column); + if (c is null) return "(column gone)"; + return $"{c.CalculatedExpression ?? "(none)"} / {c.CalculatedResultType?.ToString() ?? "(none)"}"; + } + catch (Exception ex) { return $"error -- {ex.Message.Trim()}"; } + } + private static object? Invoke(object target, string member, params object?[] args) => target.GetType().InvokeMember(member, BindingFlags.InvokeMethod, null, target, args); diff --git a/test/LibRed.Core.Tests/CalculatedEvaluatorTests.cs b/test/LibRed.Core.Tests/CalculatedEvaluatorTests.cs new file mode 100644 index 00000000..6e56a0a4 --- /dev/null +++ b/test/LibRed.Core.Tests/CalculatedEvaluatorTests.cs @@ -0,0 +1,301 @@ +using LibRed.Catalog; +using LibRed.Storage.Calculated; +using Xunit; + +namespace LibRed.Core.Tests; + +// The evaluator for the expression subset ACE permits in a calculated column. These are LibRed-only tests: +// they pin the semantics that must hold before any of it is compared against ACE, and they run on the +// cross-platform suite because nothing here needs an engine. +// +// The value that matters most is Null handling, because a calculated column's stored result is a cache +// neither engine re-derives on read -- a wrong one is invisible until someone compares two databases. +public class CalculatedEvaluatorTests +{ + private static object? Eval(string expression, params (string Column, object? Value)[] row) + { + var values = row.ToDictionary(r => r.Column, r => r.Value, StringComparer.OrdinalIgnoreCase); + return CalculatedEvaluator.Evaluate( + CalculatedExpression.Parse(expression), + name => values.TryGetValue(name, out object? v) ? v + : throw new CalculatedExpressionException($"No column '{name}'.")); + } + + [Theory] + [InlineData("1+1", 2.0)] + [InlineData("2*3+1", 7.0)] + [InlineData("1+2*3", 7.0)] + [InlineData("(1+2)*3", 9.0)] + [InlineData("2^3", 8.0)] + [InlineData("-2^2", -4.0)] // ^ binds tighter than unary minus, as in VBA + [InlineData("2^3^2", 512.0)] // right-associative + [InlineData("10/4", 2.5)] + public void Evaluates_arithmetic(string expression, double expected) + => Assert.Equal(expected, Assert.IsType(Eval(expression))); + + [Theory] + [InlineData("\"a\" & \"b\"", "ab")] + [InlineData("\"n=\" & 1", "n=1")] + [InlineData("\"a\" + \"b\"", "ab")] // '+' concatenates when BOTH sides are text + public void Evaluates_concatenation(string expression, string expected) + => Assert.Equal(expected, Eval(expression)); + + // The asymmetry MSDN uses to introduce the feature: '+' propagates Null, '&' swallows it. Reversing + // them leaves a stray space in the classic full-name expression, which nothing would ever flag. + [Fact] + public void Concatenation_swallows_null_but_addition_propagates_it() + { + Assert.Equal("ab", Eval("[A] & [B]", ("A", "ab"), ("B", null))); + Assert.Null(Eval("[A] + [B]", ("A", "ab"), ("B", null))); + + const string fullName = "[First] & \" \" & ([Middle] + \" \") & [Last]"; + Assert.Equal("Ada Lovelace", Eval(fullName, ("First", "Ada"), ("Middle", null), ("Last", "Lovelace"))); + Assert.Equal("Ada B Lovelace", Eval(fullName, ("First", "Ada"), ("Middle", "B"), ("Last", "Lovelace"))); + } + + [Theory] + [InlineData("[A] + 1")] + [InlineData("[A] * 2")] + [InlineData("[A] > 1")] + [InlineData("Abs([A])")] + [InlineData("Left([A], 2)")] + public void Null_propagates_through_arithmetic_comparison_and_functions(string expression) + => Assert.Null(Eval(expression, ("A", null))); + + // CDbl is the other exception, and it goes the opposite way: the VBA conversions RAISE on Null instead of + // propagating it, and CDbl is the only conversion a calculated column may contain. ACE caches the failure + // as VBA error 94 and then cannot read that row back; LibRed refuses to write it, so the unreadable state + // never reaches the file. Everything else on the whitelist still propagates. + [Fact] + public void CDbl_refuses_a_null_rather_than_propagating_it() + { + var ex = Assert.Throws(() => Eval("CDbl([A])", ("A", null))); + Assert.Contains("CDbl cannot convert Null", ex.Message, StringComparison.Ordinal); + Assert.Contains("IIf(IsNull(", ex.Message, StringComparison.Ordinal); // and says how to avoid it + + Assert.Equal(7.0, Eval("CDbl([A])", ("A", 7))); // still works over a value + Assert.Null(Eval("Abs([A])", ("A", null))); // neighbours unaffected + Assert.Equal(0.0, Eval("IIf(IsNull([A]), 0, CDbl([A]))", ("A", null))); // the documented guard + } + + // IIf, Choose and IsNull are the exceptions: they must see the Null rather than become it. + [Fact] + public void Selection_functions_do_not_propagate_null() + { + Assert.Equal("none", Eval("IIf(IsNull([A]), \"none\", [A])", ("A", null))); + Assert.Equal("here", Eval("IIf(IsNull([A]), \"none\", [A])", ("A", "here"))); + Assert.Equal(true, Eval("IsNull([A])", ("A", null))); + Assert.Equal("b", Eval("Choose(2, \"a\", \"b\")")); + Assert.Null(Eval("Choose(9, \"a\", \"b\")")); + } + + [Theory] + [InlineData("Len(\"abc\")", 3.0)] + [InlineData("Asc(\"A\")", 65.0)] + [InlineData("Abs(-3)", 3.0)] + [InlineData("Sgn(-3)", -1.0)] + [InlineData("Int(-1.5)", -2.0)] // Int floors + [InlineData("Fix(-1.5)", -1.0)] // Fix truncates toward zero + [InlineData("Round(2.5)", 2.0)] // banker's rounding, as VBA does + [InlineData("Round(3.5)", 4.0)] + // 2.125 is exact in binary, so this tests the rounding rule rather than the representation of the + // literal -- 2.345 is really 2.34499…, which makes it a test of double parsing, not of Round. + [InlineData("Round(2.125, 2)", 2.12)] + public void Evaluates_numeric_functions(string expression, double expected) + => Assert.Equal(expected, Assert.IsType(Eval(expression))); + + [Theory] + [InlineData("UCase(\"aB\")", "AB")] + [InlineData("LCase(\"aB\")", "ab")] + [InlineData("Trim(\" a \")", "a")] + [InlineData("Left(\"abcdef\", 2)", "ab")] + [InlineData("Right(\"abcdef\", 2)", "ef")] + [InlineData("Mid(\"abcdef\", 2, 3)", "bcd")] + [InlineData("Space(3)", " ")] + [InlineData("String(3, \"x\")", "xxx")] + public void Evaluates_string_functions(string expression, string expected) + => Assert.Equal(expected, Eval(expression)); + + // Access requires every argument of these two even though VBA makes some optional, and reports a + // missing one as a SYNTAX error rather than a policy refusal. LibRed has to refuse the same shapes, + // or it would happily write a value ACE would never have produced. + [Theory] + [InlineData("Mid(\"abcdef\", 2)")] + [InlineData("InStr(\"abc\", \"b\")")] + public void Requires_every_argument_where_ace_does(string expression) + => Assert.Throws(() => Eval(expression)); + + // ...but that is per-function and NOT the general rule the MSDN article states, which is why each one + // has to be recorded by measurement. These were measured accepted with their optionals left out, so + // refusing them would be refusing an expression ACE lets you author. + [Theory] + [InlineData("Round(2.5)", 2.0)] + [InlineData("Weekday(#2003-09-29#)", 2.0)] + [InlineData("Pmt(0.005, 60, 10000)", -193.3280)] + public void Accepts_an_omitted_optional_where_ace_does(string expression, double expected) + => Assert.Equal(expected, Assert.IsType(Eval(expression)), 4); + + [Fact] + public void Evaluates_InStr_in_its_full_form() + { + Assert.Equal(2.0, Eval("InStr(1, \"abc\", \"b\", 0)")); + Assert.Equal(0.0, Eval("InStr(1, \"abc\", \"z\", 0)")); + Assert.Equal(2.0, Eval("InStr(1, \"aBc\", \"b\", 1)")); // compare = 1 is case-insensitive + } + + // ACE takes three or four arguments here and rejects two. With compare omitted it matches + // case-INSENSITIVELY -- Access's Option Compare Database default, not VBA's binary one -- so the + // three-argument form is not the same as passing 0. + [Fact] + public void Evaluates_InStr_without_its_compare_argument() + { + Assert.Equal(1.0, Eval("InStr(1, \"hello\", \"H\")")); + Assert.Equal(0.0, Eval("InStr(1, \"hello\", \"H\", 0)")); + Assert.Equal(1.0, Eval("InStr(1, \"hello\", \"H\", 1)")); + Assert.Equal(0.0, Eval("InStr(1, \"hello\", \"a\")")); + } + + [Theory] + [InlineData("1 = 1", true)] + [InlineData("1 <> 1", false)] + [InlineData("2 > 1 And 1 < 2", true)] + [InlineData("2 > 1 Or 1 > 2", true)] + [InlineData("Not 2 > 1", false)] + [InlineData("\"abc\" Like \"a*\"", true)] + [InlineData("\"abc\" Like \"a?c\"", true)] + [InlineData("\"a1c\" Like \"a#c\"", true)] + [InlineData("\"abc\" Like \"b*\"", false)] + [InlineData("2 In (1, 2, 3)", true)] + [InlineData("9 In (1, 2, 3)", false)] + public void Evaluates_predicates(string expression, bool expected) + => Assert.Equal(expected, Eval(expression)); + + [Fact] + public void Evaluates_is_null() + { + Assert.Equal(true, Eval("[A] Is Null", ("A", null))); + Assert.Equal(false, Eval("[A] Is Null", ("A", 1.0))); + Assert.Equal(true, Eval("[A] Is Not Null", ("A", 1.0))); + } + + [Fact] + public void Evaluates_dates() + { + Assert.Equal(new DateTime(2003, 9, 30), Eval("[D] + 1", ("D", new DateTime(2003, 9, 29)))); + Assert.Equal(2003.0, Eval("Year([D])", ("D", new DateTime(2003, 9, 29)))); + Assert.Equal(9.0, Eval("Month([D])", ("D", new DateTime(2003, 9, 29)))); + Assert.Equal(new DateTime(2020, 1, 1), Eval("DateSerial(2020, 1, 1)")); + } + + // IsEmpty asks whether a Variant was never initialised, which a stored column value never is. ACE + // returns False for a column holding a value and for one holding Null alike, so it is a constant. + [Fact] + public void IsEmpty_is_always_false_for_a_column() + { + Assert.Equal(false, Eval("IsEmpty([A])", ("A", "hello"))); + Assert.Equal(false, Eval("IsEmpty([A])", ("A", null))); + } + + // Access's Expression Builder offers the '$' name variants and its designer accepts them, but ACE then + // fails every insert into the table. Refusing them matches ACE; writing a value would not. + [Theory] + [InlineData("Left$([A], 2)")] + [InlineData("Trim$([A])")] + [InlineData("UCase$([A])")] + [InlineData("Mid$([A], 2, 3)")] + public void Refuses_the_dollar_name_variants(string expression) + { + var ex = Assert.Throws(() => Eval(expression, ("A", "hello"))); + Assert.Contains("cannot be evaluated in a calculated column", ex.Message); + } + + // Every function on ACE's whitelist is now implemented, so what has to throw is one ACE itself refuses. + // Never guess at it: an unnoticed wrong value is the failure mode a cached column cannot recover from. + [Theory] + [InlineData("Replace([A], \"a\", \"b\")")] + [InlineData("Format([A], \"0.00\")")] + [InlineData("CInt(1.5)")] + [InlineData("Nz([A], 0)")] + [InlineData("DateAdd(\"d\", 1, [A])")] + public void Refuses_a_function_ace_does_not_allow(string expression) + => Assert.Throws(() => Eval(expression, ("A", "x"))); + + // Renaming a column has to repoint every expression that READS it, or the rename quietly breaks a + // calculated column elsewhere in the table. The rewrite is textual so the author's spacing and bracketing + // survive, which means it has to know where a name is NOT a column reference. + [Theory] + [InlineData("[Qty]*2", "[Amount]*2")] + [InlineData("Qty*2", "Amount*2")] // a bare reference stays bare + [InlineData("[Qty] & \"Qty\"", "[Amount] & \"Qty\"")] // not inside a string literal + [InlineData("[Quantity]*2", "[Quantity]*2")] // not a prefix match + [InlineData("[qty]*2", "[Amount]*2")] // Access names are case-insensitive + [InlineData("Left([Qty], 2)", "Left([Amount], 2)")] // the function name is left alone + [InlineData("[Qty]+[Qty]", "[Amount]+[Amount]")] + [InlineData("[D1] > #2003-09-29#", "[D1] > #2003-09-29#")] + public void Renames_only_real_references_to_a_column(string expression, string expected) + => Assert.Equal(expected, CalculatedExpression.RenameColumnReference(expression, "Qty", "Amount")); + + // A new name that is not a plain identifier has to gain brackets, even where the old one had none. + [Fact] + public void Brackets_a_renamed_reference_when_the_new_name_needs_them() + => Assert.Equal("[Order Qty]*2", CalculatedExpression.RenameColumnReference("Qty*2", "Qty", "Order Qty")); + + [Theory] + [InlineData("MonthName(1)", "January")] + [InlineData("MonthName(3, True)", "Mar")] + [InlineData("WeekdayName(1)", "Sunday")] + [InlineData("WeekdayName(2, True)", "Mon")] + [InlineData("WeekdayName(1, False, 2)", "Monday")] // firstDayOfWeek = vbMonday + public void Evaluates_the_name_functions(string expression, string expected) + => Assert.Equal(expected, Eval(expression)); + + // The ten financial functions, ported from LibRed.Engine's evaluator so that SQL and a calculated column + // cannot give two answers for one formula. The expectations are the standard annuity and depreciation + // results, and they cover both the rate = 0 branch and the general one. + [Theory] + [InlineData("Pmt(0.005, 60, 10000, 0, 0)", -193.3280)] + [InlineData("Pmt(0, 10, 1000, 0, 0)", -100.0)] + [InlineData("FV(0.01, 10, -100, 0, 0)", 1046.2213)] + [InlineData("PV(0.01, 10, -100, 0, 0)", 947.1305)] + [InlineData("NPer(0, -100, 1000, 0, 0)", 10.0)] + [InlineData("Rate(60, -193.3280, 10000, 0, 0, 0.1)", 0.005)] + [InlineData("IPmt(0.005, 1, 60, 10000, 0, 0)", -50.0)] + [InlineData("PPmt(0.005, 1, 60, 10000, 0, 0)", -143.3280)] + [InlineData("SLN(10000, 1000, 5)", 1800.0)] + [InlineData("SYD(10000, 1000, 5, 1)", 3000.0)] + [InlineData("DDB(10000, 1000, 5, 2, 2)", 2400.0)] + public void Evaluates_the_financial_functions(string expression, double expected) + => Assert.Equal(expected, Assert.IsType(Eval(expression)), 4); + + [Theory] + [InlineData("[A] +")] + [InlineData("(1 + 2")] + [InlineData("\"unterminated")] + [InlineData("1 ? 2")] + public void Refuses_malformed_expressions(string expression) + => Assert.Throws(() => Eval(expression, ("A", 1.0))); + + [Fact] + public void Reports_the_columns_an_expression_reads() + { + var referenced = CalculatedExpression.ReferencedColumns( + CalculatedExpression.Parse("IIf([Qty] > 1, [A] & [B], Left([A], 2))")); + Assert.Equal(["A", "B", "Qty"], referenced.OrderBy(n => n, StringComparer.Ordinal)); + } + + [Theory] + [InlineData(JetDataType.Int32, 7.0, 7)] + [InlineData(JetDataType.Int16, 7.0, (short)7)] + [InlineData(JetDataType.Byte, 7.0, (byte)7)] + [InlineData(JetDataType.Boolean, 1.0, true)] + [InlineData(JetDataType.Boolean, 0.0, false)] + [InlineData(JetDataType.Double, 7.0, 7.0)] + [InlineData(JetDataType.Single, 7.0, 7f)] + [InlineData(JetDataType.Text, 7.0, "7")] + public void Coerces_a_result_to_the_stored_result_type(JetDataType type, object value, object expected) + => Assert.Equal(expected, CalculatedEvaluator.Coerce(value, type)); + + [Fact] + public void Coercion_keeps_null_as_null() + => Assert.Null(CalculatedEvaluator.Coerce(null, JetDataType.Int32)); +} diff --git a/test/LibRed.Engine.AccessTests/CalculatedColumnSqlAccessTests.cs b/test/LibRed.Engine.AccessTests/CalculatedColumnSqlAccessTests.cs new file mode 100644 index 00000000..0301e682 --- /dev/null +++ b/test/LibRed.Engine.AccessTests/CalculatedColumnSqlAccessTests.cs @@ -0,0 +1,200 @@ +using LibRed.Catalog; +using LibRed.Storage; +using Xunit; + +namespace LibRed.Engine.Tests; + +// The SQL surface for calculated columns, which is LibRed's OWN: Access SQL has no syntax for one, and ACE +// can only create them through DAO's object model. So none of this SQL will run against ACE — but the FILE +// it produces has to, and that is what these tests check. +// +// The type is required, unlike SQL Server's computed column, because the declared type IS the result type +// and decides how the cached value is encoded on disk (docs/format/page-02e-calculated-columns.md). +[Collection(AceCollection.Name)] +public class CalculatedColumnSqlAccessTests(ITestOutputHelper output) : TempDatabaseTest +{ + [Fact] + public void Creates_and_adds_calculated_columns_ace_can_read() + { + string path = TemporaryDatabase.CreatePath("calc-sql-"); + try + { + DatabaseCreator.CreateEmpty(path); + using (var database = JetDatabase.Open(path, readOnly: false)) + { + var engine = new QueryEngine(database); + engine.ExecuteNonQuery( + "CREATE TABLE T (Id LONG, Qty LONG, Doubled LONG AS ([Qty]*2), " + + "Label TEXT(40) AS (\"n=\" & [Qty]))"); + engine.ExecuteNonQuery("INSERT INTO T (Id, Qty) VALUES (1, 7)"); + engine.ExecuteNonQuery("ALTER TABLE T ADD COLUMN Tripled LONG AS ([Qty]*3)"); + engine.ExecuteNonQuery("INSERT INTO T (Id, Qty) VALUES (2, 5)"); + } + + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = "SELECT Id, Doubled, Label, Tripled FROM T ORDER BY Id"; + using var reader = select.ExecuteReader(); + var rows = new List(); + while (reader.Read()) + rows.Add(string.Join(" | ", Enumerable.Range(0, 4) + .Select(i => reader.IsDBNull(i) ? "(null)" : Convert.ToString(reader.GetValue(i))))); + foreach (string row in rows) output.WriteLine($" {row}"); + + // Row 1 predates the ADD COLUMN, so its Tripled is NULL — an added column reads as null on + // existing rows whether it is calculated or not, because no row was rewritten. + Assert.Equal(["1 | 14 | n=7 | (null)", "2 | 10 | n=5 | 15"], rows); + } + finally { TemporaryDatabase.Delete(path); } + } + + // The exact shape LibRedMigrationsSqlGenerator emits, backticks and all: EF quotes identifiers that way + // and passes a HasComputedColumnSql string through verbatim, so both quote styles reach the expression. + // Backticks are translated to brackets on the way in, because ACE's expression service does not know + // them -- measured, it reads `Qty` as a field literally named "`Qty`" and cannot find it. + [Fact] + public void Accepts_the_sql_ef_core_emits_for_a_computed_column() + { + string path = TemporaryDatabase.CreatePath("calc-efsql-"); + try + { + DatabaseCreator.CreateEmpty(path); + using (var database = JetDatabase.Open(path, readOnly: false)) + { + var engine = new QueryEngine(database); + engine.ExecuteNonQuery(""" + CREATE TABLE `People` ( + `Id` counter NOT NULL, + `Sum` varchar(255) AS (`X` + `Y`), + `X` integer NOT NULL, + `Y` integer NOT NULL, + CONSTRAINT `PK_People` PRIMARY KEY (`Id`) + ) + """); + engine.ExecuteNonQuery("INSERT INTO `People` (`X`, `Y`) VALUES (2, 3)"); + + // Stored in the bracket form ACE can evaluate, not as written. + Assert.Equal("[X] + [Y]", + database.OpenTable("People").Definition.FindColumn("Sum")!.CalculatedExpression); + } + + // A forward reference works too: Sum is declared before the columns it reads. + using var check = AceTestDatabase.Open(path); + using var select = check.CreateCommand(); + select.CommandText = "SELECT `Sum` FROM `People`"; + output.WriteLine($" ACE reads: {select.ExecuteScalar()}"); + Assert.Equal("5", Convert.ToString(select.ExecuteScalar())); + } + finally { TemporaryDatabase.Delete(path); } + } + + // A CHECK constraint is expression text in LvProp too, evaluated by the same expression service — which + // does not know SQL's backtick quoting. ACE's DDL parser accepts `CHECK (`Qty` > 0)` and stores it, and + // then every INSERT fails with "Could not find field '`Qty`'", so the table is created already unusable. + // LibRed normalises the quoting on the way into the blob, which is what keeps ACE able to write. + [Fact] + public void Normalises_identifier_quoting_in_a_check_constraint() + { + string path = TemporaryDatabase.CreatePath("check-tick-"); + try + { + DatabaseCreator.CreateEmpty(path); + using (var database = JetDatabase.Open(path, readOnly: false)) + new QueryEngine(database).ExecuteNonQuery( + "CREATE TABLE `T` (`Id` integer, `Qty` integer, CONSTRAINT `ck` CHECK (`Qty` > 0))"); + + using (var database = JetDatabase.Open(path, readOnly: true)) + { + (string Name, string Expression) check = + Assert.Single(database.Catalog.FindTable("T")!.CheckConstraints); + output.WriteLine($" stored: {check.Name} -> {check.Expression}"); + Assert.Equal("[Qty] > 0", check.Expression); + } + + // The engine that has to evaluate it gets the last word: ACE writes a passing row and rejects a + // failing one, which it could not do at all if the constraint still named "`Qty`". + using var connection = AceTestDatabase.Open(path); + using (var ok = connection.CreateCommand()) + { + ok.CommandText = "INSERT INTO T (Id, Qty) VALUES (1, 5)"; + Assert.Equal(1, ok.ExecuteNonQuery()); + } + using (var bad = connection.CreateCommand()) + { + bad.CommandText = "INSERT INTO T (Id, Qty) VALUES (2, -1)"; + Exception violation = Assert.ThrowsAny(() => bad.ExecuteNonQuery()); + output.WriteLine($" ACE rejects -1: {violation.Message.Trim()}"); + } + } + finally { TemporaryDatabase.Delete(path); } + } + + // An index over a calculated column is refused on every route. This is not a divergence from Access: its + // designer will not offer a calculated column in the Indexes dialog and will not let it be the primary + // key, and the storage engine refuses every INSERT into a table where one is indexed. ACE's SQL layer is + // the only one that accepts it, and what it builds is a table no row can ever be written to. + [Theory] + [InlineData("CREATE INDEX ix ON T (C)")] + [InlineData("CREATE UNIQUE INDEX ix ON T (C)")] + [InlineData("CREATE INDEX ix ON T (Qty, C)")] // buried in a composite + public void Refuses_an_index_over_a_calculated_column(string sql) + { + string path = TemporaryDatabase.CreatePath("calc-index-"); + try + { + DatabaseCreator.CreateEmpty(path); + using var database = JetDatabase.Open(path, readOnly: false); + var engine = new QueryEngine(database); + engine.ExecuteNonQuery("CREATE TABLE T (Id integer, Qty integer, C integer AS ([Qty]*2))"); + + var ex = Assert.ThrowsAny(() => { engine.ExecuteNonQuery(sql); }); + output.WriteLine($" {ex.Message}"); + Assert.Contains("calculated column 'C'", ex.Message, StringComparison.Ordinal); + } + finally { TemporaryDatabase.Delete(path); } + } + + // The same refusal on the CREATE TABLE route, where the index arrives as a table-level constraint rather + // than as an index — the inline `col type PRIMARY KEY` form is already refused at the SQL layer. + [Theory] + [InlineData("CREATE TABLE T (Qty integer, C integer AS ([Qty]*2), CONSTRAINT pk PRIMARY KEY (C))")] + [InlineData("CREATE TABLE T (Qty integer, C integer AS ([Qty]*2), CONSTRAINT u UNIQUE (C))")] + public void Refuses_a_key_over_a_calculated_column(string sql) + { + string path = TemporaryDatabase.CreatePath("calc-key-"); + try + { + DatabaseCreator.CreateEmpty(path); + using var database = JetDatabase.Open(path, readOnly: false); + var ex = Assert.ThrowsAny(() => { new QueryEngine(database).ExecuteNonQuery(sql); }); + output.WriteLine($" {ex.Message}"); + Assert.Contains("calculated column 'C'", ex.Message, StringComparison.Ordinal); + } + finally { TemporaryDatabase.Delete(path); } + } + + // Each of these would otherwise produce a column that reads one way in the DDL and behaves another, so + // they are refused rather than ignored. The key case is measured, not defensive: ACE accepts an index on + // a calculated column and then refuses every insert into that table. + [Theory] + [InlineData("CREATE TABLE T (Qty LONG, C LONG AS ([Qty]*2) PRIMARY KEY)", "cannot be both calculated")] + [InlineData("CREATE TABLE T (Qty LONG, C LONG AS ([Qty]*2) DEFAULT 1)", "cannot have a DEFAULT")] + [InlineData("CREATE TABLE T (Qty LONG, C LONG AS ([Qty]*2) NOT NULL)", "cannot be NOT NULL")] + [InlineData("CREATE TABLE T (Qty LONG, C TEXT(40) AS (\"x\") WITH COMPRESSION)", "WITH COMPRESSION")] + [InlineData("CREATE TABLE T (Qty LONG, C LONG AS (CInt([Qty])))", "cannot be used")] + [InlineData("CREATE TABLE T (Qty LONG, C LONG AS ([Missing]*2))", "refers to another table")] + public void Refuses_a_calculated_column_that_cannot_mean_what_it_says(string sql, string expected) + { + string path = TemporaryDatabase.CreatePath("calc-sqlbad-"); + try + { + DatabaseCreator.CreateEmpty(path); + using var database = JetDatabase.Open(path, readOnly: false); + var engine = new QueryEngine(database); + var ex = Assert.ThrowsAny(() => { engine.ExecuteNonQuery(sql); }); + output.WriteLine($" {ex.Message}"); + Assert.Contains(expected, ex.Message, StringComparison.OrdinalIgnoreCase); + } + finally { TemporaryDatabase.Delete(path); } + } +} From 2f1eaa3ad1863a898249c9363f1773943c19126c Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Thu, 10 Sep 2026 23:32:21 +0800 Subject: [PATCH 04/13] Read unmodelled column type codes instead of refusing the database 0x0D, 0x0E and 0x11 become placeholders in JetDataType so a TDEF carrying one still parses: the column decodes to its raw bytes, and only writing one is refused. The catalog reads every table's definition, so a single unrecognised column previously made the entire file unopenable -- three of four real Jet 4 .mdb files taken off the web would not open at all, and read cleanly afterwards (69 tables, ~204k rows across the four). Same failure shape as the long-value guard that once rejected a calculated Memo. 0x11 is the only one met in the wild, and never on a user column; what it holds, and which files carry it, is in data-types.md. Co-Authored-By: Claude Opus 5 --- src/LibRed/LibRed.Core/Catalog/JetDataType.cs | 21 ++++++++++++++ src/LibRed/docs/format/data-types.md | 29 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/LibRed/LibRed.Core/Catalog/JetDataType.cs b/src/LibRed/LibRed.Core/Catalog/JetDataType.cs index 05cebc20..dbabc0f5 100644 --- a/src/LibRed/LibRed.Core/Catalog/JetDataType.cs +++ b/src/LibRed/LibRed.Core/Catalog/JetDataType.cs @@ -2,6 +2,11 @@ namespace LibRed.Catalog; /// /// The column data types supported by Jet/ACE, with their on-disk type codes. +/// The Unknown* members are placeholders for codes in the range that LibRed does not model. +/// They exist so that meeting one is not fatal: the TDEF still parses, the column decodes to its raw +/// bytes ('s default arm), and only *writing* one is refused. Without +/// them a single unrecognised column made the entire database unopenable, because the catalog reads every +/// table's definition — the same shape of failure a long-value guard once caused (page-02b §3.4a). /// public enum JetDataType : byte { @@ -17,8 +22,24 @@ public enum JetDataType : byte Text = 0x0A, Ole = 0x0B, Memo = 0x0C, + + /// Unmodelled. Not seen in any file measured — a gap in the sequence, held open so the code + /// cannot take a database down if one turns up. + Unknown0D = 0x0D, + + /// Unmodelled. Not seen in any file measured — see . + Unknown0E = 0x0E, + Guid = 0x0F, FixedPoint = 0x10, // NUMERIC / DECIMAL + + /// Unmodelled, and the one unmodelled code actually met in the wild: three real Jet 4 `.mdb` + /// files carry it, every time as MSysAccessObjects.Data — fixed length, 3992 bytes, holding chunks + /// of an OLE Compound File (signature D0 CF 11 E0 A1 B1 1A E1). That is Access's own object + /// storage: the VBA project and its type-library references. Never seen on a user column. LibRed hands + /// back the raw bytes and does not interpret the container. + Unknown11 = 0x11, + Complex = 0x12, // ACE complex/multi-value columns Int64 = 0x13, // ACE 16 (Access 2016, version byte 0x05): BIGINT (Large Number) DateTimeExtended = 0x14, // ACE 17 (Access 2019+, version byte 0x06): DATETIME2 (Date/Time Extended) diff --git a/src/LibRed/docs/format/data-types.md b/src/LibRed/docs/format/data-types.md index 7e6b18a8..4292a29e 100644 --- a/src/LibRed/docs/format/data-types.md +++ b/src/LibRed/docs/format/data-types.md @@ -20,10 +20,39 @@ | `0x0C` | Memo | long value (§8); text once resolved | | `0x0F` | GUID | 16 raw bytes. Stored as a *variable*-length column when declared through SQL (see below) | | `0x10` | FixedPoint (Numeric/Decimal) | 17 bytes: sign byte (`0x80` = negative) + 128-bit magnitude (four 32-bit little-endian words, low word last); value = magnitude / 10^scale. Precision/scale from the column descriptor (§3.4) | +| `0x11` | *unmodelled* — see below | raw bytes | | `0x12` | Complex (multi-value / attachment) | descriptor parsed; contents not materialized (out of scope for SQL/EF) | | `0x13` | Int64 — **BIGINT** (ACE 16 / Access 2016) | 8-byte little-endian signed integer. Stored as a *variable*-length column (see below) | | `0x14` | DateTimeExtended — **DATETIME2** (ACE 17 / Access 2019+) | fixed 42-byte ASCII `: