diff --git a/QueryBaseline.cs b/QueryBaseline.cs index 7f87026..680020d 100644 --- a/QueryBaseline.cs +++ b/QueryBaseline.cs @@ -32749,3 +32749,5433 @@ ORDER BY [l0].[Id]"); Output truncated. +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_all_types_when_shared_column() : + AssertSql( + @"SELECT [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[CokeCO2], [d].[SugarGrams], [d].[LiltCO2], [d].[HasMilk] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] IN ('Tea', 'Lilt', 'Coke', 'Drink')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_kiwi_where_north_on_derived_property() : + AssertSql( + @"SELECT [x].[Species], [x].[CountryId], [x].[Discriminator], [x].[Name], [x].[EagleId], [x].[IsFlightless], [x].[FoundOn] +FROM [Animal] AS [x] +WHERE ([x].[Discriminator] = 'Kiwi') AND ([x].[FoundOn] = 0)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_all_birds() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_prey() : + AssertSql( + @"SELECT TOP 2 [e].[Species], [e].[CountryId], [e].[Discriminator], [e].[Name], [e].[EagleId], [e].[IsFlightless], [e].[Group] +FROM [Animal] AS [e] +WHERE [e].[Discriminator] = 'Eagle' +ORDER BY [e].[Species]", + // + @"SELECT [e#Prey].[Species], [e#Prey].[CountryId], [e#Prey].[Discriminator], [e#Prey].[Name], [e#Prey].[EagleId], [e#Prey].[IsFlightless], [e#Prey].[Group], [e#Prey].[FoundOn] +FROM ([Animal] AS [e#Prey] +INNER JOIN ( + SELECT TOP 1 [e0].[Species] + FROM [Animal] AS [e0] + WHERE [e0].[Discriminator] = 'Eagle' + ORDER BY [e0].[Species] +) AS [t] ON [e#Prey].[EagleId] = [t].[Species]) +WHERE [e#Prey].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Discriminator_used_when_projection_over_derived_type() : + AssertSql( + @"SELECT [k].[FoundOn] +FROM [Animal] AS [k] +WHERE [k].[Discriminator] = 'Kiwi'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_animal() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_when_shared_column() : + AssertSql( + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[CokeCO2], [d].[SugarGrams] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] = 'Coke'", + // + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[LiltCO2], [d].[SugarGrams] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] = 'Lilt'", + // + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[HasMilk] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] = 'Tea'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_kiwi_where_south_on_derived_property() : + AssertSql( + @"SELECT [x].[Species], [x].[CountryId], [x].[Discriminator], [x].[Name], [x].[EagleId], [x].[IsFlightless], [x].[FoundOn] +FROM [Animal] AS [x] +WHERE ([x].[Discriminator] = 'Kiwi') AND ([x].[FoundOn] = 1)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_is_kiwi_with_other_predicate() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND (([a].[Discriminator] = 'Kiwi') AND ([a].[CountryId] = 1))"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_bird_with_projection() : + AssertSql( + @"SELECT [b].[EagleId] +FROM [Animal] AS [b] +WHERE [b].[Discriminator] IN ('Kiwi', 'Eagle')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_just_roses() : + AssertSql( + @"SELECT TOP 2 [p].[Species], [p].[CountryId], [p].[Genus], [p].[Name], [p].[HasThorns] +FROM [Plant] AS [p] +WHERE [p].[Genus] = 0"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_bird_predicate() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND ([a].[CountryId] = 1) +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_is_kiwi_in_projection() : + AssertSql( + @"SELECT IIf( + [a].[Discriminator] = 'Kiwi', + True, + False +) +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_just_kiwis() : + AssertSql( + @"SELECT TOP 2 [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] = 'Kiwi'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_animals() : + AssertSql( + @"SELECT [c].[Id], [c].[Name] +FROM [Country] AS [c] +ORDER BY [c].[Name], [c].[Id]", + // + @"SELECT [c#Animals].[Species], [c#Animals].[CountryId], [c#Animals].[Discriminator], [c#Animals].[Name], [c#Animals].[EagleId], [c#Animals].[IsFlightless], [c#Animals].[Group], [c#Animals].[FoundOn] +FROM ([Animal] AS [c#Animals] +INNER JOIN ( + SELECT [c0].[Id], [c0].[Name] + FROM [Country] AS [c0] +) AS [t] ON [c#Animals].[CountryId] = [t].[Id]) +WHERE [c#Animals].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Name], [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_filter_all_animals() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND ([a].[Name] = 'Great spotted kiwi') +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_kiwi() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] = 'Kiwi'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_is_kiwi() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND ([a].[Discriminator] = 'Kiwi')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_bird_first() : + AssertSql( + @"SELECT TOP 1 [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_all_animals() : + AssertSql( + @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_prey() : + AssertSql( + @"SELECT TOP 2 [e].[Species], [e].[CountryId], [e].[Discriminator], [e].[Name], [e].[EagleId], [e].[IsFlightless], [e].[Group] +FROM [Animal] AS [e] +WHERE [e].[Discriminator] = 'Eagle' +ORDER BY [e].[Species]", + // + @"SELECT [e#Prey].[Species], [e#Prey].[CountryId], [e#Prey].[Discriminator], [e#Prey].[Name], [e#Prey].[EagleId], [e#Prey].[IsFlightless], [e#Prey].[Group], [e#Prey].[FoundOn] +FROM ([Animal] AS [e#Prey] +INNER JOIN ( + SELECT TOP 1 [e0].[Species] + FROM [Animal] AS [e0] + WHERE [e0].[Discriminator] = 'Eagle' + ORDER BY [e0].[Species] +) AS [t] ON [e#Prey].[EagleId] = [t].[Species]) +WHERE [e#Prey].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_when_shared_column() : + AssertSql( + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[CokeCO2], [d].[SugarGrams] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] = 'Coke'", + // + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[LiltCO2], [d].[SugarGrams] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] = 'Lilt'", + // + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[HasMilk] +FROM [Drink] AS [d] +WHERE [d].[Discriminator] = 'Tea'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_just_roses() : + AssertSql( + @"SELECT TOP 2 [p].[Species], [p].[CountryId], [p].[Genus], [p].[Name], [p].[HasThorns] +FROM [Plant] AS [p] +WHERE [p].[Genus] = 0"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_is_kiwi_in_projection() : + AssertSql( + @"SELECT IIf( + [a].[Discriminator] = 'Kiwi', + True, + False +) +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_query_just_kiwis() : + AssertSql( + @"SELECT TOP 2 [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] = 'Kiwi'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_animals() : + AssertSql( + @"SELECT [c].[Id], [c].[Name] +FROM [Country] AS [c] +ORDER BY [c].[Name], [c].[Id]", + // + @"SELECT [c#Animals].[Species], [c#Animals].[CountryId], [c#Animals].[Discriminator], [c#Animals].[Name], [c#Animals].[EagleId], [c#Animals].[IsFlightless], [c#Animals].[Group], [c#Animals].[FoundOn] +FROM ([Animal] AS [c#Animals] +INNER JOIN ( + SELECT [c0].[Id], [c0].[Name] + FROM [Country] AS [c0] +) AS [t] ON [c#Animals].[CountryId] = [t].[Id]) +WHERE [c#Animals].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Name], [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_use_of_type_bird_first() : + AssertSql( + @"SELECT TOP 1 [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] +FROM [Animal] AS [a] +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [a].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_animals() : + AssertSql( + @"SELECT [c].[Id], [c].[Name] +FROM [Country] AS [c] +ORDER BY [c].[Name], [c].[Id]", + // + @"SELECT [c#Animals].[Species], [c#Animals].[CountryId], [c#Animals].[Discriminator], [c#Animals].[Name], [c#Animals].[EagleId], [c#Animals].[IsFlightless], [c#Animals].[Group], [c#Animals].[FoundOn] +FROM ([Animal] AS [c#Animals] +INNER JOIN ( + SELECT [c0].[Id], [c0].[Name] + FROM [Country] AS [c0] +) AS [t] ON [c#Animals].[CountryId] = [t].[Id]) +WHERE [c#Animals].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Name], [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_prey() : + AssertSql( + @"SELECT TOP 2 [e].[Species], [e].[CountryId], [e].[Discriminator], [e].[Name], [e].[EagleId], [e].[IsFlightless], [e].[Group] +FROM [Animal] AS [e] +WHERE [e].[Discriminator] = 'Eagle' +ORDER BY [e].[Species]", + // + @"SELECT [e#Prey].[Species], [e#Prey].[CountryId], [e#Prey].[Discriminator], [e#Prey].[Name], [e#Prey].[EagleId], [e#Prey].[IsFlightless], [e#Prey].[Group], [e#Prey].[FoundOn] +FROM ([Animal] AS [e#Prey] +INNER JOIN ( + SELECT TOP 1 [e0].[Species] + FROM [Animal] AS [e0] + WHERE [e0].[Discriminator] = 'Eagle' + ORDER BY [e0].[Species] +) AS [t] ON [e#Prey].[EagleId] = [t].[Species]) +WHERE [e#Prey].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Species]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceJetTest.Can_include_animals() : + AssertSql( + @"SELECT [c].[Id], [c].[Name] +FROM [Country] AS [c] +ORDER BY [c].[Name], [c].[Id]", + // + @"SELECT [c#Animals].[Species], [c#Animals].[CountryId], [c#Animals].[Discriminator], [c#Animals].[Name], [c#Animals].[EagleId], [c#Animals].[IsFlightless], [c#Animals].[Group], [c#Animals].[FoundOn] +FROM ([Animal] AS [c#Animals] +INNER JOIN ( + SELECT [c0].[Id], [c0].[Name] + FROM [Country] AS [c0] +) AS [t] ON [c#Animals].[CountryId] = [t].[Id]) +WHERE [c#Animals].[Discriminator] IN ('Kiwi', 'Eagle') +ORDER BY [t].[Name], [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_reference_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedReferenceBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentReference].* + FROM [BaseReferenceOnBase] AS [e#ParentReference] + WHERE [e#ParentReference].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[ParentReferenceId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentReference#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentReference#BaseParent] + WHERE [e#ParentReference#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#CollectionOnBase].[Id], [e#CollectionOnBase].[Name], [e#CollectionOnBase].[ParentId] +FROM ([CollectionOnBase] AS [e#CollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#CollectionOnBase].[ParentId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#BaseReferenceOnDerived] + WHERE [e#BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [t].[Id]", + // + @"SELECT [e#BaseReferenceOnBase#NestedCollection].[Id], [e#BaseReferenceOnBase#NestedCollection].[Discriminator], [e#BaseReferenceOnBase#NestedCollection].[Name], [e#BaseReferenceOnBase#NestedCollection].[ParentCollectionId], [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseReferenceOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [t0].[Id] + FROM ([BaseInheritanceRelationshipEntity] AS [e0] + LEFT JOIN ( + SELECT [e#BaseReferenceOnBase0].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase0] + WHERE [e#BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') + ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId]) + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t1] ON [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] = [t1].[Id]) +WHERE [e#BaseReferenceOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_with_filter() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection3() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [t].[Id]", + // + @"SELECT [e#BaseReferenceOnBase#NestedCollection].[Id], [e#BaseReferenceOnBase#NestedCollection].[Discriminator], [e#BaseReferenceOnBase#NestedCollection].[Name], [e#BaseReferenceOnBase#NestedCollection].[ParentCollectionId], [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseReferenceOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [t0].[Id] + FROM ([BaseInheritanceRelationshipEntity] AS [e0] + LEFT JOIN ( + SELECT [e#BaseReferenceOnBase0].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase0] + WHERE [e#BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') + ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId]) + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t1] ON [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] = [t1].[Id]) +WHERE [e#BaseReferenceOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_with_filter() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) +ORDER BY [e].[Id]", + // + @"SELECT [e#CollectionOnBase].[Id], [e#CollectionOnBase].[Name], [e#CollectionOnBase].[ParentId] +FROM ([CollectionOnBase] AS [e#CollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#CollectionOnBase].[ParentId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnDerived].[Id], [e#ReferenceOnDerived].[Name], [e#ReferenceOnDerived].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnDerived] AS [e#ReferenceOnDerived] ON [e].[Id] = [e#ReferenceOnDerived].[ParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#BaseReferenceOnDerived] + WHERE [e#BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_reference3() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[ParentCollectionId], [t0].[ParentReferenceId] +FROM (([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase#NestedReference].* + FROM [NestedReferenceBase] AS [e#BaseReferenceOnBase#NestedReference] + WHERE [e#BaseReferenceOnBase#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t0] ON [t].[Id] = [t0].[ParentReferenceId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_self_refence_with_inheritence_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseSelfRerefenceOnDerived].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseSelfRerefenceOnDerived] + WHERE [e#BaseSelfRerefenceOnDerived].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseId] = [t].[Id]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([CollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter4() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#DerivedReferenceOnDerived] + WHERE [e#DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' +) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_collection_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedProperty], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedCollectionBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentCollection].* + FROM [BaseCollectionOnBase] AS [e#ParentCollection] + WHERE [e#ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t] ON [e].[ParentCollectionId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentCollection#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentCollection#BaseParent] + WHERE [e#ParentCollection#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived4() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#DerivedReferenceOnDerived] + WHERE [e#DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' +) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnDerived].[Id], [e#BaseCollectionOnDerived].[Discriminator], [e#BaseCollectionOnDerived].[Name], [e#BaseCollectionOnDerived].[ParentId], [e#BaseCollectionOnDerived].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseCollectionOnDerived] AS [e#BaseCollectionOnDerived] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnDerived].[ParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnDerived].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_collection_reference_on_non_entity_base() : + AssertSql( + @"SELECT [e].[Id], [e].[Name] +FROM [ReferencedEntity] AS [e] +ORDER BY [e].[Id]", + // + @"SELECT [e#Principals].[Id], [e#Principals].[Name], [e#Principals].[ReferenceId], [e#Principals].[ReferencedEntityId], [p#Reference].[Id], [p#Reference].[Name] +FROM (([PrincipalEntity] AS [e#Principals] +LEFT JOIN [ReferencedEntity] AS [p#Reference] ON [e#Principals].[ReferenceId] = [p#Reference].[Id]) +INNER JOIN ( + SELECT [e0].[Id] + FROM [ReferencedEntity] AS [e0] +) AS [t] ON [e#Principals].[ReferencedEntityId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentId], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_self_refence_with_inheritence() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedSefReferenceOnBase].* + FROM [BaseInheritanceRelationshipEntity] AS [e#DerivedSefReferenceOnBase] + WHERE [e#DerivedSefReferenceOnBase].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[Id] = [t].[BaseId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedCollectionBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentReference].* + FROM [BaseReferenceOnBase] AS [e#ParentReference] + WHERE [e#ParentReference].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[ParentReferenceId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentReference#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentReference#BaseParent] + WHERE [e#ParentReference#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_reference_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedProperty], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedReferenceBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentCollection].* + FROM [BaseCollectionOnBase] AS [e#ParentCollection] + WHERE [e#ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t] ON [e].[ParentCollectionId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentCollection#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentCollection#BaseParent] + WHERE [e#ParentCollection#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_reference1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[ParentCollectionId], [t0].[ParentReferenceId] +FROM (([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase#NestedReference].* + FROM [NestedReferenceBase] AS [e#BaseReferenceOnBase#NestedReference] + WHERE [e#BaseReferenceOnBase#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t0] ON [t].[Id] = [t0].[ParentReferenceId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([CollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_reference1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[ParentCollectionId], [t].[ParentReferenceId] +FROM (([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +LEFT JOIN ( + SELECT [b#NestedReference].* + FROM [NestedReferenceBase] AS [b#NestedReference] + WHERE [b#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t] ON [e#BaseCollectionOnBase].[Id] = [t].[ParentCollectionId]) +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [e#BaseCollectionOnBase].[BaseParentId] = [t0].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t0].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_collection1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id], [e#BaseCollectionOnBase].[Id]", + // + @"SELECT [e#BaseCollectionOnBase#NestedCollection].[Id], [e#BaseCollectionOnBase#NestedCollection].[Discriminator], [e#BaseCollectionOnBase#NestedCollection].[Name], [e#BaseCollectionOnBase#NestedCollection].[ParentCollectionId], [e#BaseCollectionOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseCollectionOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [e#BaseCollectionOnBase0].[Id], [t0].[Id] AS [Id0] + FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase0] + INNER JOIN ( + SELECT [e1].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e1] + WHERE [e1].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') + ) AS [t0] ON [e#BaseCollectionOnBase0].[BaseParentId] = [t0].[Id]) + WHERE [e#BaseCollectionOnBase0].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t1] ON [e#BaseCollectionOnBase#NestedCollection].[ParentCollectionId] = [t1].[Id]) +WHERE [e#BaseCollectionOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id0], [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_reference_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedReferenceBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentReference].* + FROM [BaseReferenceOnBase] AS [e#ParentReference] + WHERE [e#ParentReference].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[ParentReferenceId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentReference#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentReference#BaseParent] + WHERE [e#ParentReference#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#CollectionOnBase].[Id], [e#CollectionOnBase].[Name], [e#CollectionOnBase].[ParentId] +FROM ([CollectionOnBase] AS [e#CollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#CollectionOnBase].[ParentId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#BaseReferenceOnDerived] + WHERE [e#BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [t].[Id]", + // + @"SELECT [e#BaseReferenceOnBase#NestedCollection].[Id], [e#BaseReferenceOnBase#NestedCollection].[Discriminator], [e#BaseReferenceOnBase#NestedCollection].[Name], [e#BaseReferenceOnBase#NestedCollection].[ParentCollectionId], [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseReferenceOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [t0].[Id] + FROM ([BaseInheritanceRelationshipEntity] AS [e0] + LEFT JOIN ( + SELECT [e#BaseReferenceOnBase0].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase0] + WHERE [e#BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') + ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId]) + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t1] ON [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] = [t1].[Id]) +WHERE [e#BaseReferenceOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_with_filter() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection3() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [t].[Id]", + // + @"SELECT [e#BaseReferenceOnBase#NestedCollection].[Id], [e#BaseReferenceOnBase#NestedCollection].[Discriminator], [e#BaseReferenceOnBase#NestedCollection].[Name], [e#BaseReferenceOnBase#NestedCollection].[ParentCollectionId], [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseReferenceOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [t0].[Id] + FROM ([BaseInheritanceRelationshipEntity] AS [e0] + LEFT JOIN ( + SELECT [e#BaseReferenceOnBase0].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase0] + WHERE [e#BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') + ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId]) + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t1] ON [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] = [t1].[Id]) +WHERE [e#BaseReferenceOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_with_filter() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) +ORDER BY [e].[Id]", + // + @"SELECT [e#CollectionOnBase].[Id], [e#CollectionOnBase].[Name], [e#CollectionOnBase].[ParentId] +FROM ([CollectionOnBase] AS [e#CollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#CollectionOnBase].[ParentId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnDerived].[Id], [e#ReferenceOnDerived].[Name], [e#ReferenceOnDerived].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnDerived] AS [e#ReferenceOnDerived] ON [e].[Id] = [e#ReferenceOnDerived].[ParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#BaseReferenceOnDerived] + WHERE [e#BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_reference3() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[ParentCollectionId], [t0].[ParentReferenceId] +FROM (([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase#NestedReference].* + FROM [NestedReferenceBase] AS [e#BaseReferenceOnBase#NestedReference] + WHERE [e#BaseReferenceOnBase#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t0] ON [t].[Id] = [t0].[ParentReferenceId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_self_refence_with_inheritence_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseSelfRerefenceOnDerived].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseSelfRerefenceOnDerived] + WHERE [e#BaseSelfRerefenceOnDerived].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseId] = [t].[Id]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([CollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter4() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#DerivedReferenceOnDerived] + WHERE [e#DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' +) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_collection_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedProperty], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedCollectionBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentCollection].* + FROM [BaseCollectionOnBase] AS [e#ParentCollection] + WHERE [e#ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t] ON [e].[ParentCollectionId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentCollection#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentCollection#BaseParent] + WHERE [e#ParentCollection#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived4() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#DerivedReferenceOnDerived] + WHERE [e#DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' +) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnDerived].[Id], [e#BaseCollectionOnDerived].[Discriminator], [e#BaseCollectionOnDerived].[Name], [e#BaseCollectionOnDerived].[ParentId], [e#BaseCollectionOnDerived].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseCollectionOnDerived] AS [e#BaseCollectionOnDerived] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnDerived].[ParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnDerived].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_collection_reference_on_non_entity_base() : + AssertSql( + @"SELECT [e].[Id], [e].[Name] +FROM [ReferencedEntity] AS [e] +ORDER BY [e].[Id]", + // + @"SELECT [e#Principals].[Id], [e#Principals].[Name], [e#Principals].[ReferenceId], [e#Principals].[ReferencedEntityId], [p#Reference].[Id], [p#Reference].[Name] +FROM (([PrincipalEntity] AS [e#Principals] +LEFT JOIN [ReferencedEntity] AS [p#Reference] ON [e#Principals].[ReferenceId] = [p#Reference].[Id]) +INNER JOIN ( + SELECT [e0].[Id] + FROM [ReferencedEntity] AS [e0] +) AS [t] ON [e#Principals].[ReferencedEntityId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentId], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_self_refence_with_inheritence() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedSefReferenceOnBase].* + FROM [BaseInheritanceRelationshipEntity] AS [e#DerivedSefReferenceOnBase] + WHERE [e#DerivedSefReferenceOnBase].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[Id] = [t].[BaseId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedCollectionBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentReference].* + FROM [BaseReferenceOnBase] AS [e#ParentReference] + WHERE [e#ParentReference].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[ParentReferenceId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentReference#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentReference#BaseParent] + WHERE [e#ParentReference#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_reference_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedProperty], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedReferenceBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentCollection].* + FROM [BaseCollectionOnBase] AS [e#ParentCollection] + WHERE [e#ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t] ON [e].[ParentCollectionId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentCollection#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentCollection#BaseParent] + WHERE [e#ParentCollection#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_reference1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[ParentCollectionId], [t0].[ParentReferenceId] +FROM (([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase#NestedReference].* + FROM [NestedReferenceBase] AS [e#BaseReferenceOnBase#NestedReference] + WHERE [e#BaseReferenceOnBase#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t0] ON [t].[Id] = [t0].[ParentReferenceId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([CollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_reference1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[ParentCollectionId], [t].[ParentReferenceId] +FROM (([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +LEFT JOIN ( + SELECT [b#NestedReference].* + FROM [NestedReferenceBase] AS [b#NestedReference] + WHERE [b#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t] ON [e#BaseCollectionOnBase].[Id] = [t].[ParentCollectionId]) +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [e#BaseCollectionOnBase].[BaseParentId] = [t0].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t0].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_collection1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id], [e#BaseCollectionOnBase].[Id]", + // + @"SELECT [e#BaseCollectionOnBase#NestedCollection].[Id], [e#BaseCollectionOnBase#NestedCollection].[Discriminator], [e#BaseCollectionOnBase#NestedCollection].[Name], [e#BaseCollectionOnBase#NestedCollection].[ParentCollectionId], [e#BaseCollectionOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseCollectionOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [e#BaseCollectionOnBase0].[Id], [t0].[Id] AS [Id0] + FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase0] + INNER JOIN ( + SELECT [e1].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e1] + WHERE [e1].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') + ) AS [t0] ON [e#BaseCollectionOnBase0].[BaseParentId] = [t0].[Id]) + WHERE [e#BaseCollectionOnBase0].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t1] ON [e#BaseCollectionOnBase#NestedCollection].[ParentCollectionId] = [t1].[Id]) +WHERE [e#BaseCollectionOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id0], [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#CollectionOnBase].[Id], [e#CollectionOnBase].[Name], [e#CollectionOnBase].[ParentId] +FROM ([CollectionOnBase] AS [e#CollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#CollectionOnBase].[ParentId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#BaseReferenceOnDerived] + WHERE [e#BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_reference_collection1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [t].[Id]", + // + @"SELECT [e#BaseReferenceOnBase#NestedCollection].[Id], [e#BaseReferenceOnBase#NestedCollection].[Discriminator], [e#BaseReferenceOnBase#NestedCollection].[Name], [e#BaseReferenceOnBase#NestedCollection].[ParentCollectionId], [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseReferenceOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [t0].[Id] + FROM ([BaseInheritanceRelationshipEntity] AS [e0] + LEFT JOIN ( + SELECT [e#BaseReferenceOnBase0].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase0] + WHERE [e#BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') + ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId]) + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t1] ON [e#BaseReferenceOnBase#NestedCollection].[ParentReferenceId] = [t1].[Id]) +WHERE [e#BaseReferenceOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_with_filter() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnBase].[Id], [e#ReferenceOnBase].[Name], [e#ReferenceOnBase].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnBase] AS [e#ReferenceOnBase] ON [e].[Id] = [e#ReferenceOnBase].[ParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_with_filter() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) +ORDER BY [e].[Id]", + // + @"SELECT [e#CollectionOnBase].[Id], [e#CollectionOnBase].[Name], [e#CollectionOnBase].[ParentId] +FROM ([CollectionOnBase] AS [e#CollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#CollectionOnBase].[ParentId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e#ReferenceOnDerived].[Id], [e#ReferenceOnDerived].[Name], [e#ReferenceOnDerived].[ParentId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN [ReferenceOnDerived] AS [e#ReferenceOnDerived] ON [e].[Id] = [e#ReferenceOnDerived].[ParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#BaseReferenceOnDerived] + WHERE [e#BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_self_refence_with_inheritence_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseSelfRerefenceOnDerived].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseSelfRerefenceOnDerived] + WHERE [e#BaseSelfRerefenceOnDerived].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseId] = [t].[Id]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([CollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter4() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#DerivedReferenceOnDerived] + WHERE [e#DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' +) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_collection_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedProperty], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedCollectionBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentCollection].* + FROM [BaseCollectionOnBase] AS [e#ParentCollection] + WHERE [e#ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t] ON [e].[ParentCollectionId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentCollection#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentCollection#BaseParent] + WHERE [e#ParentCollection#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_without_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([ReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id])"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived4() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedReferenceOnDerived].* + FROM [BaseReferenceOnDerived] AS [e#DerivedReferenceOnDerived] + WHERE [e#DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' +) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId]) +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived2() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnDerived].[Id], [e#BaseCollectionOnDerived].[Discriminator], [e#BaseCollectionOnDerived].[Name], [e#BaseCollectionOnDerived].[ParentId], [e#BaseCollectionOnDerived].[DerivedInheritanceRelationshipEntityId] +FROM ([BaseCollectionOnDerived] AS [e#BaseCollectionOnDerived] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnDerived].[ParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnDerived].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_collection_reference_on_non_entity_base() : + AssertSql( + @"SELECT [e].[Id], [e].[Name] +FROM [ReferencedEntity] AS [e] +ORDER BY [e].[Id]", + // + @"SELECT [e#Principals].[Id], [e#Principals].[Name], [e#Principals].[ReferenceId], [e#Principals].[ReferencedEntityId], [p#Reference].[Id], [p#Reference].[Name] +FROM (([PrincipalEntity] AS [e#Principals] +LEFT JOIN [ReferencedEntity] AS [p#Reference] ON [e#Principals].[ReferenceId] = [p#Reference].[Id]) +INNER JOIN ( + SELECT [e0].[Id] + FROM [ReferencedEntity] AS [e0] +) AS [t] ON [e#Principals].[ReferencedEntityId] = [t].[Id]) +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_with_filter1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#BaseReferenceOnBase].* + FROM [BaseReferenceOnBase] AS [e#BaseReferenceOnBase] + WHERE [e#BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') +) AS [t] ON [e].[Id] = [t].[BaseParentId]) +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentId], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseCollectionOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_self_refence_with_inheritence() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseInheritanceRelationshipEntity] AS [e] +LEFT JOIN ( + SELECT [e#DerivedSefReferenceOnBase].* + FROM [BaseInheritanceRelationshipEntity] AS [e#DerivedSefReferenceOnBase] + WHERE [e#DerivedSefReferenceOnBase].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[Id] = [t].[BaseId]) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_reference_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[ParentCollectionId], [e].[ParentReferenceId], [t].[Id], [t].[BaseParentId], [t].[Discriminator], [t].[Name], [t].[DerivedProperty], [t0].[Id], [t0].[Discriminator], [t0].[Name], [t0].[BaseId] +FROM (([NestedReferenceBase] AS [e] +LEFT JOIN ( + SELECT [e#ParentCollection].* + FROM [BaseCollectionOnBase] AS [e#ParentCollection] + WHERE [e#ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t] ON [e].[ParentCollectionId] = [t].[Id]) +LEFT JOIN ( + SELECT [e#ParentCollection#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#ParentCollection#BaseParent] + WHERE [e#ParentCollection#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [t].[BaseParentId] = [t0].[Id]) +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_with_inheritance1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_on_derived_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [e].[DerivedInheritanceRelationshipEntityId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnDerived] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_reference_with_inheritance_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[BaseParentId], [e].[Discriminator], [e].[Name], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([BaseReferenceOnBase] AS [e] +LEFT JOIN ( + SELECT [e#BaseParent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#BaseParent] + WHERE [e#BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[BaseParentId] = [t].[Id]) +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase')"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Include_collection_without_inheritance_with_filter_reverse() : + AssertSql( + @"SELECT [e].[Id], [e].[Name], [e].[ParentId], [t].[Id], [t].[Discriminator], [t].[Name], [t].[BaseId] +FROM ([CollectionOnBase] AS [e] +LEFT JOIN ( + SELECT [e#Parent].* + FROM [BaseInheritanceRelationshipEntity] AS [e#Parent] + WHERE [e#Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e].[ParentId] = [t].[Id]) +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_reference1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[ParentCollectionId], [t].[ParentReferenceId] +FROM (([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +LEFT JOIN ( + SELECT [b#NestedReference].* + FROM [NestedReferenceBase] AS [b#NestedReference] + WHERE [b#NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t] ON [e#BaseCollectionOnBase].[Id] = [t].[ParentCollectionId]) +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [e#BaseCollectionOnBase].[BaseParentId] = [t0].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t0].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.InheritanceRelationshipsQueryJetTest.Nested_include_with_inheritance_collection_collection1() : + AssertSql( + @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] +FROM [BaseInheritanceRelationshipEntity] AS [e] +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +ORDER BY [e].[Id]", + // + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase] +INNER JOIN ( + SELECT [e0].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e0] + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id]) +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id], [e#BaseCollectionOnBase].[Id]", + // + @"SELECT [e#BaseCollectionOnBase#NestedCollection].[Id], [e#BaseCollectionOnBase#NestedCollection].[Discriminator], [e#BaseCollectionOnBase#NestedCollection].[Name], [e#BaseCollectionOnBase#NestedCollection].[ParentCollectionId], [e#BaseCollectionOnBase#NestedCollection].[ParentReferenceId] +FROM ([NestedCollectionBase] AS [e#BaseCollectionOnBase#NestedCollection] +INNER JOIN ( + SELECT DISTINCT [e#BaseCollectionOnBase0].[Id], [t0].[Id] AS [Id0] + FROM ([BaseCollectionOnBase] AS [e#BaseCollectionOnBase0] + INNER JOIN ( + SELECT [e1].[Id] + FROM [BaseInheritanceRelationshipEntity] AS [e1] + WHERE [e1].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') + ) AS [t0] ON [e#BaseCollectionOnBase0].[BaseParentId] = [t0].[Id]) + WHERE [e#BaseCollectionOnBase0].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +) AS [t1] ON [e#BaseCollectionOnBase#NestedCollection].[ParentCollectionId] = [t1].[Id]) +WHERE [e#BaseCollectionOnBase#NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') +ORDER BY [t1].[Id0], [t1].[Id]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM ((([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM ((([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_1='5' +@__p_0='10' + +SELECT TOP @__p_1+@__p_0 [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] + SKIP @__p_0", + // + @"@__p_1='5' +@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_1+@__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_1='5' +@__p_0='10' + +SELECT TOP @__p_1+@__p_0 [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] + SKIP @__p_0", + // + @"@__p_1='5' +@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_1+@__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [c2].[CustomerID], [c2].[Address], [c2].[City], [c2].[CompanyName], [c2].[ContactName], [c2].[ContactTitle], [c2].[Country], [c2].[Fax], [c2].[Phone], [c2].[PostalCode], [c2].[Region] +FROM ( + SELECT TOP @__p_0 [c].* + FROM [Customers] AS [c] + ORDER BY [c].[CustomerID] +) AS [t] +, [Customers] AS [c2] +ORDER BY [c2].[CustomerID]", + // + @"@__p_0='5' + +SELECT [c2#Orders].[OrderID], [c2#Orders].[CustomerID], [c2#Orders].[EmployeeID], [c2#Orders].[OrderDate] +FROM ([Orders] AS [c2#Orders] +INNER JOIN ( + SELECT DISTINCT [c20].[CustomerID] + FROM ( + SELECT TOP @__p_0 [c0].* + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + ) AS [t0] + , [Customers] AS [c20] +) AS [t1] ON [c2#Orders].[CustomerID] = [t1].[CustomerID]) +ORDER BY [t1].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [c2].[CustomerID], [c2].[Address], [c2].[City], [c2].[CompanyName], [c2].[ContactName], [c2].[ContactTitle], [c2].[Country], [c2].[Fax], [c2].[Phone], [c2].[PostalCode], [c2].[Region] +FROM ( + SELECT TOP @__p_0 [c].* + FROM [Customers] AS [c] + ORDER BY [c].[CustomerID] +) AS [t] +, [Customers] AS [c2] +ORDER BY [c2].[CustomerID]", + // + @"@__p_0='5' + +SELECT [c2#Orders].[OrderID], [c2#Orders].[CustomerID], [c2#Orders].[EmployeeID], [c2#Orders].[OrderDate] +FROM ([Orders] AS [c2#Orders] +INNER JOIN ( + SELECT DISTINCT [c20].[CustomerID] + FROM ( + SELECT TOP @__p_0 [c0].* + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + ) AS [t0] + , [Customers] AS [c20] +) AS [t1] ON [c2#Orders].[CustomerID] = [t1].[CustomerID]) +ORDER BY [t1].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT [o0].[OrderID] + FROM [Orders] AS [o0] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT [o0].[OrderID] + FROM [Orders] AS [o0] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM ([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM ([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_order_by_and_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID], [c0].[City] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_order_by_and_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID], [c0].[City] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_then_include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID], [c#Orders].[OrderID]", + // + @"SELECT [c#Orders#OrderDetails].[OrderID], [c#Orders#OrderDetails].[ProductID], [c#Orders#OrderDetails].[Discount], [c#Orders#OrderDetails].[Quantity], [c#Orders#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [c#Orders#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [c#Orders0].[OrderID], [t0].[CustomerID] + FROM ([Orders] AS [c#Orders0] + INNER JOIN ( + SELECT [c1].[CustomerID] + FROM [Customers] AS [c1] + ) AS [t0] ON [c#Orders0].[CustomerID] = [t0].[CustomerID]) +) AS [t1] ON [c#Orders#OrderDetails].[OrderID] = [t1].[OrderID]) +ORDER BY [t1].[CustomerID], [t1].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_then_include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID], [c#Orders].[OrderID]", + // + @"SELECT [c#Orders#OrderDetails].[OrderID], [c#Orders#OrderDetails].[ProductID], [c#Orders#OrderDetails].[Discount], [c#Orders#OrderDetails].[Quantity], [c#Orders#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [c#Orders#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [c#Orders0].[OrderID], [t0].[CustomerID] + FROM ([Orders] AS [c#Orders0] + INNER JOIN ( + SELECT [c1].[CustomerID] + FROM [Customers] AS [c1] + ) AS [t0] ON [c#Orders0].[CustomerID] = [t0].[CustomerID]) +) AS [t1] ON [c#Orders#OrderDetails].[OrderID] = [t1].[OrderID]) +ORDER BY [t1].[CustomerID], [t1].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_first_or_default(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_first_or_default(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter_reordered(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter_reordered(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter_reordered(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter_reordered(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_and_collection(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [o0].[OrderID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_and_collection(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [o0].[OrderID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_when_groupby(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_when_groupby(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last_no_orderby(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last_no_orderby(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_list(Boolean useString) : + AssertSql( + @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[UnitPrice], [p].[UnitsInStock] +FROM [Products] AS [p] +ORDER BY [p].[ProductID]", + // + @"SELECT [p#OrderDetails].[OrderID], [p#OrderDetails].[ProductID], [p#OrderDetails].[Discount], [p#OrderDetails].[Quantity], [p#OrderDetails].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [p#OrderDetails] +INNER JOIN [Orders] AS [o#Order] ON [p#OrderDetails].[OrderID] = [o#Order].[OrderID]) +INNER JOIN ( + SELECT [p0].[ProductID] + FROM [Products] AS [p0] +) AS [t] ON [p#OrderDetails].[ProductID] = [t].[ProductID]) +ORDER BY [t].[ProductID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_list(Boolean useString) : + AssertSql( + @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[UnitPrice], [p].[UnitsInStock] +FROM [Products] AS [p] +ORDER BY [p].[ProductID]", + // + @"SELECT [p#OrderDetails].[OrderID], [p#OrderDetails].[ProductID], [p#OrderDetails].[Discount], [p#OrderDetails].[Quantity], [p#OrderDetails].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [p#OrderDetails] +INNER JOIN [Orders] AS [o#Order] ON [p#OrderDetails].[OrderID] = [o#Order].[OrderID]) +INNER JOIN ( + SELECT [p0].[ProductID] + FROM [Products] AS [p0] +) AS [t] ON [p#OrderDetails].[ProductID] = [t].[ProductID]) +ORDER BY [t].[ProductID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level_reverse(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM ((([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level_reverse(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM ((([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_conditional_order_by(Boolean useString) : + AssertSql( + @"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].[CustomerID] LIKE 'S' + '%', + 1, + 2 +), [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], IIf( + [c0].[CustomerID] LIKE 'S' + '%', + 1, + 2 + ) AS [c] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[c], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_conditional_order_by(Boolean useString) : + AssertSql( + @"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].[CustomerID] LIKE 'S' + '%', + 1, + 2 +), [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], IIf( + [c0].[CustomerID] LIKE 'S' + '%', + 1, + 2 + ) AS [c] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[c], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='5' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='5' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_skip(Boolean useString) : + AssertSql( + @"@__p_0='80' + +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] + SKIP @__p_0", + // + @"@__p_0='80' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[ContactName] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactName], [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactName], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_skip(Boolean useString) : + AssertSql( + @"@__p_0='80' + +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] + SKIP @__p_0", + // + @"@__p_0='80' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[ContactName] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactName], [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactName], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] +FROM ( + SELECT TOP @__p_0 [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] +) AS [t] +, [Customers] AS [c2]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] +FROM ( + SELECT TOP @__p_0 [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] +) AS [t] +, [Customers] AS [c2]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_collection_and_then_include_reference_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[OrderID] = 10248 +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM (([Order Details] AS [o#OrderDetails] +INNER JOIN [Products] AS [o#Product] ON [o#OrderDetails].[ProductID] = [o#Product].[ProductID]) +INNER JOIN ( + SELECT TOP 1 [o0].[OrderID] + FROM [Orders] AS [o0] + WHERE [o0].[OrderID] = 10248 + ORDER BY [o0].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_collection_and_then_include_reference_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[OrderID] = 10248 +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM (([Order Details] AS [o#OrderDetails] +INNER JOIN [Products] AS [o#Product] ON [o#OrderDetails].[ProductID] = [o#Product].[ProductID]) +INNER JOIN ( + SELECT TOP 1 [o0].[OrderID] + FROM [Orders] AS [o0] + WHERE [o0].[OrderID] = 10248 + ORDER BY [o0].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_reference_and_collection_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[OrderID] = 10248 +ORDER BY [o#Customer].[CustomerID]", + // + @"SELECT [o#Customer#Orders].[OrderID], [o#Customer#Orders].[CustomerID], [o#Customer#Orders].[EmployeeID], [o#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [t].* + FROM ( + SELECT TOP 1 [o#Customer0].[CustomerID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) + WHERE [o0].[OrderID] = 10248 + ORDER BY [o#Customer0].[CustomerID] + ) AS [t] +) AS [t0] ON [o#Customer#Orders].[CustomerID] = [t0].[CustomerID]) +ORDER BY [t0].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_reference_and_collection_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[OrderID] = 10248 +ORDER BY [o#Customer].[CustomerID]", + // + @"SELECT [o#Customer#Orders].[OrderID], [o#Customer#Orders].[CustomerID], [o#Customer#Orders].[EmployeeID], [o#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [t].* + FROM ( + SELECT TOP 1 [o#Customer0].[CustomerID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) + WHERE [o0].[OrderID] = 10248 + ORDER BY [o#Customer0].[CustomerID] + ) AS [t] +) AS [t0] ON [o#Customer#Orders].[CustomerID] = [t0].[CustomerID]) +ORDER BY [t0].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_and_collection_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +ORDER BY [o#Order#Customer].[CustomerID]", + // + @"SELECT [o#Order#Customer#Orders].[OrderID], [o#Order#Customer#Orders].[CustomerID], [o#Order#Customer#Orders].[EmployeeID], [o#Order#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Order#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [o#Order#Customer0].[CustomerID] + FROM (([Order Details] AS [o0] + INNER JOIN [Orders] AS [o#Order0] ON [o0].[OrderID] = [o#Order0].[OrderID]) + LEFT JOIN [Customers] AS [o#Order#Customer0] ON [o#Order0].[CustomerID] = [o#Order#Customer0].[CustomerID]) +) AS [t] ON [o#Order#Customer#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_and_collection_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +ORDER BY [o#Order#Customer].[CustomerID]", + // + @"SELECT [o#Order#Customer#Orders].[OrderID], [o#Order#Customer#Orders].[CustomerID], [o#Order#Customer#Orders].[EmployeeID], [o#Order#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Order#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [o#Order#Customer0].[CustomerID] + FROM (([Order Details] AS [o0] + INNER JOIN [Orders] AS [o#Order0] ON [o0].[OrderID] = [o#Order0].[OrderID]) + LEFT JOIN [Customers] AS [o#Order#Customer0] ON [o#Order0].[CustomerID] = [o#Order#Customer0].[CustomerID]) +) AS [t] ON [o#Order#Customer#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[ContactTitle] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactTitle], [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactTitle], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[ContactTitle] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactTitle], [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactTitle], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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] DESC, [c].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + ORDER BY [c0].[City] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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] DESC, [c].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + ORDER BY [c0].[City] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_where_skip_take_projection(Boolean useString) : + AssertSql( + @"@__p_1='2' +@__p_0='1' + +SELECT TOP @__p_1+@__p_0 [od#Order].[CustomerID] +FROM ([Order Details] AS [od] +INNER JOIN [Orders] AS [od#Order] ON [od].[OrderID] = [od#Order].[OrderID]) +WHERE [od].[Quantity] = 10 +ORDER BY [od].[OrderID], [od].[ProductID] + SKIP @__p_0"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_where_skip_take_projection(Boolean useString) : + AssertSql( + @"@__p_1='2' +@__p_0='1' + +SELECT TOP @__p_1+@__p_0 [od#Order].[CustomerID] +FROM ([Order Details] AS [od] +INNER JOIN [Orders] AS [od#Order] ON [od].[OrderID] = [od#Order].[OrderID]) +WHERE [od].[Quantity] = 10 +ORDER BY [od].[OrderID], [od].[ProductID] + SKIP @__p_0"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +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] + SKIP @__p_0", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +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] + SKIP @__p_0", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause_with_filter(Boolean useString) : + AssertSql( + @"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 [c1] +, [Customers] AS [c] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM [Customers] AS [c10] + , [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause_with_filter(Boolean useString) : + AssertSql( + @"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 [c1] +, [Customers] AS [c] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM [Customers] AS [c10] + , [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM ((([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM ((([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_1='5' +@__p_0='10' + +SELECT TOP @__p_1+@__p_0 [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] + SKIP @__p_0", + // + @"@__p_1='5' +@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_1+@__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_1='5' +@__p_0='10' + +SELECT TOP @__p_1+@__p_0 [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] + SKIP @__p_0", + // + @"@__p_1='5' +@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_1+@__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [c2].[CustomerID], [c2].[Address], [c2].[City], [c2].[CompanyName], [c2].[ContactName], [c2].[ContactTitle], [c2].[Country], [c2].[Fax], [c2].[Phone], [c2].[PostalCode], [c2].[Region] +FROM ( + SELECT TOP @__p_0 [c].* + FROM [Customers] AS [c] + ORDER BY [c].[CustomerID] +) AS [t] +, [Customers] AS [c2] +ORDER BY [c2].[CustomerID]", + // + @"@__p_0='5' + +SELECT [c2#Orders].[OrderID], [c2#Orders].[CustomerID], [c2#Orders].[EmployeeID], [c2#Orders].[OrderDate] +FROM ([Orders] AS [c2#Orders] +INNER JOIN ( + SELECT DISTINCT [c20].[CustomerID] + FROM ( + SELECT TOP @__p_0 [c0].* + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + ) AS [t0] + , [Customers] AS [c20] +) AS [t1] ON [c2#Orders].[CustomerID] = [t1].[CustomerID]) +ORDER BY [t1].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [c2].[CustomerID], [c2].[Address], [c2].[City], [c2].[CompanyName], [c2].[ContactName], [c2].[ContactTitle], [c2].[Country], [c2].[Fax], [c2].[Phone], [c2].[PostalCode], [c2].[Region] +FROM ( + SELECT TOP @__p_0 [c].* + FROM [Customers] AS [c] + ORDER BY [c].[CustomerID] +) AS [t] +, [Customers] AS [c2] +ORDER BY [c2].[CustomerID]", + // + @"@__p_0='5' + +SELECT [c2#Orders].[OrderID], [c2#Orders].[CustomerID], [c2#Orders].[EmployeeID], [c2#Orders].[OrderDate] +FROM ([Orders] AS [c2#Orders] +INNER JOIN ( + SELECT DISTINCT [c20].[CustomerID] + FROM ( + SELECT TOP @__p_0 [c0].* + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + ) AS [t0] + , [Customers] AS [c20] +) AS [t1] ON [c2#Orders].[CustomerID] = [t1].[CustomerID]) +ORDER BY [t1].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT [o0].[OrderID] + FROM [Orders] AS [o0] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT [o0].[OrderID] + FROM [Orders] AS [o0] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM ([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_alias_generation(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM ([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_order_by_and_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID], [c0].[City] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_order_by_and_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID], [c0].[City] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_join_clause_with_filter(Boolean useString) : + AssertSql( + @"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] +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]) +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM ([Customers] AS [c0] + INNER JOIN [Orders] AS [o0] ON [c0].[CustomerID] = [o0].[CustomerID]) + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_then_include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID], [c#Orders].[OrderID]", + // + @"SELECT [c#Orders#OrderDetails].[OrderID], [c#Orders#OrderDetails].[ProductID], [c#Orders#OrderDetails].[Discount], [c#Orders#OrderDetails].[Quantity], [c#Orders#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [c#Orders#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [c#Orders0].[OrderID], [t0].[CustomerID] + FROM ([Orders] AS [c#Orders0] + INNER JOIN ( + SELECT [c1].[CustomerID] + FROM [Customers] AS [c1] + ) AS [t0] ON [c#Orders0].[CustomerID] = [t0].[CustomerID]) +) AS [t1] ON [c#Orders#OrderDetails].[OrderID] = [t1].[OrderID]) +ORDER BY [t1].[CustomerID], [t1].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_then_include_collection(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID], [c#Orders].[OrderID]", + // + @"SELECT [c#Orders#OrderDetails].[OrderID], [c#Orders#OrderDetails].[ProductID], [c#Orders#OrderDetails].[Discount], [c#Orders#OrderDetails].[Quantity], [c#Orders#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [c#Orders#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [c#Orders0].[OrderID], [t0].[CustomerID] + FROM ([Orders] AS [c#Orders0] + INNER JOIN ( + SELECT [c1].[CustomerID] + FROM [Customers] AS [c1] + ) AS [t0] ON [c#Orders0].[CustomerID] = [t0].[CustomerID]) +) AS [t1] ON [c#Orders#OrderDetails].[OrderID] = [t1].[OrderID]) +ORDER BY [t1].[CustomerID], [t1].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_first_or_default(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_first_or_default(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter_reordered(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter_reordered(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_take_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter_reordered(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter_reordered(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_and_collection(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [o0].[OrderID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_and_collection(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM ([Order Details] AS [o#OrderDetails] +INNER JOIN ( + SELECT DISTINCT [o0].[OrderID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_when_groupby(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_when_groupby(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[City], [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last_no_orderby(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last_no_orderby(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked_as_no_tracking(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [o] +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID]) +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_dependent_already_tracked(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_list(Boolean useString) : + AssertSql( + @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[UnitPrice], [p].[UnitsInStock] +FROM [Products] AS [p] +ORDER BY [p].[ProductID]", + // + @"SELECT [p#OrderDetails].[OrderID], [p#OrderDetails].[ProductID], [p#OrderDetails].[Discount], [p#OrderDetails].[Quantity], [p#OrderDetails].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [p#OrderDetails] +INNER JOIN [Orders] AS [o#Order] ON [p#OrderDetails].[OrderID] = [o#Order].[OrderID]) +INNER JOIN ( + SELECT [p0].[ProductID] + FROM [Products] AS [p0] +) AS [t] ON [p#OrderDetails].[ProductID] = [t].[ProductID]) +ORDER BY [t].[ProductID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_list(Boolean useString) : + AssertSql( + @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[UnitPrice], [p].[UnitsInStock] +FROM [Products] AS [p] +ORDER BY [p].[ProductID]", + // + @"SELECT [p#OrderDetails].[OrderID], [p#OrderDetails].[ProductID], [p#OrderDetails].[Discount], [p#OrderDetails].[Quantity], [p#OrderDetails].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] +FROM (([Order Details] AS [p#OrderDetails] +INNER JOIN [Orders] AS [o#Order] ON [p#OrderDetails].[OrderID] = [o#Order].[OrderID]) +INNER JOIN ( + SELECT [p0].[ProductID] + FROM [Products] AS [p0] +) AS [t] ON [p#OrderDetails].[ProductID] = [t].[ProductID]) +ORDER BY [t].[ProductID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_filter(Boolean useString) : + AssertSql( + @"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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level_reverse(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM ((([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multiple_references_multi_level_reverse(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM ((([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +INNER JOIN [Products] AS [o#Product] ON [o].[ProductID] = [o#Product].[ProductID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_conditional_order_by(Boolean useString) : + AssertSql( + @"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].[CustomerID] LIKE 'S' + '%', + 1, + 2 +), [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], IIf( + [c0].[CustomerID] LIKE 'S' + '%', + 1, + 2 + ) AS [c] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[c], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_conditional_order_by(Boolean useString) : + AssertSql( + @"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].[CustomerID] LIKE 'S' + '%', + 1, + 2 +), [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], IIf( + [c0].[CustomerID] LIKE 'S' + '%', + 1, + 2 + ) AS [c] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[c], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_key(Boolean useString) : + AssertSql( + @"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]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='5' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_as_no_tracking2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT TOP @__p_0 [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]", + // + @"@__p_0='5' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_principal_already_tracked(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI'", + // + @"SELECT TOP 2 [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] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID] + FROM [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' + ORDER BY [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference_with_filter(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[CustomerID] = 'ALFKI'"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_skip(Boolean useString) : + AssertSql( + @"@__p_0='80' + +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] + SKIP @__p_0", + // + @"@__p_0='80' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[ContactName] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactName], [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactName], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_skip(Boolean useString) : + AssertSql( + @"@__p_0='80' + +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] + SKIP @__p_0", + // + @"@__p_0='80' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID], [c0].[ContactName] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactName], [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactName], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] +FROM ( + SELECT TOP @__p_0 [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] +) AS [t] +, [Customers] AS [c2]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause2(Boolean useString) : + AssertSql( + @"@__p_0='5' + +SELECT [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] +FROM ( + SELECT TOP @__p_0 [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] +) AS [t] +, [Customers] AS [c2]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_collection_and_then_include_reference_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[OrderID] = 10248 +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM (([Order Details] AS [o#OrderDetails] +INNER JOIN [Products] AS [o#Product] ON [o#OrderDetails].[ProductID] = [o#Product].[ProductID]) +INNER JOIN ( + SELECT TOP 1 [o0].[OrderID] + FROM [Orders] AS [o0] + WHERE [o0].[OrderID] = 10248 + ORDER BY [o0].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_collection_and_then_include_reference_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE [o].[OrderID] = 10248 +ORDER BY [o].[OrderID]", + // + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice], [o#Product].[ProductID], [o#Product].[Discontinued], [o#Product].[ProductName], [o#Product].[UnitPrice], [o#Product].[UnitsInStock] +FROM (([Order Details] AS [o#OrderDetails] +INNER JOIN [Products] AS [o#Product] ON [o#OrderDetails].[ProductID] = [o#Product].[ProductID]) +INNER JOIN ( + SELECT TOP 1 [o0].[OrderID] + FROM [Orders] AS [o0] + WHERE [o0].[OrderID] = 10248 + ORDER BY [o0].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID]) +ORDER BY [t].[OrderID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_reference_and_collection_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[OrderID] = 10248 +ORDER BY [o#Customer].[CustomerID]", + // + @"SELECT [o#Customer#Orders].[OrderID], [o#Customer#Orders].[CustomerID], [o#Customer#Orders].[EmployeeID], [o#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [t].* + FROM ( + SELECT TOP 1 [o#Customer0].[CustomerID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) + WHERE [o0].[OrderID] = 10248 + ORDER BY [o#Customer0].[CustomerID] + ) AS [t] +) AS [t0] ON [o#Customer#Orders].[CustomerID] = [t0].[CustomerID]) +ORDER BY [t0].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_multi_level_reference_and_collection_predicate(Boolean useString) : + AssertSql( + @"SELECT TOP 2 [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]) +WHERE [o].[OrderID] = 10248 +ORDER BY [o#Customer].[CustomerID]", + // + @"SELECT [o#Customer#Orders].[OrderID], [o#Customer#Orders].[CustomerID], [o#Customer#Orders].[EmployeeID], [o#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [t].* + FROM ( + SELECT TOP 1 [o#Customer0].[CustomerID] + FROM ([Orders] AS [o0] + LEFT JOIN [Customers] AS [o#Customer0] ON [o0].[CustomerID] = [o#Customer0].[CustomerID]) + WHERE [o0].[OrderID] = 10248 + ORDER BY [o#Customer0].[CustomerID] + ) AS [t] +) AS [t0] ON [o#Customer#Orders].[CustomerID] = [t0].[CustomerID]) +ORDER BY [t0].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_reference(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] +FROM ([Orders] AS [o] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID])"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_and_collection_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +ORDER BY [o#Order#Customer].[CustomerID]", + // + @"SELECT [o#Order#Customer#Orders].[OrderID], [o#Order#Customer#Orders].[CustomerID], [o#Order#Customer#Orders].[EmployeeID], [o#Order#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Order#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [o#Order#Customer0].[CustomerID] + FROM (([Order Details] AS [o0] + INNER JOIN [Orders] AS [o#Order0] ON [o0].[OrderID] = [o#Order0].[OrderID]) + LEFT JOIN [Customers] AS [o#Order#Customer0] ON [o#Order0].[CustomerID] = [o#Order#Customer0].[CustomerID]) +) AS [t] ON [o#Order#Customer#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_references_and_collection_multi_level(Boolean useString) : + AssertSql( + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o#Order#Customer].[CustomerID], [o#Order#Customer].[Address], [o#Order#Customer].[City], [o#Order#Customer].[CompanyName], [o#Order#Customer].[ContactName], [o#Order#Customer].[ContactTitle], [o#Order#Customer].[Country], [o#Order#Customer].[Fax], [o#Order#Customer].[Phone], [o#Order#Customer].[PostalCode], [o#Order#Customer].[Region] +FROM (([Order Details] AS [o] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]) +LEFT JOIN [Customers] AS [o#Order#Customer] ON [o#Order].[CustomerID] = [o#Order#Customer].[CustomerID]) +ORDER BY [o#Order#Customer].[CustomerID]", + // + @"SELECT [o#Order#Customer#Orders].[OrderID], [o#Order#Customer#Orders].[CustomerID], [o#Order#Customer#Orders].[EmployeeID], [o#Order#Customer#Orders].[OrderDate] +FROM ([Orders] AS [o#Order#Customer#Orders] +INNER JOIN ( + SELECT DISTINCT [o#Order#Customer0].[CustomerID] + FROM (([Order Details] AS [o0] + INNER JOIN [Orders] AS [o#Order0] ON [o0].[OrderID] = [o#Order0].[OrderID]) + LEFT JOIN [Customers] AS [o#Order#Customer0] ON [o#Order0].[CustomerID] = [o#Order#Customer0].[CustomerID]) +) AS [t] ON [o#Order#Customer#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[ContactTitle] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactTitle], [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactTitle], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_order_by_non_key_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[ContactTitle] + FROM [Customers] AS [c0] + ORDER BY [c0].[ContactTitle], [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[ContactTitle], [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_with_last(Boolean useString) : + AssertSql( + @"SELECT TOP 1 [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].[CompanyName] DESC, [c].[CustomerID] DESC", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP 1 [c0].[CustomerID], [c0].[CompanyName] + FROM [Customers] AS [c0] + ORDER BY [c0].[CompanyName] DESC, [c0].[CustomerID] DESC +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CompanyName] DESC, [t].[CustomerID] DESC"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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] DESC, [c].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + ORDER BY [c0].[City] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_with_take(Boolean useString) : + AssertSql( + @"@__p_0='10' + +SELECT TOP @__p_0 [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] DESC, [c].[CustomerID]", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT TOP @__p_0 [c0].[CustomerID], [c0].[City] + FROM [Customers] AS [c0] + ORDER BY [c0].[City] DESC, [c0].[CustomerID] +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[City] DESC, [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_where_skip_take_projection(Boolean useString) : + AssertSql( + @"@__p_1='2' +@__p_0='1' + +SELECT TOP @__p_1+@__p_0 [od#Order].[CustomerID] +FROM ([Order Details] AS [od] +INNER JOIN [Orders] AS [od#Order] ON [od].[OrderID] = [od#Order].[OrderID]) +WHERE [od].[Quantity] = 10 +ORDER BY [od].[OrderID], [od].[ProductID] + SKIP @__p_0"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_where_skip_take_projection(Boolean useString) : + AssertSql( + @"@__p_1='2' +@__p_0='1' + +SELECT TOP @__p_1+@__p_0 [od#Order].[CustomerID] +FROM ([Order Details] AS [od] +INNER JOIN [Orders] AS [od#Order] ON [od].[OrderID] = [od#Order].[OrderID]) +WHERE [od].[Quantity] = 10 +ORDER BY [od].[OrderID], [od].[ProductID] + SKIP @__p_0"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +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] + SKIP @__p_0", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_skip_no_order_by(Boolean useString) : + AssertSql( + @"@__p_0='10' + +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] + SKIP @__p_0", + // + @"@__p_0='10' + +SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT [c0].[CustomerID] + FROM [Customers] AS [c0] + ORDER BY [c0].[CustomerID] + SKIP @__p_0 +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause_with_filter(Boolean useString) : + AssertSql( + @"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 [c1] +, [Customers] AS [c] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM [Customers] AS [c10] + , [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + +EntityFramework.Jet.FunctionalTests.IncludeJetTest.Include_collection_on_additional_from_clause_with_filter(Boolean useString) : + AssertSql( + @"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 [c1] +, [Customers] AS [c] +WHERE [c].[CustomerID] = 'ALFKI' +ORDER BY [c].[CustomerID]", + // + @"SELECT [c#Orders].[OrderID], [c#Orders].[CustomerID], [c#Orders].[EmployeeID], [c#Orders].[OrderDate] +FROM ([Orders] AS [c#Orders] +INNER JOIN ( + SELECT DISTINCT [c0].[CustomerID] + FROM [Customers] AS [c10] + , [Customers] AS [c0] + WHERE [c0].[CustomerID] = 'ALFKI' +) AS [t] ON [c#Orders].[CustomerID] = [t].[CustomerID]) +ORDER BY [t].[CustomerID]"); + + + diff --git a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs index 79b5ec2..a4ff658 100644 --- a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs +++ b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.Data.Jet; using System.IO; using System.Linq; using System.Text; @@ -11,6 +10,7 @@ using EntityFrameworkCore.Jet.Metadata; using EntityFrameworkCore.Jet.Metadata.Internal; using EntityFrameworkCore.Jet.Migrations.Operations; using EntityFrameworkCore.Jet.Properties; +using EntityFrameworkCore.Jet.Storage.Internal; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -19,6 +19,7 @@ using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations.Operations; using Microsoft.EntityFrameworkCore.Storage; using EntityFrameworkCore.Jet.Utilities; +using JetConnection = System.Data.Jet.JetConnection; namespace EntityFrameworkCore.Jet.Migrations { @@ -379,22 +380,46 @@ namespace EntityFrameworkCore.Jet.Migrations builder.EndCommand(); } - protected override void Generate( - CreateTableOperation operation, - IModel model, + + /// + /// Generates a SQL fragment for the default constraint of a column. + /// + /// The default value for the column. + /// The SQL expression to use for the column's default constraint. + /// The command builder to use to add the SQL fragment. + protected override void DefaultValue( + object defaultValue, + string defaultValueSql, MigrationCommandListBuilder builder) { - base.Generate(operation, model, builder, terminate: false); + Check.NotNull(builder, nameof(builder)); + if (defaultValueSql != null) + { + builder + .Append(" DEFAULT (") + .Append(defaultValueSql) + .Append(")"); + } + else if (defaultValue != null) + { + var typeMapping = Dependencies.TypeMapper.GetMappingForValue(defaultValue); - // Jet - var memoryOptimized = IsMemoryOptimized(operation); + // Jet does not support defaults for hh:mm:ss in create table statement + bool isDateTimeValue = + defaultValue.GetType().UnwrapNullableType() == typeof(DateTime) || + defaultValue.GetType().UnwrapNullableType() == typeof(DateTimeOffset); - builder - .AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator) - .EndCommand(suppressTransaction: memoryOptimized); + builder + .Append(" DEFAULT ") + .Append( + isDateTimeValue ? + JetDateTimeTypeMapping.GenerateSqlLiteral(defaultValue, true) : + typeMapping.GenerateSqlLiteral(defaultValue)); + } } + protected override void Generate( RenameTableOperation operation, IModel model, @@ -431,15 +456,6 @@ namespace EntityFrameworkCore.Jet.Migrations builder.EndCommand(); } - protected override void Generate(DropTableOperation operation, IModel model, MigrationCommandListBuilder builder) - { - base.Generate(operation, model, builder, terminate: false); - - builder - .AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator) - .EndCommand(suppressTransaction: IsMemoryOptimized(operation, model, operation.Schema, operation.Name)); - } - protected override void Generate( CreateIndexOperation operation, IModel model, diff --git a/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs index 07ac638..c18a0b2 100644 --- a/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetDateTimeTypeMapping.cs @@ -15,6 +15,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal public class JetDateTimeTypeMapping : DateTimeTypeMapping { private const string DateTimeFormatConst = "{0:MM/dd/yyyy HH:mm:ss}"; + private const string DateTimeShortFormatConst = "{0:MM/dd/yyyy}"; /// /// Initializes a new instance of the class. @@ -56,5 +57,16 @@ namespace EntityFrameworkCore.Jet.Storage.Internal /// Gets the string format to be used to generate SQL literals of this type. /// protected override string SqlLiteralFormatString => "#" + DateTimeFormatConst + "#"; + + + public static string GenerateSqlLiteral(object o, bool shortForm) + { + return + shortForm ? + string.Format("#" + DateTimeShortFormatConst + "#", o) : + string.Format("#" + DateTimeFormatConst + "#", o); + + } + } } diff --git a/test/EFCore.Jet.FunctionalTests/ComplexNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/ComplexNavigationsQueryJetTest.cs index ac5abe0..33fe293 100644 --- a/test/EFCore.Jet.FunctionalTests/ComplexNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ComplexNavigationsQueryJetTest.cs @@ -2737,7 +2737,7 @@ WHERE [l1.OneToOne_Optional_FK].[Id] IS NULL"); @""); } - [Fact] + [Fact(Skip = "Unsupported by JET: SKIP TAKE DISTINCT")] public override void Member_doesnt_get_pushed_down_into_subquery_with_result_operator() { base.Member_doesnt_get_pushed_down_into_subquery_with_result_operator(); diff --git a/test/EFCore.Jet.FunctionalTests/CompositeKeyEndToEndTest.cs b/test/EFCore.Jet.FunctionalTests/CompositeKeyEndToEndTest.cs index 2eb0050..c64f622 100644 --- a/test/EFCore.Jet.FunctionalTests/CompositeKeyEndToEndTest.cs +++ b/test/EFCore.Jet.FunctionalTests/CompositeKeyEndToEndTest.cs @@ -19,7 +19,7 @@ namespace EntityFramework.Jet.FunctionalTests .AddEntityFrameworkJet() .BuildServiceProvider(); - var ticks = DateTime.UtcNow.Ticks; + var ticks = DateTime.UtcNow.Ticks % 15091969; using (var context = new BronieContext(serviceProvider, "CompositePegasuses")) { diff --git a/test/EFCore.Jet.FunctionalTests/DataAnnotationJetFixture.cs b/test/EFCore.Jet.FunctionalTests/DataAnnotationJetFixture.cs index f0c6696..79bb543 100644 --- a/test/EFCore.Jet.FunctionalTests/DataAnnotationJetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/DataAnnotationJetFixture.cs @@ -60,5 +60,12 @@ namespace EntityFramework.Jet.FunctionalTests context.Database.UseTransaction(testStore.Transaction); return context; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.Entity().Ignore(_ => _.Timestamp); + } } } diff --git a/test/EFCore.Jet.FunctionalTests/DataAnnotationJetTest.cs b/test/EFCore.Jet.FunctionalTests/DataAnnotationJetTest.cs index ba50dca..a1607bb 100644 --- a/test/EFCore.Jet.FunctionalTests/DataAnnotationJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/DataAnnotationJetTest.cs @@ -41,7 +41,7 @@ namespace EntityFramework.Jet.FunctionalTests var modelBuilder = base.Key_and_MaxLength_64_produce_nvarchar_64(); var property = GetProperty(modelBuilder, "PersonFirstName"); - Assert.Equal("nvarchar(64)", new JetTypeMapper(new RelationalTypeMapperDependencies()).FindMapping(property).StoreType); + Assert.Equal("varchar(64)", new JetTypeMapper(new RelationalTypeMapperDependencies()).FindMapping(property).StoreType); return modelBuilder; } @@ -76,6 +76,7 @@ namespace EntityFramework.Jet.FunctionalTests return modelBuilder; } + [Fact(Skip = "Unsupported by JET")] public override void ConcurrencyCheckAttribute_throws_if_value_in_database_changed() { using (var context = CreateContext()) @@ -113,130 +114,14 @@ UPDATE [Sample] SET [Name] = @p0, [RowVersion] = @p1 WHERE [UniqueNo] = @p2 AND [RowVersion] = @p3", Sql); } - public override void DatabaseGeneratedAttribute_autogenerates_values_when_set_to_identity() - { - base.DatabaseGeneratedAttribute_autogenerates_values_when_set_to_identity(); - Assert.Equal(@"@p0='' (Size = 10) (DbType = String) -@p1='Third' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000003' - -INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion]) -VALUES (@p0, @p1, @p2) - -@p0='' (Size = 10) (DbType = String) -@p1='Third' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000003' - -SELECT [UniqueNo] -FROM [Sample] -WHERE 1 = 1 AND [UniqueNo] = CAST (@@IDENTITY AS int)", - Sql); - } - - public override void MaxLengthAttribute_throws_while_inserting_value_longer_than_max_length() - { - base.MaxLengthAttribute_throws_while_inserting_value_longer_than_max_length(); - - Assert.Equal(@"@p0='Short' (Size = 10) -@p1='ValidString' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000001' - -INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion]) -VALUES (@p0, @p1, @p2) - -@p0='Short' (Size = 10) -@p1='ValidString' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000001' - -SELECT [UniqueNo] -FROM [Sample] -WHERE 1 = 1 AND [UniqueNo] = CAST (@@IDENTITY AS int) - -@p0='VeryVeryVeryVeryVeryVeryLongString' -@p1='ValidString' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000002' - -INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion]) -VALUES (@p0, @p1, @p2)", - Sql); - } - - public override void RequiredAttribute_for_navigation_throws_while_inserting_null_value() - { - base.RequiredAttribute_for_navigation_throws_while_inserting_null_value(); - - Assert.Equal(@"@p0='' (DbType = Int32) -@p1='Book1' (Nullable = false) (Size = 256) - -INSERT INTO [BookDetail] ([AdditionalBookDetailId], [BookId]) -VALUES (@p0, @p1) - -@p0='' (DbType = Int32) -@p1='Book1' (Nullable = false) (Size = 256) - -SELECT [Id] -FROM [BookDetail] -WHERE 1 = 1 AND [Id] = CAST (@@IDENTITY AS int) - -@p0='' (DbType = Int32) -@p1='' (Nullable = false) (Size = 256) (DbType = String) - -INSERT INTO [BookDetail] ([AdditionalBookDetailId], [BookId]) -VALUES (@p0, @p1)", - Sql); - } - - public override void RequiredAttribute_for_property_throws_while_inserting_null_value() - { - base.RequiredAttribute_for_property_throws_while_inserting_null_value(); - - Assert.Equal(@"@p0='' (Size = 10) (DbType = String) -@p1='ValidString' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000001' - -INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion]) -VALUES (@p0, @p1, @p2) - -@p0='' (Size = 10) (DbType = String) -@p1='ValidString' (Nullable = false) (Size = 4000) -@p2='00000000-0000-0000-0000-000000000001' - -SELECT [UniqueNo] -FROM [Sample] -WHERE 1 = 1 AND [UniqueNo] = CAST (@@IDENTITY AS int) - -@p0='' (Size = 10) (DbType = String) -@p1='' (Nullable = false) (Size = 4000) (DbType = String) -@p2='00000000-0000-0000-0000-000000000002' - -INSERT INTO [Sample] ([MaxLengthProperty], [Name], [RowVersion]) -VALUES (@p0, @p1, @p2)", - Sql); - } public override void StringLengthAttribute_throws_while_inserting_value_longer_than_max_length() { Fixture.TestSqlLoggerFactory.Clear(); base.StringLengthAttribute_throws_while_inserting_value_longer_than_max_length(); - - Assert.Equal(@"@p0='ValidString' (Size = 16) - -INSERT INTO [Two] ([Data]) -VALUES (@p0) - -@p0='ValidString' (Size = 16) - -SELECT [Id], [Timestamp] -FROM [Two] -WHERE 1 = 1 AND [Id] = CAST (@@IDENTITY AS int) - -@p0='ValidButLongString' - -INSERT INTO [Two] ([Data]) -VALUES (@p0)", - Sql); } + [Fact(Skip = "Unsupported by JET: Data type unsupported")] public override void TimestampAttribute_throws_if_value_in_database_changed() { using (var context = CreateContext()) diff --git a/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs b/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs index 7e05bd6..33d44df 100644 --- a/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs +++ b/test/EFCore.Jet.FunctionalTests/F1JetFixture.cs @@ -9,6 +9,8 @@ using Microsoft.Extensions.Logging; namespace EntityFramework.Jet.FunctionalTests { + // This test is based on rowversion that is unsupported by Jet + // The version is a ghosted property public class F1JetFixture : F1RelationalFixture { public static readonly string DatabaseName = "OptimisticConcurrencyTest"; @@ -38,7 +40,7 @@ namespace EntityFramework.Jet.FunctionalTests using (var context = new F1Context(optionsBuilder.Options)) { - context.Database.EnsureClean(); + context.Database.EnsureCreated(); ConcurrencyModelInitializer.Seed(context); } }); @@ -55,16 +57,20 @@ namespace EntityFramework.Jet.FunctionalTests return context; } + // ReSharper disable once RedundantOverriddenMember protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); + + /* modelBuilder.Entity().Property("Version").IsRowVersion(); modelBuilder.Entity().Property("Version").IsRowVersion(); modelBuilder.Entity().Property("Version") .ValueGeneratedOnAddOrUpdate() .IsConcurrencyToken(); + */ } } } \ No newline at end of file diff --git a/test/EFCore.Jet.FunctionalTests/IncludeJetTest.cs b/test/EFCore.Jet.FunctionalTests/IncludeJetTest.cs index ac43c6a..fbc2a71 100644 --- a/test/EFCore.Jet.FunctionalTests/IncludeJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/IncludeJetTest.cs @@ -24,9 +24,9 @@ namespace EntityFramework.Jet.FunctionalTests FROM [Products] AS [p] ORDER BY [p].[ProductID]", // - @"SELECT [p.OrderDetails].[OrderID], [p.OrderDetails].[ProductID], [p.OrderDetails].[Discount], [p.OrderDetails].[Quantity], [p.OrderDetails].[UnitPrice], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate] + @"SELECT [p.OrderDetails].[OrderID], [p.OrderDetails].[ProductID], [p.OrderDetails].[Discount], [p.OrderDetails].[Quantity], [p.OrderDetails].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] FROM [Order Details] AS [p.OrderDetails] -INNER JOIN [Orders] AS [o.Order] ON [p.OrderDetails].[OrderID] = [o.Order].[OrderID] +INNER JOIN [Orders] AS [o#Order] ON [p.OrderDetails].[OrderID] = [o#Order].[OrderID] INNER JOIN ( SELECT [p0].[ProductID] FROM [Products] AS [p0] @@ -39,9 +39,9 @@ ORDER BY [t].[ProductID]"); base.Include_reference(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID]"); +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]"); } public override void Include_collection(bool useString) @@ -189,18 +189,18 @@ ORDER BY [t].[CustomerID]"); base.Include_reference_and_collection(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID] ORDER BY [o].[OrderID]", // - @"SELECT [o.OrderDetails].[OrderID], [o.OrderDetails].[ProductID], [o.OrderDetails].[Discount], [o.OrderDetails].[Quantity], [o.OrderDetails].[UnitPrice] -FROM [Order Details] AS [o.OrderDetails] + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM [Order Details] AS [o#OrderDetails] INNER JOIN ( SELECT DISTINCT [o0].[OrderID] FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [o.Customer0] ON [o0].[CustomerID] = [o.Customer0].[CustomerID] -) AS [t] ON [o.OrderDetails].[OrderID] = [t].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID] ORDER BY [t].[OrderID]"); } @@ -209,10 +209,10 @@ ORDER BY [t].[OrderID]"); base.Include_references_multi_level(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region] + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region] FROM [Order Details] AS [o] -INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID] -LEFT JOIN [Customers] AS [o.Order.Customer] ON [o.Order].[CustomerID] = [o.Order.Customer].[CustomerID]"); +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID] +LEFT JOIN [Customers] AS [o.Order.Customer] ON [o#Order].[CustomerID] = [o.Order.Customer].[CustomerID]"); } public override void Include_multiple_references_multi_level(bool useString) @@ -220,11 +220,11 @@ LEFT JOIN [Customers] AS [o.Order.Customer] ON [o.Order].[CustomerID] = [o.Order base.Include_multiple_references_multi_level(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region] + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region] FROM [Order Details] AS [o] INNER JOIN [Products] AS [o.Product] ON [o].[ProductID] = [o.Product].[ProductID] -INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID] -LEFT JOIN [Customers] AS [o.Order.Customer] ON [o.Order].[CustomerID] = [o.Order.Customer].[CustomerID]"); +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID] +LEFT JOIN [Customers] AS [o.Order.Customer] ON [o#Order].[CustomerID] = [o.Order.Customer].[CustomerID]"); } public override void Include_multiple_references_multi_level_reverse(bool useString) @@ -232,10 +232,10 @@ LEFT JOIN [Customers] AS [o.Order.Customer] ON [o.Order].[CustomerID] = [o.Order base.Include_multiple_references_multi_level_reverse(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock] + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock] FROM [Order Details] AS [o] -INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID] -LEFT JOIN [Customers] AS [o.Order.Customer] ON [o.Order].[CustomerID] = [o.Order.Customer].[CustomerID] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID] +LEFT JOIN [Customers] AS [o.Order.Customer] ON [o#Order].[CustomerID] = [o.Order.Customer].[CustomerID] INNER JOIN [Products] AS [o.Product] ON [o].[ProductID] = [o.Product].[ProductID]"); } @@ -244,10 +244,10 @@ INNER JOIN [Products] AS [o.Product] ON [o].[ProductID] = [o.Product].[ProductID base.Include_references_and_collection_multi_level(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region] + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate], [o.Order.Customer].[CustomerID], [o.Order.Customer].[Address], [o.Order.Customer].[City], [o.Order.Customer].[CompanyName], [o.Order.Customer].[ContactName], [o.Order.Customer].[ContactTitle], [o.Order.Customer].[Country], [o.Order.Customer].[Fax], [o.Order.Customer].[Phone], [o.Order.Customer].[PostalCode], [o.Order.Customer].[Region] FROM [Order Details] AS [o] -INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID] -LEFT JOIN [Customers] AS [o.Order.Customer] ON [o.Order].[CustomerID] = [o.Order.Customer].[CustomerID] +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID] +LEFT JOIN [Customers] AS [o.Order.Customer] ON [o#Order].[CustomerID] = [o.Order.Customer].[CustomerID] ORDER BY [o.Order.Customer].[CustomerID]", // @"SELECT [o.Order.Customer.Orders].[OrderID], [o.Order.Customer.Orders].[CustomerID], [o.Order.Customer.Orders].[EmployeeID], [o.Order.Customer.Orders].[OrderDate] @@ -266,11 +266,11 @@ ORDER BY [t].[CustomerID]"); base.Include_multi_level_reference_and_collection_predicate(useString); AssertSql( - @"SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o.Customer].[CustomerID]", +ORDER BY [o#Customer].[CustomerID]", // @"SELECT [o.Customer.Orders].[OrderID], [o.Customer.Orders].[CustomerID], [o.Customer.Orders].[EmployeeID], [o.Customer.Orders].[OrderDate] FROM [Orders] AS [o.Customer.Orders] @@ -297,15 +297,15 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ORDER BY [o].[OrderID]", // - @"SELECT [o.OrderDetails].[OrderID], [o.OrderDetails].[ProductID], [o.OrderDetails].[Discount], [o.OrderDetails].[Quantity], [o.OrderDetails].[UnitPrice], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock] -FROM [Order Details] AS [o.OrderDetails] -INNER JOIN [Products] AS [o.Product] ON [o.OrderDetails].[ProductID] = [o.Product].[ProductID] + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock] +FROM [Order Details] AS [o#OrderDetails] +INNER JOIN [Products] AS [o.Product] ON [o#OrderDetails].[ProductID] = [o.Product].[ProductID] INNER JOIN ( SELECT TOP(1) [o0].[OrderID] FROM [Orders] AS [o0] WHERE [o0].[OrderID] = 10248 ORDER BY [o0].[OrderID] -) AS [t] ON [o.OrderDetails].[OrderID] = [t].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID] ORDER BY [t].[OrderID]"); } @@ -318,12 +318,12 @@ ORDER BY [t].[OrderID]"); FROM [Orders] AS [o] ORDER BY [o].[OrderID]", // - @"SELECT [o.OrderDetails].[OrderID], [o.OrderDetails].[ProductID], [o.OrderDetails].[Discount], [o.OrderDetails].[Quantity], [o.OrderDetails].[UnitPrice] -FROM [Order Details] AS [o.OrderDetails] + @"SELECT [o#OrderDetails].[OrderID], [o#OrderDetails].[ProductID], [o#OrderDetails].[Discount], [o#OrderDetails].[Quantity], [o#OrderDetails].[UnitPrice] +FROM [Order Details] AS [o#OrderDetails] INNER JOIN ( SELECT [o0].[OrderID] FROM [Orders] AS [o0] -) AS [t] ON [o.OrderDetails].[OrderID] = [t].[OrderID] +) AS [t] ON [o#OrderDetails].[OrderID] = [t].[OrderID] ORDER BY [t].[OrderID]"); } @@ -1004,10 +1004,10 @@ ORDER BY [t4].[CustomerID]"); base.Include_multiple_references(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate] + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Product].[ProductID], [o.Product].[Discontinued], [o.Product].[ProductName], [o.Product].[UnitPrice], [o.Product].[UnitsInStock], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Products] AS [o.Product] ON [o].[ProductID] = [o.Product].[ProductID] -INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID]"); +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]"); } public override void Include_reference_alias_generation(bool useString) @@ -1015,9 +1015,9 @@ INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID]"); base.Include_reference_alias_generation(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o.Order].[OrderID], [o.Order].[CustomerID], [o.Order].[EmployeeID], [o.Order].[OrderDate] + @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o#Order].[OrderID], [o#Order].[CustomerID], [o#Order].[EmployeeID], [o#Order].[OrderDate] FROM [Order Details] AS [o] -INNER JOIN [Orders] AS [o.Order] ON [o].[OrderID] = [o.Order].[OrderID]"); +INNER JOIN [Orders] AS [o#Order] ON [o].[OrderID] = [o#Order].[OrderID]"); } public override void Include_duplicate_reference(bool useString) @@ -1110,9 +1110,9 @@ FROM [Orders] AS [o]"); base.Include_reference_with_filter_reordered(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID] WHERE [o].[CustomerID] = N'ALFKI'"); } @@ -1121,9 +1121,9 @@ WHERE [o].[CustomerID] = N'ALFKI'"); base.Include_reference_with_filter(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID] +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID] WHERE [o].[CustomerID] = N'ALFKI'"); } @@ -1186,9 +1186,9 @@ ORDER BY [t].[CustomerID]"); FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI'", // - @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID]"); +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]"); } public override void Include_reference_as_no_tracking(bool useString) @@ -1196,9 +1196,9 @@ LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[Custom base.Include_reference_as_no_tracking(useString); AssertSql( - @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o.Customer].[CustomerID], [o.Customer].[Address], [o.Customer].[City], [o.Customer].[CompanyName], [o.Customer].[ContactName], [o.Customer].[ContactTitle], [o.Customer].[Country], [o.Customer].[Fax], [o.Customer].[Phone], [o.Customer].[PostalCode], [o.Customer].[Region] + @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o#Customer].[CustomerID], [o#Customer].[Address], [o#Customer].[City], [o#Customer].[CompanyName], [o#Customer].[ContactName], [o#Customer].[ContactTitle], [o#Customer].[Country], [o#Customer].[Fax], [o#Customer].[Phone], [o#Customer].[PostalCode], [o#Customer].[Region] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [o.Customer] ON [o].[CustomerID] = [o.Customer].[CustomerID]"); +LEFT JOIN [Customers] AS [o#Customer] ON [o].[CustomerID] = [o#Customer].[CustomerID]"); } public override void Include_collection_as_no_tracking2(bool useString) @@ -1375,6 +1375,8 @@ ORDER BY [t].[c], [t].[CustomerID]"); int i = 0; foreach (var item in expected) { + if (AssertSqlHelper.IgnoreStatement(item)) + return; expectedFixed[i++] = item.Replace("\r\n", "\n"); } Fixture.TestSqlLoggerFactory.AssertBaseline(expectedFixed); diff --git a/test/EFCore.Jet.FunctionalTests/InheritanceJetTest.cs b/test/EFCore.Jet.FunctionalTests/InheritanceJetTest.cs index 43e3f5c..50cf48b 100644 --- a/test/EFCore.Jet.FunctionalTests/InheritanceJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/InheritanceJetTest.cs @@ -40,17 +40,17 @@ namespace EntityFramework.Jet.FunctionalTests base.Can_query_when_shared_column(); AssertSql( - @"SELECT TOP(2) [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[CokeCO2], [d].[SugarGrams] + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[CokeCO2], [d].[SugarGrams] FROM [Drink] AS [d] -WHERE [d].[Discriminator] = N'Coke'", +WHERE [d].[Discriminator] = 'Coke'", // - @"SELECT TOP(2) [d].[Id], [d].[Discriminator], [d].[LiltCO2], [d].[SugarGrams] + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[LiltCO2], [d].[SugarGrams] FROM [Drink] AS [d] -WHERE [d].[Discriminator] = N'Lilt'", +WHERE [d].[Discriminator] = 'Lilt'", // - @"SELECT TOP(2) [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[HasMilk] + @"SELECT TOP 2 [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[HasMilk] FROM [Drink] AS [d] -WHERE [d].[Discriminator] = N'Tea'"); +WHERE [d].[Discriminator] = 'Tea'"); } public override void Can_query_all_types_when_shared_column() @@ -60,7 +60,7 @@ WHERE [d].[Discriminator] = N'Tea'"); AssertSql( @"SELECT [d].[Id], [d].[Discriminator], [d].[CaffeineGrams], [d].[CokeCO2], [d].[SugarGrams], [d].[LiltCO2], [d].[HasMilk] FROM [Drink] AS [d] -WHERE [d].[Discriminator] IN (N'Tea', N'Lilt', N'Coke', N'Drink')"); +WHERE [d].[Discriminator] IN ('Tea', 'Lilt', 'Coke', 'Drink')"); } public override void Can_use_of_type_animal() @@ -70,7 +70,7 @@ WHERE [d].[Discriminator] IN (N'Tea', N'Lilt', N'Coke', N'Drink')"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') ORDER BY [a].[Species]"); } @@ -81,7 +81,7 @@ ORDER BY [a].[Species]"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND ([a].[Discriminator] = 'Kiwi')"); } public override void Can_use_is_kiwi_with_other_predicate() @@ -91,20 +91,7 @@ WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') AND ([a].[Discriminator] = N'Ki AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') AND (([a].[Discriminator] = N'Kiwi') AND ([a].[CountryId] = 1))"); - } - - public override void Can_use_is_kiwi_in_projection() - { - base.Can_use_is_kiwi_in_projection(); - - AssertSql( - @"SELECT CASE - WHEN [a].[Discriminator] = N'Kiwi' - THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) -END -FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle')"); +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND (([a].[Discriminator] = 'Kiwi') AND ([a].[CountryId] = 1))"); } [Fact] @@ -115,7 +102,7 @@ WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle')"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') ORDER BY [a].[Species]"); } @@ -126,7 +113,7 @@ ORDER BY [a].[Species]"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') AND ([a].[CountryId] = 1) +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND ([a].[CountryId] = 1) ORDER BY [a].[Species]"); } @@ -137,7 +124,7 @@ ORDER BY [a].[Species]"); AssertSql( @"SELECT [b].[EagleId] FROM [Animal] AS [b] -WHERE [b].[Discriminator] IN (N'Kiwi', N'Eagle')"); +WHERE [b].[Discriminator] IN ('Kiwi', 'Eagle')"); } public override void Can_use_of_type_bird_first() @@ -145,9 +132,9 @@ WHERE [b].[Discriminator] IN (N'Kiwi', N'Eagle')"); base.Can_use_of_type_bird_first(); AssertSql( - @"SELECT TOP(1) [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] + @"SELECT TOP 1 [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') ORDER BY [a].[Species]"); } @@ -158,7 +145,7 @@ ORDER BY [a].[Species]"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] = N'Kiwi'"); +WHERE [a].[Discriminator] = 'Kiwi'"); } public override void Can_use_of_type_rose() @@ -178,7 +165,7 @@ WHERE [p].[Genus] = 0"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') ORDER BY [a].[Species]"); } @@ -200,7 +187,7 @@ ORDER BY [a].[Species]"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') AND ([a].[Name] = N'Great spotted kiwi') +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') AND ([a].[Name] = 'Great spotted kiwi') ORDER BY [a].[Species]"); } @@ -211,7 +198,7 @@ ORDER BY [a].[Species]"); AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] IN (N'Kiwi', N'Eagle') +WHERE [a].[Discriminator] IN ('Kiwi', 'Eagle') ORDER BY [a].[Species]"); } @@ -220,9 +207,9 @@ ORDER BY [a].[Species]"); base.Can_query_just_kiwis(); AssertSql( - @"SELECT TOP(2) [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] + @"SELECT TOP 2 [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animal] AS [a] -WHERE [a].[Discriminator] = N'Kiwi'"); +WHERE [a].[Discriminator] = 'Kiwi'"); } public override void Can_query_just_roses() @@ -230,53 +217,12 @@ WHERE [a].[Discriminator] = N'Kiwi'"); base.Can_query_just_roses(); AssertSql( - @"SELECT TOP(2) [p].[Species], [p].[CountryId], [p].[Genus], [p].[Name], [p].[HasThorns] + @"SELECT TOP 2 [p].[Species], [p].[CountryId], [p].[Genus], [p].[Name], [p].[HasThorns] FROM [Plant] AS [p] WHERE [p].[Genus] = 0" ); } - public override void Can_include_prey() - { - base.Can_include_prey(); - - AssertSql( - @"SELECT TOP(2) [e].[Species], [e].[CountryId], [e].[Discriminator], [e].[Name], [e].[EagleId], [e].[IsFlightless], [e].[Group] -FROM [Animal] AS [e] -WHERE [e].[Discriminator] = N'Eagle' -ORDER BY [e].[Species]", - // - @"SELECT [e.Prey].[Species], [e.Prey].[CountryId], [e.Prey].[Discriminator], [e.Prey].[Name], [e.Prey].[EagleId], [e.Prey].[IsFlightless], [e.Prey].[Group], [e.Prey].[FoundOn] -FROM [Animal] AS [e.Prey] -INNER JOIN ( - SELECT TOP(1) [e0].[Species] - FROM [Animal] AS [e0] - WHERE [e0].[Discriminator] = N'Eagle' - ORDER BY [e0].[Species] -) AS [t] ON [e.Prey].[EagleId] = [t].[Species] -WHERE [e.Prey].[Discriminator] IN (N'Kiwi', N'Eagle') -ORDER BY [t].[Species]"); - } - - public override void Can_include_animals() - { - base.Can_include_animals(); - - AssertSql( - @"SELECT [c].[Id], [c].[Name] -FROM [Country] AS [c] -ORDER BY [c].[Name], [c].[Id]", - // - @"SELECT [c.Animals].[Species], [c.Animals].[CountryId], [c.Animals].[Discriminator], [c.Animals].[Name], [c.Animals].[EagleId], [c.Animals].[IsFlightless], [c.Animals].[Group], [c.Animals].[FoundOn] -FROM [Animal] AS [c.Animals] -INNER JOIN ( - SELECT [c0].[Id], [c0].[Name] - FROM [Country] AS [c0] -) AS [t] ON [c.Animals].[CountryId] = [t].[Id] -WHERE [c.Animals].[Discriminator] IN (N'Kiwi', N'Eagle') -ORDER BY [t].[Name], [t].[Id]"); - } - public override void Can_use_of_type_kiwi_where_north_on_derived_property() { base.Can_use_of_type_kiwi_where_north_on_derived_property(); @@ -284,7 +230,7 @@ ORDER BY [t].[Name], [t].[Id]"); AssertSql( @"SELECT [x].[Species], [x].[CountryId], [x].[Discriminator], [x].[Name], [x].[EagleId], [x].[IsFlightless], [x].[FoundOn] FROM [Animal] AS [x] -WHERE ([x].[Discriminator] = N'Kiwi') AND ([x].[FoundOn] = 0)"); +WHERE ([x].[Discriminator] = 'Kiwi') AND ([x].[FoundOn] = 0)"); } public override void Can_use_of_type_kiwi_where_south_on_derived_property() @@ -294,7 +240,7 @@ WHERE ([x].[Discriminator] = N'Kiwi') AND ([x].[FoundOn] = 0)"); AssertSql( @"SELECT [x].[Species], [x].[CountryId], [x].[Discriminator], [x].[Name], [x].[EagleId], [x].[IsFlightless], [x].[FoundOn] FROM [Animal] AS [x] -WHERE ([x].[Discriminator] = N'Kiwi') AND ([x].[FoundOn] = 1)"); +WHERE ([x].[Discriminator] = 'Kiwi') AND ([x].[FoundOn] = 1)"); } public override void Discriminator_used_when_projection_over_derived_type() @@ -304,7 +250,7 @@ WHERE ([x].[Discriminator] = N'Kiwi') AND ([x].[FoundOn] = 1)"); AssertSql( @"SELECT [k].[FoundOn] FROM [Animal] AS [k] -WHERE [k].[Discriminator] = N'Kiwi'"); +WHERE [k].[Discriminator] = 'Kiwi'"); } [Fact] @@ -315,7 +261,7 @@ WHERE [k].[Discriminator] = N'Kiwi'"); AssertSql( @"SELECT [b].[IsFlightless], [b].[Discriminator] FROM [Animal] AS [b] -WHERE [b].[Discriminator] IN (N'Kiwi', N'Eagle')"); +WHERE [b].[Discriminator] IN ('Kiwi', 'Eagle')"); } [Fact] @@ -326,7 +272,7 @@ WHERE [b].[Discriminator] IN (N'Kiwi', N'Eagle')"); AssertSql( @"SELECT [k].[FoundOn] FROM [Animal] AS [k] -WHERE [k].[Discriminator] = N'Kiwi'"); +WHERE [k].[Discriminator] = 'Kiwi'"); } [Fact(Skip = "Investigate - https://github.com/aspnet/EntityFramework/issues/9379")] @@ -335,7 +281,7 @@ WHERE [k].[Discriminator] = N'Kiwi'"); base.Can_insert_update_delete(); AssertSql( - @"SELECT TOP(2) [c].[Id], [c].[Name] + @"SELECT TOP 2 [c].[Id], [c].[Name] FROM [Country] AS [c] WHERE [c].[Id] = 1", // @@ -350,9 +296,9 @@ WHERE [c].[Id] = 1", INSERT INTO [Animal] ([Species], [CountryId], [Discriminator], [Name], [EagleId], [IsFlightless], [FoundOn]) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6)", // - @"SELECT TOP(2) [k].[Species], [k].[CountryId], [k].[Discriminator], [k].[Name], [k].[EagleId], [k].[IsFlightless], [k].[FoundOn] + @"SELECT TOP 2 [k].[Species], [k].[CountryId], [k].[Discriminator], [k].[Name], [k].[EagleId], [k].[IsFlightless], [k].[FoundOn] FROM [Animal] AS [k] -WHERE ([k].[Discriminator] = N'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Species]) + 1) - LEN(N'owenii'), LEN(N'owenii')) = N'owenii')", +WHERE ([k].[Discriminator] = 'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Species]) + 1) - LEN('owenii'), LEN('owenii')) = 'owenii')", // @"@p1='Apteryx owenii' (Nullable = false) (Size = 100) @p0='Aquila chrysaetos canadensis' (Size = 100) @@ -360,9 +306,9 @@ WHERE ([k].[Discriminator] = N'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Sp UPDATE [Animal] SET [EagleId] = @p0 WHERE [Species] = @p1", // - @"SELECT TOP(2) [k].[Species], [k].[CountryId], [k].[Discriminator], [k].[Name], [k].[EagleId], [k].[IsFlightless], [k].[FoundOn] + @"SELECT TOP 2 [k].[Species], [k].[CountryId], [k].[Discriminator], [k].[Name], [k].[EagleId], [k].[IsFlightless], [k].[FoundOn] FROM [Animal] AS [k] -WHERE ([k].[Discriminator] = N'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Species]) + 1) - LEN(N'owenii'), LEN(N'owenii')) = N'owenii')", +WHERE ([k].[Discriminator] = 'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Species]) + 1) - LEN('owenii'), LEN('owenii')) = 'owenii')", // @"@p0='Apteryx owenii' (Nullable = false) (Size = 100) @@ -371,7 +317,7 @@ WHERE [Species] = @p0", // @"SELECT COUNT(*) FROM [Animal] AS [k] -WHERE ([k].[Discriminator] = N'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Species]) + 1) - LEN(N'owenii'), LEN(N'owenii')) = N'owenii')"); +WHERE ([k].[Discriminator] = 'Kiwi') AND (SUBSTRING([k].[Species], (LEN([k].[Species]) + 1) - LEN('owenii'), LEN('owenii')) = 'owenii')"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.Jet.FunctionalTests/InheritanceRelationshipsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/InheritanceRelationshipsQueryJetTest.cs index f4a17d8..66d2c9d 100644 --- a/test/EFCore.Jet.FunctionalTests/InheritanceRelationshipsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/InheritanceRelationshipsQueryJetTest.cs @@ -23,9 +23,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity')"); +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); } public override void Include_reference_with_inheritance2() @@ -46,9 +46,9 @@ FROM [BaseReferenceOnBase] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[BaseParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase')"); +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase')"); } public override void Include_self_refence_with_inheritence() @@ -61,9 +61,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.DerivedSefReferenceOnBase].* FROM [BaseInheritanceRelationshipEntity] AS [e.DerivedSefReferenceOnBase] - WHERE [e.DerivedSefReferenceOnBase].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e.DerivedSefReferenceOnBase].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t] ON [e].[Id] = [t].[BaseId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity')"); +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); } public override void Include_self_refence_with_inheritence_reverse() @@ -76,9 +76,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseSelfRerefenceOnDerived].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseSelfRerefenceOnDerived] - WHERE [e.BaseSelfRerefenceOnDerived].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.BaseSelfRerefenceOnDerived].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[BaseId] = [t].[Id] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Include_reference_with_inheritance_with_filter1() @@ -91,9 +91,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_with_inheritance_with_filter2() @@ -114,9 +114,9 @@ FROM [BaseReferenceOnBase] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[BaseParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE [e].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_without_inheritance() @@ -127,7 +127,7 @@ WHERE [e].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e.ReferenceOnBase].[Id], [e.ReferenceOnBase].[Name], [e.ReferenceOnBase].[ParentId] FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN [ReferenceOnBase] AS [e.ReferenceOnBase] ON [e].[Id] = [e.ReferenceOnBase].[ParentId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity')"); +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); } public override void Include_reference_without_inheritance_reverse() @@ -140,7 +140,7 @@ FROM [ReferenceOnBase] AS [e] LEFT JOIN ( SELECT [e.Parent].* FROM [BaseInheritanceRelationshipEntity] AS [e.Parent] - WHERE [e.Parent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[ParentId] = [t].[Id]"); } @@ -152,7 +152,7 @@ LEFT JOIN ( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e.ReferenceOnBase].[Id], [e.ReferenceOnBase].[Name], [e.ReferenceOnBase].[ParentId] FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN [ReferenceOnBase] AS [e.ReferenceOnBase] ON [e].[Id] = [e.ReferenceOnBase].[ParentId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_without_inheritance_with_filter_reverse() @@ -165,9 +165,9 @@ FROM [ReferenceOnBase] AS [e] LEFT JOIN ( SELECT [e.Parent].* FROM [BaseInheritanceRelationshipEntity] AS [e.Parent] - WHERE [e.Parent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[ParentId] = [t].[Id] -WHERE ([e].[Name] <> N'Bar') OR [e].[Name] IS NULL"); +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); } public override void Include_collection_with_inheritance1() @@ -177,17 +177,17 @@ WHERE ([e].[Name] <> N'Bar') OR [e].[Name] IS NULL"); AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ORDER BY [e].[Id]", // - @"SELECT [e.BaseCollectionOnBase].[Id], [e.BaseCollectionOnBase].[BaseParentId], [e.BaseCollectionOnBase].[Discriminator], [e.BaseCollectionOnBase].[Name], [e.BaseCollectionOnBase].[DerivedProperty] -FROM [BaseCollectionOnBase] AS [e.BaseCollectionOnBase] + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM [BaseCollectionOnBase] AS [e#BaseCollectionOnBase] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') -) AS [t] ON [e.BaseCollectionOnBase].[BaseParentId] = [t].[Id] -WHERE [e.BaseCollectionOnBase].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id] +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ORDER BY [t].[Id]"); } @@ -209,9 +209,9 @@ FROM [BaseCollectionOnBase] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[BaseParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase')"); +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase')"); } public override void Include_collection_with_inheritance_with_filter1() @@ -221,17 +221,17 @@ WHERE [e].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) ORDER BY [e].[Id]", // - @"SELECT [e.BaseCollectionOnBase].[Id], [e.BaseCollectionOnBase].[BaseParentId], [e.BaseCollectionOnBase].[Discriminator], [e.BaseCollectionOnBase].[Name], [e.BaseCollectionOnBase].[DerivedProperty] -FROM [BaseCollectionOnBase] AS [e.BaseCollectionOnBase] + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM [BaseCollectionOnBase] AS [e#BaseCollectionOnBase] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> N'Bar') OR [e0].[Name] IS NULL) -) AS [t] ON [e.BaseCollectionOnBase].[BaseParentId] = [t].[Id] -WHERE [e.BaseCollectionOnBase].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id] +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ORDER BY [t].[Id]"); } @@ -253,9 +253,9 @@ FROM [BaseCollectionOnBase] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[BaseParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE [e].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_collection_without_inheritance() @@ -265,7 +265,7 @@ WHERE [e].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ORDER BY [e].[Id]", // @"SELECT [e.CollectionOnBase].[Id], [e.CollectionOnBase].[Name], [e.CollectionOnBase].[ParentId] @@ -273,7 +273,7 @@ FROM [CollectionOnBase] AS [e.CollectionOnBase] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e.CollectionOnBase].[ParentId] = [t].[Id] ORDER BY [t].[Id]"); } @@ -288,7 +288,7 @@ FROM [CollectionOnBase] AS [e] LEFT JOIN ( SELECT [e.Parent].* FROM [BaseInheritanceRelationshipEntity] AS [e.Parent] - WHERE [e.Parent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[ParentId] = [t].[Id]"); } @@ -299,7 +299,7 @@ LEFT JOIN ( AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL) +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL) ORDER BY [e].[Id]", // @"SELECT [e.CollectionOnBase].[Id], [e.CollectionOnBase].[Name], [e.CollectionOnBase].[ParentId] @@ -307,7 +307,7 @@ FROM [CollectionOnBase] AS [e.CollectionOnBase] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> N'Bar') OR [e0].[Name] IS NULL) + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') AND (([e0].[Name] <> 'Bar') OR [e0].[Name] IS NULL) ) AS [t] ON [e.CollectionOnBase].[ParentId] = [t].[Id] ORDER BY [t].[Id]"); } @@ -322,9 +322,9 @@ FROM [CollectionOnBase] AS [e] LEFT JOIN ( SELECT [e.Parent].* FROM [BaseInheritanceRelationshipEntity] AS [e.Parent] - WHERE [e.Parent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.Parent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t] ON [e].[ParentId] = [t].[Id] -WHERE ([e].[Name] <> N'Bar') OR [e].[Name] IS NULL"); +WHERE ([e].[Name] <> 'Bar') OR [e].[Name] IS NULL"); } public override void Include_reference_with_inheritance_on_derived1() @@ -337,9 +337,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Include_reference_with_inheritance_on_derived2() @@ -352,9 +352,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnDerived].* FROM [BaseReferenceOnDerived] AS [e.BaseReferenceOnDerived] - WHERE [e.BaseReferenceOnDerived].[Discriminator] IN (N'DerivedReferenceOnDerived', N'BaseReferenceOnDerived') + WHERE [e.BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Include_reference_with_inheritance_on_derived3() @@ -375,9 +375,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.DerivedReferenceOnDerived].* FROM [BaseReferenceOnDerived] AS [e.DerivedReferenceOnDerived] - WHERE [e.DerivedReferenceOnDerived].[Discriminator] = N'DerivedReferenceOnDerived' + WHERE [e.DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' ) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Include_reference_with_inheritance_on_derived_reverse() @@ -390,9 +390,9 @@ FROM [BaseReferenceOnDerived] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e.BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t] ON [e].[BaseParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedReferenceOnDerived', N'BaseReferenceOnDerived')"); +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived')"); } public override void Include_reference_with_inheritance_on_derived_with_filter1() @@ -405,9 +405,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE ([e].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_with_inheritance_on_derived_with_filter2() @@ -420,9 +420,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnDerived].* FROM [BaseReferenceOnDerived] AS [e.BaseReferenceOnDerived] - WHERE [e.BaseReferenceOnDerived].[Discriminator] IN (N'DerivedReferenceOnDerived', N'BaseReferenceOnDerived') + WHERE [e.BaseReferenceOnDerived].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE ([e].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_with_inheritance_on_derived_with_filter3() @@ -443,9 +443,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.DerivedReferenceOnDerived].* FROM [BaseReferenceOnDerived] AS [e.DerivedReferenceOnDerived] - WHERE [e.DerivedReferenceOnDerived].[Discriminator] = N'DerivedReferenceOnDerived' + WHERE [e.DerivedReferenceOnDerived].[Discriminator] = 'DerivedReferenceOnDerived' ) AS [t] ON [e].[Id] = [t].[DerivedInheritanceRelationshipEntityId] -WHERE ([e].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE ([e].[Discriminator] = 'DerivedInheritanceRelationshipEntity') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_with_inheritance_on_derived_with_filter_reverse() @@ -458,9 +458,9 @@ FROM [BaseReferenceOnDerived] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e.BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t] ON [e].[BaseParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedReferenceOnDerived', N'BaseReferenceOnDerived') AND (([e].[Name] <> N'Bar') OR [e].[Name] IS NULL)"); +WHERE [e].[Discriminator] IN ('DerivedReferenceOnDerived', 'BaseReferenceOnDerived') AND (([e].[Name] <> 'Bar') OR [e].[Name] IS NULL)"); } public override void Include_reference_without_inheritance_on_derived1() @@ -471,7 +471,7 @@ WHERE [e].[Discriminator] IN (N'DerivedReferenceOnDerived', N'BaseReferenceOnDer @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e.ReferenceOnBase].[Id], [e.ReferenceOnBase].[Name], [e.ReferenceOnBase].[ParentId] FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN [ReferenceOnBase] AS [e.ReferenceOnBase] ON [e].[Id] = [e.ReferenceOnBase].[ParentId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Include_reference_without_inheritance_on_derived2() @@ -482,7 +482,7 @@ WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId], [e.ReferenceOnDerived].[Id], [e.ReferenceOnDerived].[Name], [e.ReferenceOnDerived].[ParentId] FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN [ReferenceOnDerived] AS [e.ReferenceOnDerived] ON [e].[Id] = [e.ReferenceOnDerived].[ParentId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Include_reference_without_inheritance_on_derived_reverse() @@ -495,7 +495,7 @@ FROM [ReferenceOnDerived] AS [e] LEFT JOIN ( SELECT [e.Parent].* FROM [BaseInheritanceRelationshipEntity] AS [e.Parent] - WHERE [e.Parent].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e.Parent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t] ON [e].[ParentId] = [t].[Id]"); } @@ -506,17 +506,17 @@ LEFT JOIN ( AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity' +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ORDER BY [e].[Id]", // - @"SELECT [e.BaseCollectionOnBase].[Id], [e.BaseCollectionOnBase].[BaseParentId], [e.BaseCollectionOnBase].[Discriminator], [e.BaseCollectionOnBase].[Name], [e.BaseCollectionOnBase].[DerivedProperty] -FROM [BaseCollectionOnBase] AS [e.BaseCollectionOnBase] + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM [BaseCollectionOnBase] AS [e#BaseCollectionOnBase] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -) AS [t] ON [e.BaseCollectionOnBase].[BaseParentId] = [t].[Id] -WHERE [e.BaseCollectionOnBase].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id] +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ORDER BY [t].[Id]"); } @@ -527,7 +527,7 @@ ORDER BY [t].[Id]"); AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity' +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ORDER BY [e].[Id]", // @"SELECT [e.BaseCollectionOnDerived].[Id], [e.BaseCollectionOnDerived].[Discriminator], [e.BaseCollectionOnDerived].[Name], [e.BaseCollectionOnDerived].[ParentId], [e.BaseCollectionOnDerived].[DerivedInheritanceRelationshipEntityId] @@ -535,9 +535,9 @@ FROM [BaseCollectionOnDerived] AS [e.BaseCollectionOnDerived] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t] ON [e.BaseCollectionOnDerived].[ParentId] = [t].[Id] -WHERE [e.BaseCollectionOnDerived].[Discriminator] IN (N'DerivedCollectionOnDerived', N'BaseCollectionOnDerived') +WHERE [e.BaseCollectionOnDerived].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived') ORDER BY [t].[Id]"); } @@ -567,9 +567,9 @@ FROM [BaseCollectionOnDerived] AS [e] LEFT JOIN ( SELECT [e.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.BaseParent] - WHERE [e.BaseParent].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e.BaseParent].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t] ON [e].[ParentId] = [t].[Id] -WHERE [e].[Discriminator] IN (N'DerivedCollectionOnDerived', N'BaseCollectionOnDerived')"); +WHERE [e].[Discriminator] IN ('DerivedCollectionOnDerived', 'BaseCollectionOnDerived')"); } public override void Nested_include_with_inheritance_reference_reference1() @@ -582,14 +582,14 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] LEFT JOIN ( SELECT [e.BaseReferenceOnBase.NestedReference].* FROM [NestedReferenceBase] AS [e.BaseReferenceOnBase.NestedReference] - WHERE [e.BaseReferenceOnBase.NestedReference].[Discriminator] IN (N'NestedReferenceDerived', N'NestedReferenceBase') + WHERE [e.BaseReferenceOnBase.NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') ) AS [t0] ON [t].[Id] = [t0].[ParentReferenceId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity')"); +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity')"); } public override void Nested_include_with_inheritance_reference_reference2() @@ -610,14 +610,14 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] LEFT JOIN ( SELECT [e.BaseReferenceOnBase.NestedReference].* FROM [NestedReferenceBase] AS [e.BaseReferenceOnBase.NestedReference] - WHERE [e.BaseReferenceOnBase.NestedReference].[Discriminator] IN (N'NestedReferenceDerived', N'NestedReferenceBase') + WHERE [e.BaseReferenceOnBase.NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') ) AS [t0] ON [t].[Id] = [t0].[ParentReferenceId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity'"); +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity'"); } public override void Nested_include_with_inheritance_reference_reference4() @@ -638,14 +638,14 @@ FROM [NestedReferenceBase] AS [e] LEFT JOIN ( SELECT [e.ParentReference].* FROM [BaseReferenceOnBase] AS [e.ParentReference] - WHERE [e.ParentReference].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.ParentReference].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[ParentReferenceId] = [t].[Id] LEFT JOIN ( SELECT [e.ParentReference.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.ParentReference.BaseParent] - WHERE [e.ParentReference.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.ParentReference.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t0] ON [t].[BaseParentId] = [t0].[Id] -WHERE [e].[Discriminator] IN (N'NestedReferenceDerived', N'NestedReferenceBase')"); +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); } public override void Nested_include_with_inheritance_reference_collection1() @@ -658,9 +658,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ORDER BY [t].[Id]", // @"SELECT [e.BaseReferenceOnBase.NestedCollection].[Id], [e.BaseReferenceOnBase.NestedCollection].[Discriminator], [e.BaseReferenceOnBase.NestedCollection].[Name], [e.BaseReferenceOnBase.NestedCollection].[ParentCollectionId], [e.BaseReferenceOnBase.NestedCollection].[ParentReferenceId] @@ -671,11 +671,11 @@ INNER JOIN ( LEFT JOIN ( SELECT [e.BaseReferenceOnBase0].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase0] - WHERE [e.BaseReferenceOnBase0].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t1] ON [e.BaseReferenceOnBase.NestedCollection].[ParentReferenceId] = [t1].[Id] -WHERE [e.BaseReferenceOnBase.NestedCollection].[Discriminator] IN (N'NestedCollectionDerived', N'NestedCollectionBase') +WHERE [e.BaseReferenceOnBase.NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') ORDER BY [t1].[Id]"); } @@ -697,9 +697,9 @@ FROM [BaseInheritanceRelationshipEntity] AS [e] LEFT JOIN ( SELECT [e.BaseReferenceOnBase].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase] - WHERE [e.BaseReferenceOnBase].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[Id] = [t].[BaseParentId] -WHERE [e].[Discriminator] = N'DerivedInheritanceRelationshipEntity' +WHERE [e].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ORDER BY [t].[Id]", // @"SELECT [e.BaseReferenceOnBase.NestedCollection].[Id], [e.BaseReferenceOnBase.NestedCollection].[Discriminator], [e.BaseReferenceOnBase.NestedCollection].[Name], [e.BaseReferenceOnBase.NestedCollection].[ParentCollectionId], [e.BaseReferenceOnBase.NestedCollection].[ParentReferenceId] @@ -710,11 +710,11 @@ INNER JOIN ( LEFT JOIN ( SELECT [e.BaseReferenceOnBase0].* FROM [BaseReferenceOnBase] AS [e.BaseReferenceOnBase0] - WHERE [e.BaseReferenceOnBase0].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.BaseReferenceOnBase0].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t0] ON [e0].[Id] = [t0].[BaseParentId] - WHERE [e0].[Discriminator] = N'DerivedInheritanceRelationshipEntity' + WHERE [e0].[Discriminator] = 'DerivedInheritanceRelationshipEntity' ) AS [t1] ON [e.BaseReferenceOnBase.NestedCollection].[ParentReferenceId] = [t1].[Id] -WHERE [e.BaseReferenceOnBase.NestedCollection].[Discriminator] IN (N'NestedCollectionDerived', N'NestedCollectionBase') +WHERE [e.BaseReferenceOnBase.NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') ORDER BY [t1].[Id]"); } @@ -736,14 +736,14 @@ FROM [NestedCollectionBase] AS [e] LEFT JOIN ( SELECT [e.ParentReference].* FROM [BaseReferenceOnBase] AS [e.ParentReference] - WHERE [e.ParentReference].[Discriminator] IN (N'DerivedReferenceOnBase', N'BaseReferenceOnBase') + WHERE [e.ParentReference].[Discriminator] IN ('DerivedReferenceOnBase', 'BaseReferenceOnBase') ) AS [t] ON [e].[ParentReferenceId] = [t].[Id] LEFT JOIN ( SELECT [e.ParentReference.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.ParentReference.BaseParent] - WHERE [e.ParentReference.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.ParentReference.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t0] ON [t].[BaseParentId] = [t0].[Id] -WHERE [e].[Discriminator] IN (N'NestedCollectionDerived', N'NestedCollectionBase')"); +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); } public override void Nested_include_with_inheritance_collection_reference1() @@ -753,22 +753,22 @@ WHERE [e].[Discriminator] IN (N'NestedCollectionDerived', N'NestedCollectionBase AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ORDER BY [e].[Id]", // - @"SELECT [e.BaseCollectionOnBase].[Id], [e.BaseCollectionOnBase].[BaseParentId], [e.BaseCollectionOnBase].[Discriminator], [e.BaseCollectionOnBase].[Name], [e.BaseCollectionOnBase].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[ParentCollectionId], [t].[ParentReferenceId] -FROM [BaseCollectionOnBase] AS [e.BaseCollectionOnBase] + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty], [t].[Id], [t].[Discriminator], [t].[Name], [t].[ParentCollectionId], [t].[ParentReferenceId] +FROM [BaseCollectionOnBase] AS [e#BaseCollectionOnBase] LEFT JOIN ( SELECT [b.NestedReference].* FROM [NestedReferenceBase] AS [b.NestedReference] - WHERE [b.NestedReference].[Discriminator] IN (N'NestedReferenceDerived', N'NestedReferenceBase') -) AS [t] ON [e.BaseCollectionOnBase].[Id] = [t].[ParentCollectionId] + WHERE [b.NestedReference].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase') +) AS [t] ON [e#BaseCollectionOnBase].[Id] = [t].[ParentCollectionId] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') -) AS [t0] ON [e.BaseCollectionOnBase].[BaseParentId] = [t0].[Id] -WHERE [e.BaseCollectionOnBase].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t0] ON [e#BaseCollectionOnBase].[BaseParentId] = [t0].[Id] +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ORDER BY [t0].[Id]"); } @@ -806,14 +806,14 @@ FROM [NestedReferenceBase] AS [e] LEFT JOIN ( SELECT [e.ParentCollection].* FROM [BaseCollectionOnBase] AS [e.ParentCollection] - WHERE [e.ParentCollection].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e.ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ) AS [t] ON [e].[ParentCollectionId] = [t].[Id] LEFT JOIN ( SELECT [e.ParentCollection.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.ParentCollection.BaseParent] - WHERE [e.ParentCollection.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.ParentCollection.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t0] ON [t].[BaseParentId] = [t0].[Id] -WHERE [e].[Discriminator] IN (N'NestedReferenceDerived', N'NestedReferenceBase')"); +WHERE [e].[Discriminator] IN ('NestedReferenceDerived', 'NestedReferenceBase')"); } public override void Nested_include_with_inheritance_collection_collection1() @@ -823,18 +823,18 @@ WHERE [e].[Discriminator] IN (N'NestedReferenceDerived', N'NestedReferenceBase') AssertSql( @"SELECT [e].[Id], [e].[Discriminator], [e].[Name], [e].[BaseId] FROM [BaseInheritanceRelationshipEntity] AS [e] -WHERE [e].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') +WHERE [e].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ORDER BY [e].[Id]", // - @"SELECT [e.BaseCollectionOnBase].[Id], [e.BaseCollectionOnBase].[BaseParentId], [e.BaseCollectionOnBase].[Discriminator], [e.BaseCollectionOnBase].[Name], [e.BaseCollectionOnBase].[DerivedProperty] -FROM [BaseCollectionOnBase] AS [e.BaseCollectionOnBase] + @"SELECT [e#BaseCollectionOnBase].[Id], [e#BaseCollectionOnBase].[BaseParentId], [e#BaseCollectionOnBase].[Discriminator], [e#BaseCollectionOnBase].[Name], [e#BaseCollectionOnBase].[DerivedProperty] +FROM [BaseCollectionOnBase] AS [e#BaseCollectionOnBase] INNER JOIN ( SELECT [e0].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e0] - WHERE [e0].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') -) AS [t] ON [e.BaseCollectionOnBase].[BaseParentId] = [t].[Id] -WHERE [e.BaseCollectionOnBase].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') -ORDER BY [t].[Id], [e.BaseCollectionOnBase].[Id]", + WHERE [e0].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') +) AS [t] ON [e#BaseCollectionOnBase].[BaseParentId] = [t].[Id] +WHERE [e#BaseCollectionOnBase].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') +ORDER BY [t].[Id], [e#BaseCollectionOnBase].[Id]", // @"SELECT [e.BaseCollectionOnBase.NestedCollection].[Id], [e.BaseCollectionOnBase.NestedCollection].[Discriminator], [e.BaseCollectionOnBase.NestedCollection].[Name], [e.BaseCollectionOnBase.NestedCollection].[ParentCollectionId], [e.BaseCollectionOnBase.NestedCollection].[ParentReferenceId] FROM [NestedCollectionBase] AS [e.BaseCollectionOnBase.NestedCollection] @@ -844,11 +844,11 @@ INNER JOIN ( INNER JOIN ( SELECT [e1].[Id] FROM [BaseInheritanceRelationshipEntity] AS [e1] - WHERE [e1].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e1].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t0] ON [e.BaseCollectionOnBase0].[BaseParentId] = [t0].[Id] - WHERE [e.BaseCollectionOnBase0].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e.BaseCollectionOnBase0].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ) AS [t1] ON [e.BaseCollectionOnBase.NestedCollection].[ParentCollectionId] = [t1].[Id] -WHERE [e.BaseCollectionOnBase.NestedCollection].[Discriminator] IN (N'NestedCollectionDerived', N'NestedCollectionBase') +WHERE [e.BaseCollectionOnBase.NestedCollection].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase') ORDER BY [t1].[Id0], [t1].[Id]"); } @@ -886,14 +886,14 @@ FROM [NestedCollectionBase] AS [e] LEFT JOIN ( SELECT [e.ParentCollection].* FROM [BaseCollectionOnBase] AS [e.ParentCollection] - WHERE [e.ParentCollection].[Discriminator] IN (N'DerivedCollectionOnBase', N'BaseCollectionOnBase') + WHERE [e.ParentCollection].[Discriminator] IN ('DerivedCollectionOnBase', 'BaseCollectionOnBase') ) AS [t] ON [e].[ParentCollectionId] = [t].[Id] LEFT JOIN ( SELECT [e.ParentCollection.BaseParent].* FROM [BaseInheritanceRelationshipEntity] AS [e.ParentCollection.BaseParent] - WHERE [e.ParentCollection.BaseParent].[Discriminator] IN (N'DerivedInheritanceRelationshipEntity', N'BaseInheritanceRelationshipEntity') + WHERE [e.ParentCollection.BaseParent].[Discriminator] IN ('DerivedInheritanceRelationshipEntity', 'BaseInheritanceRelationshipEntity') ) AS [t0] ON [t].[BaseParentId] = [t0].[Id] -WHERE [e].[Discriminator] IN (N'NestedCollectionDerived', N'NestedCollectionBase')"); +WHERE [e].[Discriminator] IN ('NestedCollectionDerived', 'NestedCollectionBase')"); } public override void Nested_include_collection_reference_on_non_entity_base() @@ -921,6 +921,8 @@ ORDER BY [t].[Id]"); int i = 0; foreach (var item in expected) { + if (AssertSqlHelper.IgnoreStatement(item)) + return; expectedFixed[i++] = item.Replace("\r\n", "\n"); } Fixture.TestSqlLoggerFactory.AssertBaseline(expectedFixed); diff --git a/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs b/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs index e76c53b..0181611 100644 --- a/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs @@ -27,7 +27,7 @@ namespace EntityFramework.Jet.FunctionalTests if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -78,7 +78,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -129,7 +129,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -148,7 +148,7 @@ WHERE [e].[ParentId] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -165,7 +165,7 @@ WHERE [e].[Id] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -180,9 +180,9 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[ParentId] +SELECT TOP 2 [e].[Id], [e].[ParentId] FROM [Single] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); @@ -199,7 +199,7 @@ WHERE [e].[ParentId] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -216,7 +216,7 @@ WHERE [e].[Id] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id] +SELECT TOP 2 [e].[Id] FROM [SinglePkToPk] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -253,9 +253,9 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -268,9 +268,9 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -283,7 +283,7 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -334,7 +334,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -351,7 +351,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -370,7 +370,7 @@ WHERE [e].[ParentId] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='787' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -387,7 +387,7 @@ WHERE [e].[Id] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='787' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -402,9 +402,9 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' -SELECT TOP(2) [e].[Id], [e].[ParentId] +SELECT TOP 2 [e].[Id], [e].[ParentId] FROM [Single] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); @@ -485,7 +485,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -504,7 +504,7 @@ WHERE [e].[ParentId] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -521,7 +521,7 @@ WHERE [e].[Id] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -536,9 +536,9 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[ParentId] +SELECT TOP 2 [e].[Id], [e].[ParentId] FROM [Single] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); @@ -555,7 +555,7 @@ WHERE [e].[ParentId] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -572,7 +572,7 @@ WHERE [e].[Id] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id] +SELECT TOP 2 [e].[Id] FROM [SinglePkToPk] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -587,7 +587,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -638,7 +638,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -655,7 +655,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -706,7 +706,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -723,7 +723,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -774,7 +774,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -791,7 +791,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -842,7 +842,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='767' (Nullable = true) + @"@__get_Item_0='767' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -903,7 +903,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Child] AS [e] @@ -954,7 +954,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [Single] AS [e] @@ -971,7 +971,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT [e].[Id], [e].[ParentId] FROM [ChildAk] AS [e] @@ -988,7 +988,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] @@ -1005,7 +1005,7 @@ WHERE [e].[AlternateId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] @@ -1022,7 +1022,7 @@ WHERE [e].[AlternateId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT [e].[Id], [e].[ParentId] FROM [SingleAk] AS [e] @@ -1039,7 +1039,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) SELECT [e].[Id], [e].[ParentId] FROM [ChildAk] AS [e] @@ -1056,9 +1056,9 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[AlternateId] = @__get_Item_0", Sql); @@ -1073,9 +1073,9 @@ WHERE [e].[AlternateId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[AlternateId] = @__get_Item_0", Sql); @@ -1090,9 +1090,9 @@ WHERE [e].[AlternateId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) -SELECT TOP(2) [e].[Id], [e].[ParentId] +SELECT TOP 2 [e].[Id], [e].[ParentId] FROM [SingleAk] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); @@ -1129,9 +1129,9 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -1144,9 +1144,9 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -1159,7 +1159,7 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [ChildShadowFk] AS [e] @@ -1210,7 +1210,7 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [SingleShadowFk] AS [e] @@ -1227,7 +1227,7 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' SELECT [e].[Id], [e].[ParentId] FROM [ChildShadowFk] AS [e] @@ -1246,7 +1246,7 @@ WHERE [e].[ParentId] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -1263,7 +1263,7 @@ WHERE [e].[Id] = @__get_Item_0", Assert.Equal( @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE [e].[Id] = @__get_Item_0", Sql); @@ -1278,9 +1278,9 @@ WHERE [e].[Id] = @__get_Item_0", if (!async) { Assert.Equal( - @"@__get_Item_0='707' (Nullable = true) + @"@__get_Item_0='707' -SELECT TOP(2) [e].[Id], [e].[ParentId] +SELECT TOP 2 [e].[Id], [e].[ParentId] FROM [SingleShadowFk] AS [e] WHERE [e].[ParentId] = @__get_Item_0", Sql); @@ -1317,9 +1317,9 @@ WHERE [e].[ParentId] = @__get_Item_0", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -1332,9 +1332,9 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -1347,8 +1347,8 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) -@__get_Item_1='707' (Nullable = true) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) +@__get_Item_1='707' SELECT [e].[Id], [e].[ParentAlternateId], [e].[ParentId] FROM [ChildCompositeKey] AS [e] @@ -1365,7 +1365,7 @@ WHERE ([e].[ParentAlternateId] = @__get_Item_0) AND ([e].[ParentId] = @__get_Ite if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) @__get_Item_1='707' SELECT [e].[Id], [e].[AlternateId] @@ -1383,7 +1383,7 @@ WHERE ([e].[AlternateId] = @__get_Item_0) AND ([e].[Id] = @__get_Item_1)", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) @__get_Item_1='707' SELECT [e].[Id], [e].[AlternateId] @@ -1401,8 +1401,8 @@ WHERE ([e].[AlternateId] = @__get_Item_0) AND ([e].[Id] = @__get_Item_1)", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) -@__get_Item_1='707' (Nullable = true) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) +@__get_Item_1='707' SELECT [e].[Id], [e].[ParentAlternateId], [e].[ParentId] FROM [SingleCompositeKey] AS [e] @@ -1419,8 +1419,8 @@ WHERE ([e].[ParentAlternateId] = @__get_Item_0) AND ([e].[ParentId] = @__get_Ite if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) -@__get_Item_1='707' (Nullable = true) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) +@__get_Item_1='707' SELECT [e].[Id], [e].[ParentAlternateId], [e].[ParentId] FROM [ChildCompositeKey] AS [e] @@ -1437,10 +1437,10 @@ WHERE ([e].[ParentAlternateId] = @__get_Item_0) AND ([e].[ParentId] = @__get_Ite if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) @__get_Item_1='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE ([e].[AlternateId] = @__get_Item_0) AND ([e].[Id] = @__get_Item_1)", Sql); @@ -1455,10 +1455,10 @@ WHERE ([e].[AlternateId] = @__get_Item_0) AND ([e].[Id] = @__get_Item_1)", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) @__get_Item_1='707' -SELECT TOP(2) [e].[Id], [e].[AlternateId] +SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] WHERE ([e].[AlternateId] = @__get_Item_0) AND ([e].[Id] = @__get_Item_1)", Sql); @@ -1473,10 +1473,10 @@ WHERE ([e].[AlternateId] = @__get_Item_0) AND ([e].[Id] = @__get_Item_1)", if (!async) { Assert.Equal( - @"@__get_Item_0='Root' (Size = 256) -@__get_Item_1='707' (Nullable = true) + @"@__get_Item_0='Root' (Nullable = false) (Size = 4) +@__get_Item_1='707' -SELECT TOP(2) [e].[Id], [e].[ParentAlternateId], [e].[ParentId] +SELECT TOP 2 [e].[Id], [e].[ParentAlternateId], [e].[ParentId] FROM [SingleCompositeKey] AS [e] WHERE ([e].[ParentAlternateId] = @__get_Item_0) AND ([e].[ParentId] = @__get_Item_1)", Sql); @@ -1513,9 +1513,9 @@ WHERE ([e].[ParentAlternateId] = @__get_Item_0) AND ([e].[ParentId] = @__get_Ite if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } @@ -1528,9 +1528,9 @@ WHERE 0 = 1", if (!async) { Assert.Equal( - @"SELECT TOP(2) [e].[Id], [e].[AlternateId] + @"SELECT TOP 2 [e].[Id], [e].[AlternateId] FROM [Parent] AS [e] -WHERE 0 = 1", +WHERE False = True", Sql); } } diff --git a/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs b/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs index f0e8eff..2367be0 100644 --- a/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs +++ b/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs @@ -96,6 +96,7 @@ namespace EntityFramework.Jet.FunctionalTests if (createDatabase) { + JetConnection.DropDatabase(_connectionString, false); _connection.CreateEmptyDatabase(); _connection.Open(); } diff --git a/test/EFCore.Jet.Integration.Test/DefaultValueTest.cs b/test/EFCore.Jet.Integration.Test/DefaultValueTest.cs new file mode 100644 index 0000000..2c7ea69 --- /dev/null +++ b/test/EFCore.Jet.Integration.Test/DefaultValueTest.cs @@ -0,0 +1,83 @@ +using System; +using System.Data.Common; +using System.Data.Jet; +using System.Linq; +using EFCore.Jet.Integration.Test; +using Microsoft.EntityFrameworkCore; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace EntityFramework.Jet.FunctionalTests +{ + [TestClass] + public class DefaultValuesTest : TestBase + { + + [TestMethod] + public void Can_use_Jet_default_values() + { + Context.Chippers.Add(new Chipper { Id = "Default" }); + + Context.SaveChanges(); + + var honeyDijon = Context.Add(new KettleChips { Name = "Honey Dijon" }).Entity; + var buffaloBleu = Context.Add(new KettleChips { Name = "Buffalo Bleu", BestBuyDate = new DateTime(2111, 1, 11) }).Entity; + + Context.SaveChanges(); + + Assert.AreEqual(new DateTime(2035, 9, 25), honeyDijon.BestBuyDate); + Assert.AreEqual(new DateTime(2111, 1, 11), buffaloBleu.BestBuyDate); + + base.DisposeContext(); + base.CreateContext(); + + Assert.AreEqual(new DateTime(2035, 9, 25), Context.Chips.Single(c => c.Name == "Honey Dijon").BestBuyDate); + Assert.AreEqual(new DateTime(2111, 1, 11), Context.Chips.Single(c => c.Name == "Buffalo Bleu").BestBuyDate); + } + + + protected override DbConnection GetConnection() + { + string connectionString = JetConnection.GetConnectionString("Chips.accdb"); + return new JetConnection(connectionString); + } + } + + public class ChipsContext : DbContext + { + public ChipsContext(DbContextOptions options) : base(options) + { + } + + public DbSet Chips { get; set; } + public DbSet Chippers { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + => modelBuilder.Entity(b => + { + b.Property(e => e.BestBuyDate) + .ValueGeneratedOnAdd() + .HasDefaultValue(new DateTime(2035, 9, 25)); + + b.Property(e => e.ChipperId) + .IsRequired() + .HasDefaultValue("Default"); + }); + } + + public class KettleChips + { + public int Id { get; set; } + public string Name { get; set; } + public DateTime BestBuyDate { get; set; } + public string ChipperId { get; set; } + + public Chipper Manufacturer { get; set; } + } + + public class Chipper + { + public string Id { get; set; } + } + + +} diff --git a/test/EFCore.Jet.Integration.Test/EFCore.Jet.Integration.Test.csproj b/test/EFCore.Jet.Integration.Test/EFCore.Jet.Integration.Test.csproj index 2b29b89..140520f 100644 --- a/test/EFCore.Jet.Integration.Test/EFCore.Jet.Integration.Test.csproj +++ b/test/EFCore.Jet.Integration.Test/EFCore.Jet.Integration.Test.csproj @@ -148,6 +148,7 @@ +