diff --git a/DB2/Tests/DataProvider/DB2Tests/Tests.DataProvider.DB2Tests.Issue2763Test(DB2).sql b/DB2/Tests/DataProvider/DB2Tests/Tests.DataProvider.DB2Tests.Issue2763Test(DB2).sql index 61fdbdff5932..a1b1463d7996 100644 --- a/DB2/Tests/DataProvider/DB2Tests/Tests.DataProvider.DB2Tests.Issue2763Test(DB2).sql +++ b/DB2/Tests/DataProvider/DB2Tests/Tests.DataProvider.DB2Tests.Issue2763Test(DB2).sql @@ -17,7 +17,7 @@ SELECT FROM SYSCAT.INDEXES WHERE - UNIQUERULE = 'P' AND TABSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') + UNIQUERULE = 'P' AND TABSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') -- DB2 DB2.LUW DB2LUW @@ -37,7 +37,7 @@ SELECT FROM SYSCAT.COLUMNS WHERE - TABSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') + TABSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') -- DB2 DB2.LUW DB2LUW @@ -53,7 +53,7 @@ SELECT FROM SYSCAT.REFERENCES WHERE - TABSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') + TABSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') -- DB2 DB2.LUW DB2LUW @@ -72,7 +72,7 @@ SELECT * FROM ( FROM SYSCAT.PROCEDURES p LEFT JOIN SYSCAT.MODULEOBJECTS o ON p.SPECIFICNAME = o.SPECIFICNAME - WHERE p.PROCSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') + WHERE p.PROCSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') UNION ALL SELECT f.SPECIFICNAME, @@ -87,7 +87,7 @@ SELECT * FROM ( FROM SYSCAT.FUNCTIONS f LEFT JOIN SYSCAT.MODULEOBJECTS o ON f.SPECIFICNAME = o.SPECIFICNAME - WHERE f.FUNCSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS')) + WHERE f.FUNCSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS')) ORDER BY OBJECTMODULENAME, PROCSCHEMA, PROCNAME, PARM_COUNT -- DB2 DB2.LUW DB2LUW @@ -106,7 +106,7 @@ SELECT NULLS FROM SYSCAT.PROCPARMS -WHERE PROCSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') +WHERE PROCSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') UNION ALL SELECT SPECIFICNAME, @@ -121,7 +121,7 @@ SELECT 'Y' FROM SYSCAT.FUNCPARMS - WHERE ROWTYPE <> 'R' AND FUNCSCHEMA IN ('DB2INST1', 'NULLID', 'SESSION', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') + WHERE ROWTYPE <> 'R' AND FUNCSCHEMA IN ('DB2INST1', 'NULLID', 'SQLJ', 'SYSCAT', 'SYSFUN', 'SYSIBM', 'SYSIBMADM', 'SYSIBMINTERNAL', 'SYSIBMTS', 'SYSPROC', 'SYSPUBLIC', 'SYSSTAT', 'SYSTOOLS') -- DB2 DB2.LUW DB2LUW DECLARE @NAME VarChar(128) -- String diff --git a/Oracle.12.Managed/Tests/Linq/ComplexTests2/Tests.Linq.ComplexTests2.TestInsertUsingDerivedObjectUsingAttributes(Oracle.12.Managed).sql.other b/Oracle.12.Managed/Tests/Linq/ComplexTests2/Tests.Linq.ComplexTests2.TestInsertUsingDerivedObjectUsingAttributes(Oracle.12.Managed).sql.other new file mode 100644 index 000000000000..7d462ca6364d --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/ComplexTests2/Tests.Linq.ComplexTests2.TestInsertUsingDerivedObjectUsingAttributes(Oracle.12.Managed).sql.other @@ -0,0 +1,88 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @FirstName Varchar2(21) -- String +SET @FirstName = 'test_inherited_insert' +DECLARE @LastName Varchar2(4) -- String +SET @LastName = 'test' +DECLARE @MiddleName Varchar2(4) -- String +SET @MiddleName = 'test' +DECLARE @Gender Char(1) -- AnsiStringFixedLength +SET @Gender = 'U' +DECLARE @IDENTITY_PARAMETER Decimal +SET @IDENTITY_PARAMETER = NULL + +INSERT INTO "Person" +( + "FirstName", + "LastName", + "MiddleName", + "Gender" +) +VALUES +( + :FirstName, + :LastName, + :MiddleName, + :Gender +) +RETURNING + "PersonID" INTO :IDENTITY_PARAMETER + +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t1."FirstName", + t1."PersonID" as ID, + t1."LastName", + t1."MiddleName", + t1."Gender" +FROM + "Person" t1 +WHERE + t1."FirstName" = 'test_inherited_insert' +FETCH NEXT 1 ROWS ONLY + +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @FirstName Varchar2(21) -- String +SET @FirstName = 'test_inherited_insert' +DECLARE @LastName Varchar2(4) -- String +SET @LastName = 'test' +DECLARE @MiddleName Varchar2(4) -- String +SET @MiddleName = 'test' +DECLARE @Gender Char(1) -- AnsiStringFixedLength +SET @Gender = 'U' +DECLARE @ID Int32 +SET @ID = 5 + +UPDATE + "Person" t1 +SET + "FirstName" = :FirstName, + "LastName" = :LastName, + "MiddleName" = :MiddleName, + "Gender" = :Gender +WHERE + t1."PersonID" = :ID + +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t1."FirstName", + t1."PersonID" as ID, + t1."LastName", + t1."MiddleName", + t1."Gender" +FROM + "Person" t1 +WHERE + t1."FirstName" = 'test_inherited_insert' +FETCH NEXT 1 ROWS ONLY + +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @ID Int32 +SET @ID = 5 + +DELETE FROM + "Person" t1 +WHERE + t1."PersonID" = :ID + diff --git a/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.17).sql b/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.17).sql index 090d4b5843a3..352a713af952 100644 --- a/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.17).sql +++ b/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.17).sql @@ -56,7 +56,7 @@ SELECT * FROM testdata.public."GetParentByID"(NULL::integer) -- PostgreSQL.17 PostgreSQL.15 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) +SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) -- PostgreSQL.17 PostgreSQL.15 PostgreSQL @@ -64,7 +64,7 @@ SELECT * FROM testdata.public."TestTableFunctionSchema"() -- PostgreSQL.17 PostgreSQL.15 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) +SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) -- PostgreSQL.17 PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.17).sql b/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.17).sql index 1983cc772224..53c6db777a66 100644 --- a/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.17).sql +++ b/PostgreSQL.17/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.17).sql @@ -56,7 +56,7 @@ SELECT * FROM testdata.public."GetParentByID"(NULL::integer) -- PostgreSQL.17 PostgreSQL.15 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) +SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) -- PostgreSQL.17 PostgreSQL.15 PostgreSQL @@ -64,7 +64,7 @@ SELECT * FROM testdata.public."TestTableFunctionSchema"() -- PostgreSQL.17 PostgreSQL.15 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) +SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) RollbackTransaction -- PostgreSQL.17 PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.18).sql b/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.18).sql index c883ea243632..37d0d5f992a5 100644 --- a/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.18).sql +++ b/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithTransaction(PostgreSQL.18).sql @@ -56,7 +56,7 @@ SELECT * FROM testdata.public."GetParentByID"(NULL::integer) -- PostgreSQL.18 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) +SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) -- PostgreSQL.18 PostgreSQL @@ -64,7 +64,7 @@ SELECT * FROM testdata.public."TestTableFunctionSchema"() -- PostgreSQL.18 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) +SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) -- PostgreSQL.18 PostgreSQL diff --git a/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.18).sql b/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.18).sql index f862127ff570..9ace224e34ab 100644 --- a/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.18).sql +++ b/PostgreSQL.18/Tests/UserTests/Issue792Tests/Tests.UserTests.Issue792Tests.TestWithoutTransaction(PostgreSQL.18).sql @@ -56,7 +56,7 @@ SELECT * FROM testdata.public."GetParentByID"(NULL::integer) -- PostgreSQL.18 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) +SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) -- PostgreSQL.18 PostgreSQL @@ -64,7 +64,7 @@ SELECT * FROM testdata.public."TestTableFunctionSchema"() -- PostgreSQL.18 PostgreSQL -SELECT * FROM testdata.public."TestTableFunction1"(NULL::integer,NULL::integer) +SELECT * FROM testdata.public."TestTableFunction"(NULL::integer) RollbackTransaction -- PostgreSQL.18 PostgreSQL diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ConvertorTests/LinqToDB.EntityFrameworkCore.Tests.ConvertorTests.TestToList(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ConvertorTests/LinqToDB.EntityFrameworkCore.Tests.ConvertorTests.TestToList(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..359ceabf2c94 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ConvertorTests/LinqToDB.EntityFrameworkCore.Tests.ConvertorTests.TestToList(SqlServer.2022.MS).sql @@ -0,0 +1,164 @@ +-- SqlServer.2022 +DECLARE @Id BigInt -- Int64 +SET @Id = 1 +DECLARE @PermanentId UniqueIdentifier -- Guid +SET @PermanentId = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' +DECLARE @Code NVarChar(4000) -- String +SET @Code = N'C1' +DECLARE @Name NVarChar(4000) -- String +SET @Name = N'N1' +DECLARE @IsDeleted Bit -- Boolean +SET @IsDeleted = NULL + +INSERT INTO [Subdivisions] +( + [Id], + [PermanentId], + [Code], + [Name], + [IsDeleted] +) +VALUES +( + @Id, + @PermanentId, + @Code, + @Name, + @IsDeleted +) + +SELECT SCOPE_IDENTITY() + + + +-- SqlServer.2022 +DECLARE @Id BigInt -- Int64 +SET @Id = 2 +DECLARE @PermanentId UniqueIdentifier -- Guid +SET @PermanentId = 'a948600d-de21-4f74-8ac2-9516b287076e' +DECLARE @Code NVarChar(4000) -- String +SET @Code = N'C2' +DECLARE @Name NVarChar(4000) -- String +SET @Name = N'N2' +DECLARE @IsDeleted Bit -- Boolean +SET @IsDeleted = NULL + +INSERT INTO [Subdivisions] +( + [Id], + [PermanentId], + [Code], + [Name], + [IsDeleted] +) +VALUES +( + @Id, + @PermanentId, + @Code, + @Name, + @IsDeleted +) + +SELECT SCOPE_IDENTITY() + + + +-- SqlServer.2022 +DECLARE @Id BigInt -- Int64 +SET @Id = 3 +DECLARE @PermanentId UniqueIdentifier -- Guid +SET @PermanentId = 'bd3973a5-4323-4dd8-9f4f-df9f93e2a627' +DECLARE @Code NVarChar(4000) -- String +SET @Code = N'C3' +DECLARE @Name NVarChar(4000) -- String +SET @Name = N'N3' +DECLARE @IsDeleted Bit -- Boolean +SET @IsDeleted = NULL + +INSERT INTO [Subdivisions] +( + [Id], + [PermanentId], + [Code], + [Name], + [IsDeleted] +) +VALUES +( + @Id, + @PermanentId, + @Code, + @Name, + @IsDeleted +) + +SELECT SCOPE_IDENTITY() + + + +SELECT [s].[Id], [s].[Code], [s].[IsDeleted], [s].[Name], [s].[PermanentId] +FROM [Subdivisions] AS [s] +WHERE CAST([s].[Id] AS bigint) = CAST(1 AS bigint) + + +-- SqlServer.2022 + +SELECT + [s].[Id], + [s].[PermanentId], + [s].[Code], + [s].[Name], + [s].[IsDeleted] +FROM + [Subdivisions] [s] +WHERE + CAST([s].[Id] AS BigInt) = 1 + + + +-- SqlServer.2022 +DECLARE @id BigInt -- Int64 +SET @id = 1 + +SELECT + [s].[Id], + [s].[PermanentId], + [s].[Code], + [s].[Name], + [s].[IsDeleted] +FROM + [Subdivisions] [s] +WHERE + [s].[Id] = @id + + + +-- SqlServer.2022 + +SELECT + [s].[Id], + [s].[PermanentId], + [s].[Code], + [s].[Name], + [s].[IsDeleted] +FROM + [Subdivisions] [s] +WHERE + [s].[Id] IN (2, 3) + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[PermanentId], + [t1].[Code], + [t1].[Name], + [t1].[IsDeleted] +FROM + [Subdivisions] [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/CustomContextIssueTests/LinqToDB.EntityFrameworkCore.Tests.CustomContextIssueTests.Issue261Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/CustomContextIssueTests/LinqToDB.EntityFrameworkCore.Tests.CustomContextIssueTests.Issue261Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..61a82adf5b35 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/CustomContextIssueTests/LinqToDB.EntityFrameworkCore.Tests.CustomContextIssueTests.Issue261Test(SqlServer.2022.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Name] +FROM + [Issue261Table] [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestAmbiguousProperties(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestAmbiguousProperties(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..3c073d8eed0b --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestAmbiguousProperties(SqlServer.2022.MS).sql @@ -0,0 +1,5 @@ +SELECT [w].[Id], [w].[Value] +FROM [WithDuplicateProperties] AS [w] +WHERE [w].[Value] = 1 + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestBulkCopyNoIdentity(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestBulkCopyNoIdentity(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f88dcfe3f005 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestBulkCopyNoIdentity(SqlServer.2022.MS).sql @@ -0,0 +1,32 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#NoIdentity] +( + [Id] uniqueidentifier NOT NULL, + [Name] nvarchar(max) NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +INSERT BULK [tempdb]..[#NoIdentity](Id, Name) + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Name] +FROM + [tempdb]..[#NoIdentity] [t1] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#NoIdentity] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestBulkCopyWithIdentity(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestBulkCopyWithIdentity(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..c90a7196a680 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestBulkCopyWithIdentity(SqlServer.2022.MS).sql @@ -0,0 +1,32 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#WithIdentity] +( + [Id] int NOT NULL IDENTITY, + [Name] nvarchar(max) NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +INSERT BULK [tempdb]..[#WithIdentity](Name) + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Name] +FROM + [tempdb]..[#WithIdentity] [t1] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#WithIdentity] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestInheritance(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestInheritance(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..76ebd51d88d5 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestInheritance(SqlServer.2022.MS).sql @@ -0,0 +1,34 @@ +Parameters: +@p0='?' (Size = 4000), @p1='?' (Size = 4000), @p2='?' (Size = 4000), @p3='?' (Size = 4000), @p4='?' (Size = 4000) + +SET NOCOUNT ON; +DECLARE @inserted0 TABLE ([Id] int, [_Position] [int]); +MERGE [WithInheritance] USING ( +VALUES (@p0, 0), +(@p1, 1), +(@p2, 2), +(@p3, 3), +(@p4, 4)) AS i ([Discriminator], _Position) ON 1=0 +WHEN NOT MATCHED THEN +INSERT ([Discriminator]) +VALUES (i.[Discriminator]) +OUTPUT INSERTED.[Id], i._Position +INTO @inserted0; + +SELECT [t].[Id] FROM [WithInheritance] t +INNER JOIN @inserted0 i ON ([t].[Id] = [i].[Id]) +ORDER BY [i].[_Position]; + + +-- SqlServer.2022 + +SELECT + [t1].[Discriminator], + [t1].[Id] +FROM + [WithInheritance] [t1] +WHERE + [t1].[Discriminator] IN (N'WithInheritanceA2', N'WithInheritanceA1', N'WithInheritanceA') + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestNativeBulkCopyAsyncNoIdentity(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestNativeBulkCopyAsyncNoIdentity(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f6f2597c7356 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestNativeBulkCopyAsyncNoIdentity(SqlServer.2022.MS).sql @@ -0,0 +1,32 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#NoIdentity] +( + [Id] uniqueidentifier NOT NULL, + [Name] nvarchar(max) NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +INSERT ASYNC BULK [tempdb]..[#NoIdentity](Id, Name) + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Name] +FROM + [tempdb]..[#NoIdentity] [t1] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#NoIdentity] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestNativeBulkCopyNoIdentity(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestNativeBulkCopyNoIdentity(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f88dcfe3f005 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestNativeBulkCopyNoIdentity(SqlServer.2022.MS).sql @@ -0,0 +1,32 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#NoIdentity] +( + [Id] uniqueidentifier NOT NULL, + [Name] nvarchar(max) NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +INSERT BULK [tempdb]..[#NoIdentity](Id, Name) + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Name] +FROM + [tempdb]..[#NoIdentity] [t1] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#NoIdentity] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestSkipModes(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestSkipModes(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..544e0ad11325 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestSkipModes(SqlServer.2022.MS).sql @@ -0,0 +1,79 @@ +Parameters: +@p0='?' (DbType = Int32), @p1='?' (DbType = Int32) + +SET NOCOUNT ON; +INSERT INTO [SkipModes] ([Id], [InsertOnly]) +VALUES (@p0, @p1); + + +-- SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @InsertOnly Int -- Int32 +SET @InsertOnly = 2 + +INSERT INTO [SkipModes] +( + [Id], + [InsertOnly] +) +VALUES +( + @Id, + @InsertOnly +) + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[InsertOnly], + [t1].[UpdateOnly], + [t1].[ReadOnly] +FROM + [SkipModes] [t1] +ORDER BY + [t1].[Id] + + + +Parameters: +@p1='?' (DbType = Int32), @p0='?' (DbType = Int32) + +SET NOCOUNT ON; +UPDATE [SkipModes] SET [UpdateOnly] = @p0 +WHERE [Id] = @p1; +SELECT @@ROWCOUNT; + + +-- SqlServer.2022 +DECLARE @UpdateOnly Int -- Int32 +SET @UpdateOnly = 12 +DECLARE @Id Int -- Int32 +SET @Id = 2 + +UPDATE + [SkipModes] +SET + [UpdateOnly] = @UpdateOnly +WHERE + [SkipModes].[Id] = @Id + + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[InsertOnly], + [t1].[UpdateOnly], + [t1].[ReadOnly] +FROM + [SkipModes] [t1] +ORDER BY + [t1].[Id] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestTableCreation(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestTableCreation(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..249f0a5a0524 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestTableCreation(SqlServer.2022.MS).sql @@ -0,0 +1,36 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#WithIdentity] +( + [Id] int NOT NULL IDENTITY, + [Name] nvarchar(max) NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#NoIdentity] +( + [Id] uniqueidentifier NOT NULL, + [Name] nvarchar(max) NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#NoIdentity] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#WithIdentity] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestUIntTable(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestUIntTable(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..3abaf3dd36fa --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ForMappingTests/LinqToDB.EntityFrameworkCore.Tests.ForMappingTests.TestUIntTable(SqlServer.2022.MS).sql @@ -0,0 +1,30 @@ +Parameters: +@p0='?' (DbType = Int32), @p1='?' (DbType = Int32), @p2='?' (DbType = Int64), @p3='?' (DbType = Int64), @p4='?' (DbType = Decimal), @p5='?' (DbType = Decimal) + +SET NOCOUNT ON; +INSERT INTO [UIntTable] ([Field16], [Field16N], [Field32], [Field32N], [Field64], [Field64N]) +VALUES (@p0, @p1, @p2, @p3, @p4, @p5); +SELECT [ID] +FROM [UIntTable] +WHERE @@ROWCOUNT = 1 AND [ID] = scope_identity(); + + +-- SqlServer.2022 +DECLARE @field64 Decimal +SET @field64 = 5 + +SELECT TOP (1) + [e].[ID], + [e].[Field16], + [e].[Field32], + [e].[Field64], + [e].[Field16N], + [e].[Field32N], + [e].[Field64N] +FROM + [UIntTable] [e] +WHERE + [e].[Field64] = @field64 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,Default).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,Default).sql new file mode 100644 index 000000000000..f0fb4fd80b5e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,Default).sql @@ -0,0 +1,43 @@ +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_base' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'BlogUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_rss' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'RssUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +SELECT [b].[Id], [b].[BlogType], [b].[Url] +FROM [Blogs] AS [b] +WHERE [b].[BlogType] IN (N'blog_base', N'blog_rss') + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,MultipleRows).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,MultipleRows).sql new file mode 100644 index 000000000000..f0fb4fd80b5e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,MultipleRows).sql @@ -0,0 +1,43 @@ +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_base' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'BlogUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_rss' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'RssUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +SELECT [b].[Id], [b].[BlogType], [b].[Url] +FROM [Blogs] AS [b] +WHERE [b].[BlogType] IN (N'blog_base', N'blog_rss') + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,ProviderSpecific).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,ProviderSpecific).sql new file mode 100644 index 000000000000..f0fb4fd80b5e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,ProviderSpecific).sql @@ -0,0 +1,43 @@ +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_base' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'BlogUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_rss' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'RssUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +SELECT [b].[Id], [b].[BlogType], [b].[Url] +FROM [Blogs] AS [b] +WHERE [b].[BlogType] IN (N'blog_base', N'blog_rss') + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,RowByRow).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,RowByRow).sql new file mode 100644 index 000000000000..f0fb4fd80b5e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InheritanceTests/LinqToDB.EntityFrameworkCore.Tests.InheritanceTests.TestInheritanceBulkCopy(SqlServer.2022.MS,RowByRow).sql @@ -0,0 +1,43 @@ +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_base' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'BlogUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +-- SqlServer.2022 +DECLARE @BlogType NVarChar(200) -- String +SET @BlogType = N'blog_rss' +DECLARE @Url NVarChar(4000) -- String +SET @Url = N'RssUrl' + +INSERT INTO [Blogs] +( + [BlogType], + [Url] +) +VALUES +( + @BlogType, + @Url +) + + + +SELECT [b].[Id], [b].[BlogType], [b].[Url] +FROM [Blogs] AS [b] +WHERE [b].[BlogType] IN (N'blog_base', N'blog_rss') + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestEfCoreSideOfComboInterceptor(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestEfCoreSideOfComboInterceptor(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..146a526d6f0f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestEfCoreSideOfComboInterceptor(SqlServer.2022.MS).sql @@ -0,0 +1,9 @@ +Parameters: +@__p_0='?' (DbType = Int32), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT TOP(@__p_0) [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND ([p].[ProductID] > 0) +ORDER BY [p].[ProductID] + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestExplicitDataContextInterceptors(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestExplicitDataContextInterceptors(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..2de9ba673124 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestExplicitDataContextInterceptors(SqlServer.2022.MS).sql @@ -0,0 +1,50 @@ +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 2 + +SELECT TOP (@take) + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductID] > 0 +ORDER BY + [e].[ProductID] + + + +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 2 + +SELECT TOP (@take) + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductID] > 0 +ORDER BY + [e].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestInterceptors(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestInterceptors(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a3ee59af2707 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestInterceptors(SqlServer.2022.MS).sql @@ -0,0 +1,25 @@ +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 2 + +SELECT TOP (@take) + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductID] > 0 +ORDER BY + [e].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestLinqToDBSideOfComboInterceptor(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestLinqToDBSideOfComboInterceptor(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a3ee59af2707 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/InterceptorTests/LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestLinqToDBSideOfComboInterceptor(SqlServer.2022.MS).sql @@ -0,0 +1,25 @@ +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 2 + +SELECT TOP (@take) + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductID] > 0 +ORDER BY + [e].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue117Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue117Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..b1a442964bac --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue117Test(SqlServer.2022.MS).sql @@ -0,0 +1,24 @@ +Parameters: +@__userId_1='?' (DbType = Int32), @__userId_0='?' (DbType = Int32) + +SELECT [p].[Id] AS [PatentId], @__userId_1 AS [UserId] +FROM [Patents] AS [p] +LEFT JOIN [PatentAssessment] AS [p0] ON [p].[Id] = [p0].[PatentId] +WHERE [p0].[PatentId] IS NULL OR (([p0].[TechnicalReviewerId] <> @__userId_0) OR [p0].[TechnicalReviewerId] IS NULL) + + +-- SqlServer.2022 +DECLARE @userId Int -- Int32 +SET @userId = 1 + +SELECT + [p].[Id] +FROM + [Patents] [p] + LEFT JOIN [PatentAssessment] [a_Assessment] ON [p].[Id] = [a_Assessment].[PatentId] +WHERE + [a_Assessment].[PatentId] IS NULL OR [a_Assessment].[TechnicalReviewerId] <> @userId OR + [a_Assessment].[TechnicalReviewerId] IS NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue129Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue129Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..17ed2ec55a17 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue129Test(SqlServer.2022.MS).sql @@ -0,0 +1,18 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#Issue129Table] +( + [Id] int NOT NULL IDENTITY, + [Key] int NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#Issue129Table] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue201Test1(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue201Test1(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..1f302ec06ff1 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue201Test1(SqlServer.2022.MS).sql @@ -0,0 +1,18 @@ +-- SqlServer.2022 + +SELECT + COUNT(*) +FROM + [Parents] [x] +WHERE + ( + SELECT TOP (1) + [a_Children].[IsActive] + FROM + [Children] [a_Children] + WHERE + [x].[Id] = [a_Children].[ParentId] + ) = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue201Test2(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue201Test2(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..493b75e16a51 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue201Test2(SqlServer.2022.MS).sql @@ -0,0 +1,18 @@ +-- SqlServer.2022 + +SELECT + COUNT(*) +FROM + [Parents] [x] +WHERE + NOT EXISTS( + SELECT + * + FROM + [Children] [y] + WHERE + [x].[Id] = [y].[ParentId] AND [y].[IsActive] = 1 + ) + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue321Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue321Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..1ea8ab425237 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue321Test(SqlServer.2022.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id] +FROM + [Patents] [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue340Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue340Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..4f389a2c95ba --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue340Test(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2022 + +SELECT + [x].[Id] +FROM + [Issue340Entities] [x] +WHERE + [x].[IsActive] = 1 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4570Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4570Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..0b43e0bafc24 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4570Test(SqlServer.2022.MS).sql @@ -0,0 +1,16 @@ +-- SqlServer.2022 + +SELECT + 1 +FROM + [Parents] [ua] +WHERE + [ua].[ParentId] = 55377 AND EXISTS( + SELECT + * + FROM + [Parents] [t1] + ) + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4625TestDefault(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4625TestDefault(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..73c52cc983f4 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4625TestDefault(SqlServer.2022.MS).sql @@ -0,0 +1,16 @@ +-- SqlServer.2022 +DECLARE @DateTimeOffset DateTimeOffset +SET @DateTimeOffset = DATETIMEOFFSETFROMPARTS(2020, 2, 29, 17, 54, 55, 1231234, 0, 0, 7) +DECLARE @DateTimeOffsetN DateTimeOffset +SET @DateTimeOffsetN = DATETIMEOFFSETFROMPARTS(2020, 2, 29, 17, 54, 55, 1231234, 0, 0, 7) + +UPDATE + [Types] +SET + [DateTimeOffset] = @DateTimeOffset, + [DateTimeOffsetN] = @DateTimeOffsetN +WHERE + [Types].[Id] = 2 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4625TestWithConverter(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4625TestWithConverter(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..4a94df867841 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4625TestWithConverter(SqlServer.2022.MS).sql @@ -0,0 +1,16 @@ +-- SqlServer.2022 +DECLARE @DateTimeOffsetWithConverter BigInt -- Int64 +SET @DateTimeOffsetWithConverter = 1304956839836121088 +DECLARE @DateTimeOffsetNWithConverter BigInt -- Int64 +SET @DateTimeOffsetNWithConverter = 1304956839836121088 + +UPDATE + [Types] +SET + [DateTimeOffsetWithConverter] = @DateTimeOffsetWithConverter, + [DateTimeOffsetNWithConverter] = @DateTimeOffsetNWithConverter +WHERE + [Types].[Id] = 2 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4626Test2(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4626Test2(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..3c9280cd2896 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4626Test2(SqlServer.2022.MS).sql @@ -0,0 +1,37 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[Id], + [d_1].[Key_1], + [d_1].[Sum_1], + [d_1].[Des] +FROM + [Parents] [m_1] + CROSS APPLY ( + SELECT + [d].[ParentId] as [Key_1], + SUM([d].[Id]) as [Sum_1], + STRING_AGG([d].[Name], N', ') as [Des] + FROM + [Children] [d] + WHERE + [m_1].[Id] = [d].[ParentId] + GROUP BY + [d].[ParentId] + ) [d_1] + + + + + +-- SqlServer.2022 + +SELECT + [c_1].[Id] +FROM + [Parents] [c_1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4629Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4629Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..2fc3bb3f3558 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4629Test(SqlServer.2022.MS).sql @@ -0,0 +1,41 @@ +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 10 + +SELECT + COUNT(*) OVER(), + [id].[Id] +FROM + ( + SELECT TOP (@take) + [t1].[Id] + FROM + ( + SELECT + [p].[Id], + ( + SELECT + SUM([a_Tags].[Weight]) + FROM + [Issue4629Tags] [a_Tags] + WHERE + [p].[Id] = [a_Tags].[PostId] + ) as [Sum_1] + FROM + [Issue4629Posts] [p] + ) [t1] + WHERE + ( + SELECT + SUM([a_Tags_1].[Weight]) + FROM + [Issue4629Tags] [a_Tags_1] + WHERE + [t1].[Id] = [a_Tags_1].[PostId] AND [a_Tags_1].[Weight] > 1 + ) > 5 + ORDER BY + [t1].[Sum_1] + ) [id] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4630Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4630Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..596de3080e00 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4630Test(SqlServer.2022.MS).sql @@ -0,0 +1,19 @@ +-- SqlServer.2022 +DECLARE @id Int -- Int32 +SET @id = 2 + +SELECT TOP (1) + [t1].[Index_1] +FROM + ( + SELECT + [x].[Id], + ROW_NUMBER() OVER(ORDER BY [x].[Id]) as [Index_1] + FROM + [Parents] [x] + ) [t1] +WHERE + [t1].[Id] = @id + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4638Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4638Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..2588c776fff0 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4638Test(SqlServer.2022.MS).sql @@ -0,0 +1,36 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[Key_1], + [d].[CfAllowValue], + [d].[DateFrom] +FROM + ( + SELECT TOP (1) + [p].[AclNameId] as [Key_1] + FROM + [Issue4624Items] [p] + GROUP BY + [p].[AclNameId] + ) [m_1] + INNER JOIN [Issue4624Items] [d] ON [m_1].[Key_1] = [d].[AclNameId] +ORDER BY + [d].[DateFrom] + + + +-- SqlServer.2022 + +SELECT TOP (1) + [p].[AclNameId] +FROM + [Issue4624Items] [p] +GROUP BY + [p].[AclNameId] + + + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4642Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4642Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..39498a7cda12 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4642Test(SqlServer.2022.MS).sql @@ -0,0 +1,48 @@ +-- SqlServer.2022 +DECLARE @systemId VarChar(20) -- AnsiString +SET @systemId = N'system' + +MERGE INTO [Issue4642Table2] [Target] +USING ( + SELECT + [y].[Id], + [y].[SystemId], + [y].[Timestamp] as [Timestamp_1] + FROM + [Issue4642Table1] [x] + INNER JOIN [Issue4642Table2] [y] ON [x].[Id] = [y].[Id] + WHERE + [x].[Id] IN (1) AND [y].[SystemId] = @systemId +) [Source] +( + [Id], + [SystemId], + [Timestamp_1] +) +ON ([Target].[Id] = [Source].[Id] AND [Target].[SystemId] = [Source].[SystemId]) + +WHEN MATCHED THEN +UPDATE +SET + [Timestamp] = [Source].[Timestamp_1] + +WHEN NOT MATCHED THEN +INSERT +( + [Id], + [SystemId], + [Timestamp] +) +VALUES +( + [Source].[Id], + [Source].[SystemId], + [Source].[Timestamp_1] +) +OUTPUT + $action, + INSERTED.[Id] +; + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4668Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4668Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a0277366afb5 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4668Test(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Value], + [t1].[Value2] +FROM + [Issue4668] [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4669Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4669Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..917c5a913ea8 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4669Test(SqlServer.2022.MS).sql @@ -0,0 +1,21 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[IsActive], + [x].[ParentId], + [x].[Name] +FROM + [Children] [x] +WHERE + [x].[Name] LIKE N'%Test%' ESCAPE N'~' +ORDER BY + [x].[Name] + + + +SELECT [c].[Id], [c].[IsActive], [c].[Name], [c].[ParentId] +FROM [Children] AS [c] +WHERE [c].[Name] IS NOT NULL AND ([c].[Name] LIKE N'Test%') + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4671Test1(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4671Test1(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..eaf5e8f06da0 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue4671Test1(SqlServer.2022.MS).sql @@ -0,0 +1,64 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#Issue4671Entity1TMP] +( + [Id] int NOT NULL IDENTITY, + [Value] int NOT NULL, + + PRIMARY KEY CLUSTERED ([Id]) +) + + + +-- SqlServer.2022 + +INSERT INTO [Issue4671Entity1] +( + [Value] +) +VALUES +( + 1 +) + + + +-- SqlServer.2022 + +INSERT INTO [tempdb]..[#Issue4671Entity1TMP] +( + [Value] +) +VALUES +( + 2 +) + + + +-- SqlServer.2022 + +SELECT TOP (2) + [t1].[Id], + [t1].[Value] +FROM + [Issue4671Entity1] [t1] + + + +-- SqlServer.2022 + +SELECT TOP (2) + [t1].[Id], + [t1].[Value] +FROM + [tempdb]..[#Issue4671Entity1TMP] [t1] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#Issue4671Entity1TMP] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue5177Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue5177Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..88e98a6002fa --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue5177Test(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +Parameters: +@p0='?' (DbType = Int32), @p1='?' (DbType = Guid) + +SET NOCOUNT ON; +INSERT INTO [Issue5177] ([Id], [Value]) +VALUES (@p0, @p1); + + +-- SqlServer.2022 + +SELECT TOP (2) + [r].[Id], + [r].[Value] +FROM + [Issue5177] [r] +WHERE + [r].[Value] IS NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestNoTracking(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestNoTracking(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..721176b5bc5f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestNoTracking(SqlServer.2022.MS,False).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[MasterId], + [a_Master].[Id] +FROM + [Details] [t1] + INNER JOIN [Masters] [a_Master] ON [t1].[MasterId] = [a_Master].[Id] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestNoTracking(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestNoTracking(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..721176b5bc5f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestNoTracking(SqlServer.2022.MS,True).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[MasterId], + [a_Master].[Id] +FROM + [Details] [t1] + INNER JOIN [Masters] [a_Master] ON [t1].[MasterId] = [a_Master].[Id] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestWithTracking(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestWithTracking(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..721176b5bc5f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestWithTracking(SqlServer.2022.MS,False).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[MasterId], + [a_Master].[Id] +FROM + [Details] [t1] + INNER JOIN [Masters] [a_Master] ON [t1].[MasterId] = [a_Master].[Id] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestWithTracking(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestWithTracking(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..721176b5bc5f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue66TestWithTracking(SqlServer.2022.MS,True).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[MasterId], + [a_Master].[Id] +FROM + [Details] [t1] + INNER JOIN [Masters] [a_Master] ON [t1].[MasterId] = [a_Master].[Id] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue73Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue73Test(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..6393b20e5976 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.Issue73Test(SqlServer.2022.MS).sql @@ -0,0 +1,18 @@ +SELECT ([i0].[Name] + N'>') + [i].[Name] +FROM [Issue73Entities] AS [i] +LEFT JOIN [Issue73Entities] AS [i0] ON [i].[ParentId] = [i0].[Id] +WHERE [i].[Name] = N'Name1_3' + + +-- SqlServer.2022 + +SELECT + [a_Parent].[Name] + N'>' + [x].[Name] +FROM + [Issue73Entities] [x] + LEFT JOIN [Issue73Entities] [a_Parent] ON [x].[ParentId] = [a_Parent].[Id] +WHERE + [x].[Name] = N'Name1_3' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.IssueEnumTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.IssueEnumTest(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..acec74b1ce95 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/IssueTests/LinqToDB.EntityFrameworkCore.Tests.IssueTests.IssueEnumTest(SqlServer.2022.MS).sql @@ -0,0 +1,32 @@ +Parameters: +@p0='?' (DbType = Int32), @p1='?' (DbType = Int32), @p2='?' (DbType = Int32), @p3='?' (DbType = Int32), @p4='?' (DbType = Int32) + +SET NOCOUNT ON; +DECLARE @inserted0 TABLE ([Id] int, [_Position] [int]); +MERGE [IssueEnum] USING ( +VALUES (@p0, 0), +(@p1, 1), +(@p2, 2), +(@p3, 3), +(@p4, 4)) AS i ([Value], _Position) ON 1=0 +WHEN NOT MATCHED THEN +INSERT ([Value]) +VALUES (i.[Value]) +OUTPUT INSERTED.[Id], i._Position +INTO @inserted0; + +SELECT [t].[Id] FROM [IssueEnum] t +INNER JOIN @inserted0 i ON ([t].[Id] = [i].[Id]) +ORDER BY [i].[_Position]; + + +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Value] +FROM + [IssueEnum] [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/JsonConvertTests/LinqToDB.EntityFrameworkCore.Tests.JsonConvertTests.TestJsonConvert(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/JsonConvertTests/LinqToDB.EntityFrameworkCore.Tests.JsonConvertTests.TestJsonConvert(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..9adafab5e964 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/JsonConvertTests/LinqToDB.EntityFrameworkCore.Tests.JsonConvertTests.TestJsonConvert(SqlServer.2022.MS).sql @@ -0,0 +1,34 @@ +-- SqlServer.2022 + +DELETE [t1] +FROM + [EventScheduleItem] [t1] + + + +Parameters: +@p0='?' (Size = 1) (DbType = Byte), @p1='?' (DbType = Guid), @p2='?' (Size = 4000), @p3='?' (Size = 4000) + +SET NOCOUNT ON; +INSERT INTO [EventScheduleItem] ([CrashEnum], [GuidColumn], [JsonColumn], [NameLocalized_JSON]) +VALUES (@p0, @p1, @p2, @p3); +SELECT [Id] +FROM [EventScheduleItem] +WHERE @@ROWCOUNT = 1 AND [Id] = scope_identity(); + + +-- SqlServer.2022 + +SELECT TOP (1) + [p].[Id], + [p].[NameLocalized_JSON], + [p].[CrashEnum], + [p].[GuidColumn], + JSON_VALUE([p].[JsonColumn], N'some') +FROM + [EventScheduleItem] [p] +WHERE + [p].[Id] < 10 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.SimpleProviderTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.SimpleProviderTest(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..0124f6ef516c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.SimpleProviderTest(SqlServer.2022.MS).sql @@ -0,0 +1,22 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[CustomerID], + [e].[CompanyName], + [e].[ContactName], + [e].[ContactTitle], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[Phone], + [e].[Fax] +FROM + [Customers] [e] +WHERE + [e].[Address] IS NOT NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.TestFunctionTranslation(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.TestFunctionTranslation(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..95ad3e463596 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.TestFunctionTranslation(SqlServer.2022.MS).sql @@ -0,0 +1,22 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[CustomerID], + [e].[CompanyName], + [e].[ContactName], + [e].[ContactTitle], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[Phone], + [e].[Fax] +FROM + [Customers] [e] +WHERE + [e].[Address] LIKE N'%anything%' ESCAPE N'~' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.TestFunctionTranslationParameter(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.TestFunctionTranslationParameter(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..9b0ab1e04c8a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/PomeloMySqlTests/LinqToDB.EntityFrameworkCore.Tests.PomeloMySqlTests.TestFunctionTranslationParameter(SqlServer.2022.MS).sql @@ -0,0 +1,24 @@ +-- SqlServer.2022 +DECLARE @value NVarChar(60) -- String +SET @value = N'%anything%' + +SELECT + [e].[IsDeleted], + [e].[CustomerID], + [e].[CompanyName], + [e].[ContactName], + [e].[ContactTitle], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[Phone], + [e].[Fax] +FROM + [Customers] [e] +WHERE + [e].[Address] LIKE @value ESCAPE N'~' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlInterpolated(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlInterpolated(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..12ade892974e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlInterpolated(SqlServer.2022.MS).sql @@ -0,0 +1,25 @@ +Parameters: +p0='?' (DbType = Int32), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [c].[CategoryID], [c].[CategoryName], [c].[Description], [c].[IsDeleted], [c].[Picture] +FROM ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = @p0 +) AS [c] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [t1].[IsDeleted], + [t1].[CategoryID], + [t1].[CategoryName], + [t1].[Description], + [t1].[Picture] +FROM + ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = 1 + ) [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlInterpolated2(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlInterpolated2(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..22e3d7d7362c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlInterpolated2(SqlServer.2022.MS).sql @@ -0,0 +1,31 @@ +Parameters: +p0='?' (DbType = Int32), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [t].[CategoryID], [t].[CategoryName], [t].[Description], [t].[IsDeleted], [t].[Picture] +FROM [Categories] AS [c] +CROSS JOIN ( + SELECT [c0].[CategoryID], [c0].[CategoryName], [c0].[Description], [c0].[IsDeleted], [c0].[Picture] + FROM ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = @p0 + ) AS [c0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [c2].[IsDeleted], + [c2].[CategoryID], + [c2].[CategoryName], + [c2].[Description], + [c2].[Picture] +FROM + [Categories] [c1] + CROSS JOIN ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = 1 + ) [c2] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlRaw(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlRaw(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..12ade892974e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlRaw(SqlServer.2022.MS).sql @@ -0,0 +1,25 @@ +Parameters: +p0='?' (DbType = Int32), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [c].[CategoryID], [c].[CategoryName], [c].[Description], [c].[IsDeleted], [c].[Picture] +FROM ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = @p0 +) AS [c] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [t1].[IsDeleted], + [t1].[CategoryID], + [t1].[CategoryName], + [t1].[Description], + [t1].[Picture] +FROM + ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = 1 + ) [t1] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlRaw2(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlRaw2(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..22e3d7d7362c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.FromSqlRaw2(SqlServer.2022.MS).sql @@ -0,0 +1,31 @@ +Parameters: +p0='?' (DbType = Int32), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [t].[CategoryID], [t].[CategoryName], [t].[Description], [t].[IsDeleted], [t].[Picture] +FROM [Categories] AS [c] +CROSS JOIN ( + SELECT [c0].[CategoryID], [c0].[CategoryName], [c0].[Description], [c0].[IsDeleted], [c0].[Picture] + FROM ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = @p0 + ) AS [c0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [c2].[IsDeleted], + [c2].[CategoryID], + [c2].[CategoryName], + [c2].[Description], + [c2].[Picture] +FROM + [Categories] [c1] + CROSS JOIN ( + SELECT * FROM [dbo].[Categories] WHERE CategoryId = 1 + ) [c2] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.NavigationProperties(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.NavigationProperties(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..970d5efcd83a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.NavigationProperties(SqlServer.2022.MS).sql @@ -0,0 +1,63 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [t].[OrderID], [t].[ProductID], [t].[Quantity], [t0].[ProductID], [t0].[ProductName], [o].[OrderID], [t1].[OrderID], [t1].[ProductID], [t1].[Quantity] +FROM [Orders] AS [o] +INNER JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice] + FROM [Order Details] AS [o0] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[OrderID] = [t].[OrderID] +INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) +) AS [t0] ON [t].[ProductID] = [t0].[ProductID] +LEFT JOIN ( + SELECT [o1].[OrderID], [o1].[ProductID], [o1].[Quantity] + FROM [Order Details] AS [o1] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o1].[IsDeleted] <> CAST(1 AS bit)) +) AS [t1] ON [t0].[ProductID] = [t1].[ProductID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t].[OrderID], [t].[ProductID], [t0].[ProductID], [t1].[OrderID], [t1].[ProductID] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [d].[OrderID], + [d].[ProductID], + [d].[Quantity] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId] + FROM + [Orders] [e] + INNER JOIN [Order Details] [od] ON [e].[OrderID] = [od].[OrderID] + INNER JOIN [Products] [a_Product] ON [od].[ProductID] = [a_Product].[ProductID] + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[ProductId] = [d].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [a_Product].[ProductID], + [od].[OrderID], + [od].[ProductID], + [od].[Quantity], + [a_Product].[ProductName] +FROM + [Orders] [o] + INNER JOIN [Order Details] [od] ON [o].[OrderID] = [od].[OrderID] + INNER JOIN [Products] [a_Product] ON [od].[ProductID] = [a_Product].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestAsyncMethods(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestAsyncMethods(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..3e412bbd7ba5 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestAsyncMethods(SqlServer.2022.MS,False).sql @@ -0,0 +1,105 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (CHARINDEX(N'a', [p].[ProductName]) > 0) + + +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (CHARINDEX(N'a', [p].[ProductName]) > 0) + + +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT CASE + WHEN EXISTS ( + SELECT 1 + FROM [Products] AS [p] + WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (CHARINDEX(N'a', [p].[ProductName]) > 0)) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + + + +-- SqlServer.2022 + +SELECT + IIF(EXISTS( + SELECT + * + FROM + [Products] [e] + WHERE + [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + ), 1, 0) + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestAsyncMethods(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestAsyncMethods(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..aeda1b26357c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestAsyncMethods(SqlServer.2022.MS,True).sql @@ -0,0 +1,105 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (CHARINDEX(N'a', [p].[ProductName]) > 0) + + +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (CHARINDEX(N'a', [p].[ProductName]) > 0) + + +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT CASE + WHEN EXISTS ( + SELECT 1 + FROM [Products] AS [p] + WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (CHARINDEX(N'a', [p].[ProductName]) > 0)) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + + + +-- SqlServer.2022 + +SELECT + IIF(EXISTS( + SELECT + * + FROM + [Products] [e] + WHERE + [e].[IsDeleted] = 0 AND [e].[ProductName] LIKE N'%a%' ESCAPE N'~' + ), 1, 0) + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCallback(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCallback(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..d36cd184f723 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCallback(SqlServer.2022.MS,False).sql @@ -0,0 +1,18 @@ +-- SqlServer.2022 + +DELETE [e] +FROM + [Products] [e] +WHERE + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_1] + WHERE + [e].[ProductID] = [e_1].[ProductID] + ) > 0 AND + [e].[ProductName] LIKE N'a%' ESCAPE N'~' AND [e].[ProductName] = N'a' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCallback(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCallback(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..77e2a9c6bd2f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCallback(SqlServer.2022.MS,True).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +DELETE [e] +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_1] + WHERE + [e_1].[IsDeleted] = 0 AND [e].[ProductID] = [e_1].[ProductID] + ) > 0 AND + [e].[ProductName] LIKE N'a%' ESCAPE N'~' AND + [e].[ProductName] = N'a' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTracker(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTracker(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..53d962ff48bf --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTracker(SqlServer.2022.MS,False).sql @@ -0,0 +1,94 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] + + + +Parameters: +@p1='?' (DbType = Int32), @p2='?' (DbType = Int32), @p0='?' (DbType = Decimal) + +SET NOCOUNT ON; +UPDATE [Order Details] SET [UnitPrice] = @p0 +WHERE [OrderID] = @p1 AND [ProductID] = @p2; +SELECT @@ROWCOUNT; + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTracker(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTracker(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..f62d716d1dac --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTracker(SqlServer.2022.MS,True).sql @@ -0,0 +1,105 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + WHERE + [a_Product].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] +WHERE + [d_1].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [m_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + +Parameters: +@p1='?' (DbType = Int32), @p2='?' (DbType = Int32), @p0='?' (DbType = Decimal) + +SET NOCOUNT ON; +UPDATE [Order Details] SET [UnitPrice] = @p0 +WHERE [OrderID] = @p1 AND [ProductID] = @p2; +SELECT @@ROWCOUNT; + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled1(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled1(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..8b530be3bba2 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled1(SqlServer.2022.MS,False).sql @@ -0,0 +1,85 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled1(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled1(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..922491f1f46c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled1(SqlServer.2022.MS,True).sql @@ -0,0 +1,96 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + WHERE + [a_Product].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] +WHERE + [d_1].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [m_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled2(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled2(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..8b530be3bba2 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled2(SqlServer.2022.MS,False).sql @@ -0,0 +1,85 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled2(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled2(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..922491f1f46c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerDisabled2(SqlServer.2022.MS,True).sql @@ -0,0 +1,96 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + WHERE + [a_Product].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] +WHERE + [d_1].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [m_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerTemporaryTable(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerTemporaryTable(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..3ac5bc1f056f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerTemporaryTable(SqlServer.2022.MS,False).sql @@ -0,0 +1,97 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#Orders] +( + [IsDeleted] bit NOT NULL, + [OrderID] int NOT NULL, + [CustomerID] nvarchar(5) NULL, + [EmployeeID] int NULL, + [OrderDate] datetime NULL, + [RequiredDate] datetime NULL, + [ShippedDate] datetime NULL, + [ShipVia] int NULL, + [Freight] money NULL, + [ShipName] nvarchar(40) NULL, + [ShipAddress] nvarchar(60) NULL, + [ShipCity] nvarchar(15) NULL, + [ShipRegion] nvarchar(15) NULL, + [ShipPostalCode] nvarchar(10) NULL, + [ShipCountry] nvarchar(15) NULL, + + PRIMARY KEY CLUSTERED ([OrderID]) +) + + + +-- SqlServer.2022 + +INSERT INTO [tempdb]..[#Orders] +( + [IsDeleted], + [OrderID], + [CustomerID], + [EmployeeID], + [OrderDate], + [RequiredDate], + [ShippedDate], + [ShipVia], + [Freight], + [ShipName], + [ShipAddress], + [ShipCity], + [ShipRegion], + [ShipPostalCode], + [ShipCountry] +) +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] + + + +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 2 + +SELECT TOP (@take) + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [tempdb]..[#Orders] [e] + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#Orders] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerTemporaryTable(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerTemporaryTable(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..25226b62214d --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestChangeTrackerTemporaryTable(SqlServer.2022.MS,True).sql @@ -0,0 +1,101 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#Orders] +( + [IsDeleted] bit NOT NULL, + [OrderID] int NOT NULL, + [CustomerID] nvarchar(5) NULL, + [EmployeeID] int NULL, + [OrderDate] datetime NULL, + [RequiredDate] datetime NULL, + [ShippedDate] datetime NULL, + [ShipVia] int NULL, + [Freight] money NULL, + [ShipName] nvarchar(40) NULL, + [ShipAddress] nvarchar(60) NULL, + [ShipCity] nvarchar(15) NULL, + [ShipRegion] nvarchar(15) NULL, + [ShipPostalCode] nvarchar(10) NULL, + [ShipCountry] nvarchar(15) NULL, + + PRIMARY KEY CLUSTERED ([OrderID]) +) + + + +-- SqlServer.2022 + +INSERT INTO [tempdb]..[#Orders] +( + [IsDeleted], + [OrderID], + [CustomerID], + [EmployeeID], + [OrderDate], + [RequiredDate], + [ShippedDate], + [ShipVia], + [Freight], + [ShipName], + [ShipAddress], + [ShipCity], + [ShipRegion], + [ShipPostalCode], + [ShipCountry] +) +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 2 + +SELECT TOP (@take) + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [tempdb]..[#Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#Orders] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCommandTimeout(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCommandTimeout(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..440292c41f36 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCommandTimeout(SqlServer.2022.MS).sql @@ -0,0 +1,30 @@ +CREATE OR ALTER FUNCTION dbo.[ProcessLong] + ( + @secondsNumber int + ) + RETURNS int + AS + BEGIN + declare @startTime datetime = getutcdate() + while datediff(second, @startTime, getutcdate()) < @secondsNumber + begin + set @startTime = @startTime + end + return 1 + END + + +-- SqlServer.2022 +DECLARE @commandExecutionTime Int -- Int32 +SET @commandExecutionTime = 5 + +SELECT TOP (1) + dbo.ProcessLong(@commandExecutionTime) +FROM + [Products] [e] + + + +DROP FUNCTION IF EXISTS [dbo].[ProcessLong] + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestContinuousQueries(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestContinuousQueries(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..3f4ec71ff003 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestContinuousQueries(SqlServer.2022.MS,False).sql @@ -0,0 +1,109 @@ +Parameters: +@__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[Freight], [o].[IsDeleted], [o].[OrderDate], [o].[RequiredDate], [o].[ShipAddress], [o].[ShipCity], [o].[ShipCountry], [o].[ShipName], [o].[ShipPostalCode], [o].[ShipRegion], [o].[ShipVia], [o].[ShippedDate], [t1].[OrderID], [t1].[ProductID], [t1].[Discount], [t1].[IsDeleted], [t1].[Quantity], [t1].[UnitPrice], [t1].[ProductID0], [t1].[CategoryID], [t1].[Discontinued], [t1].[IsDeleted0], [t1].[ProductName], [t1].[QuantityPerUnit], [t1].[ReorderLevel], [t1].[SupplierID], [t1].[UnitPrice0], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[OrderID0], [t1].[ProductID1], [t1].[Discount0], [t1].[IsDeleted1], [t1].[Quantity0], [t1].[UnitPrice1] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t].[ProductID] AS [ProductID0], [t].[CategoryID], [t].[Discontinued], [t].[IsDeleted] AS [IsDeleted0], [t].[ProductName], [t].[QuantityPerUnit], [t].[ReorderLevel], [t].[SupplierID], [t].[UnitPrice] AS [UnitPrice0], [t].[UnitsInStock], [t].[UnitsOnOrder], [t0].[OrderID] AS [OrderID0], [t0].[ProductID] AS [ProductID1], [t0].[Discount] AS [Discount0], [t0].[IsDeleted] AS [IsDeleted1], [t0].[Quantity] AS [Quantity0], [t0].[UnitPrice] AS [UnitPrice1] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t] ON [o0].[ProductID] = [t].[ProductID] + LEFT JOIN ( + SELECT [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[IsDeleted], [o1].[Quantity], [o1].[UnitPrice] + FROM [Order Details] AS [o1] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o1].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t0] ON [t].[ProductID] = [t0].[ProductID] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t1] ON [o].[OrderID] = [t1].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t1].[OrderID], [t1].[ProductID], [t1].[ProductID0], [t1].[OrderID0], [t1].[ProductID1] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestContinuousQueries(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestContinuousQueries(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..0e2de47917d2 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestContinuousQueries(SqlServer.2022.MS,True).sql @@ -0,0 +1,120 @@ +Parameters: +@__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[Freight], [o].[IsDeleted], [o].[OrderDate], [o].[RequiredDate], [o].[ShipAddress], [o].[ShipCity], [o].[ShipCountry], [o].[ShipName], [o].[ShipPostalCode], [o].[ShipRegion], [o].[ShipVia], [o].[ShippedDate], [t1].[OrderID], [t1].[ProductID], [t1].[Discount], [t1].[IsDeleted], [t1].[Quantity], [t1].[UnitPrice], [t1].[ProductID0], [t1].[CategoryID], [t1].[Discontinued], [t1].[IsDeleted0], [t1].[ProductName], [t1].[QuantityPerUnit], [t1].[ReorderLevel], [t1].[SupplierID], [t1].[UnitPrice0], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[OrderID0], [t1].[ProductID1], [t1].[Discount0], [t1].[IsDeleted1], [t1].[Quantity0], [t1].[UnitPrice1] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t].[ProductID] AS [ProductID0], [t].[CategoryID], [t].[Discontinued], [t].[IsDeleted] AS [IsDeleted0], [t].[ProductName], [t].[QuantityPerUnit], [t].[ReorderLevel], [t].[SupplierID], [t].[UnitPrice] AS [UnitPrice0], [t].[UnitsInStock], [t].[UnitsOnOrder], [t0].[OrderID] AS [OrderID0], [t0].[ProductID] AS [ProductID1], [t0].[Discount] AS [Discount0], [t0].[IsDeleted] AS [IsDeleted1], [t0].[Quantity] AS [Quantity0], [t0].[UnitPrice] AS [UnitPrice1] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t] ON [o0].[ProductID] = [t].[ProductID] + LEFT JOIN ( + SELECT [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[IsDeleted], [o1].[Quantity], [o1].[UnitPrice] + FROM [Order Details] AS [o1] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o1].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t0] ON [t].[ProductID] = [t0].[ProductID] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t1] ON [o].[OrderID] = [t1].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t1].[OrderID], [t1].[ProductID], [t1].[ProductID0], [t1].[OrderID0], [t1].[ProductID1] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductId], + [m_1].[OrderId], + [d_1].[IsDeleted], + [d_1].[OrderID], + [d_1].[ProductID], + [d_1].[UnitPrice], + [d_1].[Quantity], + [d_1].[Discount] +FROM + ( + SELECT DISTINCT + [a_Product].[ProductID] as [ProductId], + [t1].[OrderId] + FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + WHERE + [a_Product].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d_1] ON [m_1].[ProductId] = [d_1].[ProductID] +WHERE + [d_1].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [m_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCreateTempTable(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCreateTempTable(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..d898e1e8c100 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCreateTempTable(SqlServer.2022.MS,False).sql @@ -0,0 +1,101 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#TestEmployees] +( + [IsDeleted] bit NOT NULL, + [EmployeeID] int NOT NULL, + [LastName] nvarchar(20) NOT NULL, + [FirstName] nvarchar(10) NOT NULL, + [Title] nvarchar(30) NULL, + [TitleOfCourtesy] nvarchar(25) NULL, + [BirthDate] datetime NULL, + [HireDate] datetime NULL, + [Address] nvarchar(60) NULL, + [City] nvarchar(15) NULL, + [Region] nvarchar(15) NULL, + [PostalCode] nvarchar(10) NULL, + [Country] nvarchar(15) NULL, + [HomePhone] nvarchar(24) NULL, + [Extension] nvarchar(4) NULL, + [Photo] varbinary(max) NULL, + [Notes] nvarchar(max) NULL, + [ReportsTo] int NULL, + [PhotoPath] nvarchar(255) NULL, + + PRIMARY KEY CLUSTERED ([EmployeeID]) +) + + + +-- SqlServer.2022 + +INSERT INTO [tempdb]..[#TestEmployees] +( + [IsDeleted], + [EmployeeID], + [LastName], + [FirstName], + [Title], + [TitleOfCourtesy], + [BirthDate], + [HireDate], + [Address], + [City], + [Region], + [PostalCode], + [Country], + [HomePhone], + [Extension], + [Photo], + [Notes], + [ReportsTo], + [PhotoPath] +) +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath] +FROM + [Employees] [e] + + + +-- SqlServer.2022 + +SELECT + COUNT(*) +FROM + [tempdb]..[#TestEmployees] [e] + + + +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT COUNT(*) +FROM [Employees] AS [e] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#TestEmployees] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCreateTempTable(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCreateTempTable(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..33e2c9e23f13 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestCreateTempTable(SqlServer.2022.MS,True).sql @@ -0,0 +1,105 @@ +-- SqlServer.2022 + +CREATE TABLE [tempdb]..[#TestEmployees] +( + [IsDeleted] bit NOT NULL, + [EmployeeID] int NOT NULL, + [LastName] nvarchar(20) NOT NULL, + [FirstName] nvarchar(10) NOT NULL, + [Title] nvarchar(30) NULL, + [TitleOfCourtesy] nvarchar(25) NULL, + [BirthDate] datetime NULL, + [HireDate] datetime NULL, + [Address] nvarchar(60) NULL, + [City] nvarchar(15) NULL, + [Region] nvarchar(15) NULL, + [PostalCode] nvarchar(10) NULL, + [Country] nvarchar(15) NULL, + [HomePhone] nvarchar(24) NULL, + [Extension] nvarchar(4) NULL, + [Photo] varbinary(max) NULL, + [Notes] nvarchar(max) NULL, + [ReportsTo] int NULL, + [PhotoPath] nvarchar(255) NULL, + + PRIMARY KEY CLUSTERED ([EmployeeID]) +) + + + +-- SqlServer.2022 + +INSERT INTO [tempdb]..[#TestEmployees] +( + [IsDeleted], + [EmployeeID], + [LastName], + [FirstName], + [Title], + [TitleOfCourtesy], + [BirthDate], + [HireDate], + [Address], + [City], + [Region], + [PostalCode], + [Country], + [HomePhone], + [Extension], + [Photo], + [Notes], + [ReportsTo], + [PhotoPath] +) +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath] +FROM + [Employees] [e] +WHERE + [e].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + COUNT(*) +FROM + [tempdb]..[#TestEmployees] [e] +WHERE + [e].[IsDeleted] = 0 + + + +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT COUNT(*) +FROM [Employees] AS [e] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +DROP TABLE IF EXISTS [tempdb]..[#TestEmployees] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDeleteFrom(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDeleteFrom(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..192706239ad4 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDeleteFrom(SqlServer.2022.MS).sql @@ -0,0 +1,19 @@ +-- SqlServer.2022 +DECLARE @take Int -- Int32 +SET @take = 20 + +DELETE [x] +FROM + ( + SELECT TOP (@take) + [e].[CustomerID] as [CustomerId] + FROM + [Customers] [e] + WHERE + [e].[IsDeleted] = 1 + ) [x] +WHERE + 1 = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDemo2(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDemo2(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..3d1397b68b2e --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDemo2(SqlServer.2022.MS,False).sql @@ -0,0 +1,22 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] + LEFT JOIN [Products] [op] ON [op].[ProductID] <> [e].[ProductID] AND [op].[ProductName] = [e].[ProductName] +WHERE + [op].[ProductID] IS NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDemo2(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDemo2(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..fb11892a023a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestDemo2(SqlServer.2022.MS,True).sql @@ -0,0 +1,22 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] + LEFT JOIN [Products] [op] ON [op].[ProductID] <> [e].[ProductID] AND [op].[ProductName] = [e].[ProductName] AND [op].[IsDeleted] = 0 +WHERE + [e].[IsDeleted] = 0 AND [op].[ProductID] IS NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestEager(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestEager(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..37ecf863285d --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestEager(SqlServer.2022.MS,False).sql @@ -0,0 +1,124 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_4='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_5='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy], [o].[OrderID], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[IsDeleted], [t2].[TerritoryID0], [t2].[IsDeleted0], [t2].[RegionID], [t2].[TerritoryDescription], [t4].[OrderID], [t4].[ProductID], [t4].[Discount], [t4].[IsDeleted], [t4].[Quantity], [t4].[UnitPrice], [t4].[ProductID0], [t4].[CategoryID], [t4].[Discontinued], [t4].[IsDeleted0], [t4].[ProductName], [t4].[QuantityPerUnit], [t4].[ReorderLevel], [t4].[SupplierID], [t4].[UnitPrice0], [t4].[UnitsInStock], [t4].[UnitsOnOrder] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] + FROM [Employees] AS [e] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[EmployeeID] = [t].[EmployeeID] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[TerritoryID], [e0].[IsDeleted], [t1].[TerritoryID] AS [TerritoryID0], [t1].[IsDeleted] AS [IsDeleted0], [t1].[RegionID], [t1].[TerritoryDescription] + FROM [EmployeeTerritories] AS [e0] + INNER JOIN ( + SELECT [t0].[TerritoryID], [t0].[IsDeleted], [t0].[RegionID], [t0].[TerritoryDescription] + FROM [Territories] AS [t0] + WHERE (@__ef_filter__p_4 = CAST(1 AS bit)) OR ([t0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [e0].[TerritoryID] = [t1].[TerritoryID] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t2] ON [t].[EmployeeID] = [t2].[EmployeeID] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t3].[ProductID] AS [ProductID0], [t3].[CategoryID], [t3].[Discontinued], [t3].[IsDeleted] AS [IsDeleted0], [t3].[ProductName], [t3].[QuantityPerUnit], [t3].[ReorderLevel], [t3].[SupplierID], [t3].[UnitPrice] AS [UnitPrice0], [t3].[UnitsInStock], [t3].[UnitsOnOrder] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_5 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t3] ON [o0].[ProductID] = [t3].[ProductID] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t4] ON [o].[OrderID] = [t4].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[TerritoryID0], [t4].[OrderID], [t4].[ProductID], [t4].[ProductID0] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[EmployeeId], + [d].[IsDeleted], + [d].[EmployeeID], + [d].[TerritoryID], + [e_1].[IsDeleted], + [e_1].[TerritoryID], + [e_1].[TerritoryDescription], + [e_1].[RegionID] +FROM + ( + SELECT DISTINCT + [a_Employee].[EmployeeID] as [EmployeeId] + FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] + ) [m_1] + INNER JOIN [EmployeeTerritories] [d] ON [m_1].[EmployeeId] = [d].[EmployeeID] + INNER JOIN [Territories] [e_1] ON [d].[TerritoryID] = [e_1].[TerritoryID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderId], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [e_1].[IsDeleted], + [e_1].[ProductID], + [e_1].[ProductName], + [e_1].[SupplierID], + [e_1].[CategoryID], + [e_1].[QuantityPerUnit], + [e_1].[UnitPrice], + [e_1].[UnitsInStock], + [e_1].[UnitsOnOrder], + [e_1].[ReorderLevel], + [e_1].[Discontinued] +FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [e_1] ON [d].[ProductID] = [e_1].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [a_Employee].[IsDeleted], + [a_Employee].[EmployeeID], + [a_Employee].[LastName], + [a_Employee].[FirstName], + [a_Employee].[Title], + [a_Employee].[TitleOfCourtesy], + [a_Employee].[BirthDate], + [a_Employee].[HireDate], + [a_Employee].[Address], + [a_Employee].[City], + [a_Employee].[Region], + [a_Employee].[PostalCode], + [a_Employee].[Country], + [a_Employee].[HomePhone], + [a_Employee].[Extension], + [a_Employee].[Photo], + [a_Employee].[Notes], + [a_Employee].[ReportsTo], + [a_Employee].[PhotoPath], + [o].[OrderID] +FROM + [Orders] [o] + LEFT JOIN [Employees] [a_Employee] ON [o].[EmployeeID] = [a_Employee].[EmployeeID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestEager(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestEager(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..5c11d95cc72a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestEager(SqlServer.2022.MS,True).sql @@ -0,0 +1,134 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_4='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_5='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy], [o].[OrderID], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[IsDeleted], [t2].[TerritoryID0], [t2].[IsDeleted0], [t2].[RegionID], [t2].[TerritoryDescription], [t4].[OrderID], [t4].[ProductID], [t4].[Discount], [t4].[IsDeleted], [t4].[Quantity], [t4].[UnitPrice], [t4].[ProductID0], [t4].[CategoryID], [t4].[Discontinued], [t4].[IsDeleted0], [t4].[ProductName], [t4].[QuantityPerUnit], [t4].[ReorderLevel], [t4].[SupplierID], [t4].[UnitPrice0], [t4].[UnitsInStock], [t4].[UnitsOnOrder] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] + FROM [Employees] AS [e] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[EmployeeID] = [t].[EmployeeID] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[TerritoryID], [e0].[IsDeleted], [t1].[TerritoryID] AS [TerritoryID0], [t1].[IsDeleted] AS [IsDeleted0], [t1].[RegionID], [t1].[TerritoryDescription] + FROM [EmployeeTerritories] AS [e0] + INNER JOIN ( + SELECT [t0].[TerritoryID], [t0].[IsDeleted], [t0].[RegionID], [t0].[TerritoryDescription] + FROM [Territories] AS [t0] + WHERE (@__ef_filter__p_4 = CAST(1 AS bit)) OR ([t0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [e0].[TerritoryID] = [t1].[TerritoryID] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t2] ON [t].[EmployeeID] = [t2].[EmployeeID] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t3].[ProductID] AS [ProductID0], [t3].[CategoryID], [t3].[Discontinued], [t3].[IsDeleted] AS [IsDeleted0], [t3].[ProductName], [t3].[QuantityPerUnit], [t3].[ReorderLevel], [t3].[SupplierID], [t3].[UnitPrice] AS [UnitPrice0], [t3].[UnitsInStock], [t3].[UnitsOnOrder] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_5 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t3] ON [o0].[ProductID] = [t3].[ProductID] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t4] ON [o].[OrderID] = [t4].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[TerritoryID0], [t4].[OrderID], [t4].[ProductID], [t4].[ProductID0] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[EmployeeId], + [d].[IsDeleted], + [d].[EmployeeID], + [d].[TerritoryID], + [e_1].[IsDeleted], + [e_1].[TerritoryID], + [e_1].[TerritoryDescription], + [e_1].[RegionID] +FROM + ( + SELECT DISTINCT + [a_Employee].[EmployeeID] as [EmployeeId] + FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] AND [a_Employee].[IsDeleted] = 0 + WHERE + [e].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [EmployeeTerritories] [d] ON [m_1].[EmployeeId] = [d].[EmployeeID] + INNER JOIN [Territories] [e_1] ON [d].[TerritoryID] = [e_1].[TerritoryID] +WHERE + [e_1].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderId], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [e_1].[IsDeleted], + [e_1].[ProductID], + [e_1].[ProductName], + [e_1].[SupplierID], + [e_1].[CategoryID], + [e_1].[QuantityPerUnit], + [e_1].[UnitPrice], + [e_1].[UnitsInStock], + [e_1].[UnitsOnOrder], + [e_1].[ReorderLevel], + [e_1].[Discontinued] +FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [e_1] ON [d].[ProductID] = [e_1].[ProductID] +WHERE + [e_1].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [a_Employee].[IsDeleted], + [a_Employee].[EmployeeID], + [a_Employee].[LastName], + [a_Employee].[FirstName], + [a_Employee].[Title], + [a_Employee].[TitleOfCourtesy], + [a_Employee].[BirthDate], + [a_Employee].[HireDate], + [a_Employee].[Address], + [a_Employee].[City], + [a_Employee].[Region], + [a_Employee].[PostalCode], + [a_Employee].[Country], + [a_Employee].[HomePhone], + [a_Employee].[Extension], + [a_Employee].[Photo], + [a_Employee].[Notes], + [a_Employee].[ReportsTo], + [a_Employee].[PhotoPath], + [o].[OrderID] +FROM + [Orders] [o] + LEFT JOIN [Employees] [a_Employee] ON [o].[EmployeeID] = [a_Employee].[EmployeeID] AND [a_Employee].[IsDeleted] = 0 +WHERE + [o].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestForeignKey(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestForeignKey(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..28b25da74044 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestForeignKey(SqlServer.2022.MS,False).sql @@ -0,0 +1,60 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy] +FROM [Employees] AS [e] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[Address], [e0].[BirthDate], [e0].[City], [e0].[Country], [e0].[Extension], [e0].[FirstName], [e0].[HireDate], [e0].[HomePhone], [e0].[IsDeleted], [e0].[LastName], [e0].[Notes], [e0].[Photo], [e0].[PhotoPath], [e0].[PostalCode], [e0].[Region], [e0].[ReportsTo], [e0].[Title], [e0].[TitleOfCourtesy] + FROM [Employees] AS [e0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [e].[ReportsTo] = [t].[EmployeeID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath], + [a_ReportsToNavigation].[IsDeleted], + [a_ReportsToNavigation].[EmployeeID], + [a_ReportsToNavigation].[LastName], + [a_ReportsToNavigation].[FirstName], + [a_ReportsToNavigation].[Title], + [a_ReportsToNavigation].[TitleOfCourtesy], + [a_ReportsToNavigation].[BirthDate], + [a_ReportsToNavigation].[HireDate], + [a_ReportsToNavigation].[Address], + [a_ReportsToNavigation].[City], + [a_ReportsToNavigation].[Region], + [a_ReportsToNavigation].[PostalCode], + [a_ReportsToNavigation].[Country], + [a_ReportsToNavigation].[HomePhone], + [a_ReportsToNavigation].[Extension], + [a_ReportsToNavigation].[Photo], + [a_ReportsToNavigation].[Notes], + [a_ReportsToNavigation].[ReportsTo], + [a_ReportsToNavigation].[PhotoPath] +FROM + [Employees] [e] + LEFT JOIN [Employees] [a_ReportsToNavigation] ON [e].[ReportsTo] = [a_ReportsToNavigation].[EmployeeID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestForeignKey(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestForeignKey(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..c9b3364c873d --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestForeignKey(SqlServer.2022.MS,True).sql @@ -0,0 +1,62 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy] +FROM [Employees] AS [e] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[Address], [e0].[BirthDate], [e0].[City], [e0].[Country], [e0].[Extension], [e0].[FirstName], [e0].[HireDate], [e0].[HomePhone], [e0].[IsDeleted], [e0].[LastName], [e0].[Notes], [e0].[Photo], [e0].[PhotoPath], [e0].[PostalCode], [e0].[Region], [e0].[ReportsTo], [e0].[Title], [e0].[TitleOfCourtesy] + FROM [Employees] AS [e0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [e].[ReportsTo] = [t].[EmployeeID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath], + [a_ReportsToNavigation].[IsDeleted], + [a_ReportsToNavigation].[EmployeeID], + [a_ReportsToNavigation].[LastName], + [a_ReportsToNavigation].[FirstName], + [a_ReportsToNavigation].[Title], + [a_ReportsToNavigation].[TitleOfCourtesy], + [a_ReportsToNavigation].[BirthDate], + [a_ReportsToNavigation].[HireDate], + [a_ReportsToNavigation].[Address], + [a_ReportsToNavigation].[City], + [a_ReportsToNavigation].[Region], + [a_ReportsToNavigation].[PostalCode], + [a_ReportsToNavigation].[Country], + [a_ReportsToNavigation].[HomePhone], + [a_ReportsToNavigation].[Extension], + [a_ReportsToNavigation].[Photo], + [a_ReportsToNavigation].[Notes], + [a_ReportsToNavigation].[ReportsTo], + [a_ReportsToNavigation].[PhotoPath] +FROM + [Employees] [e] + LEFT JOIN [Employees] [a_ReportsToNavigation] ON [e].[ReportsTo] = [a_ReportsToNavigation].[EmployeeID] AND [a_ReportsToNavigation].[IsDeleted] = 0 +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestFunctions(SqlServer.2022.MS).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestFunctions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f13f1da54b9a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestFunctions(SqlServer.2022.MS).sql @@ -0,0 +1,23 @@ +-- SqlServer.2022 + +SELECT + [p].[OrderID], + DATEDIFF(YEAR, [p].[ShippedDate], [p].[OrderDate]), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(YEAR, [p].[ShippedDate], [p].[OrderDate])), + DATEDIFF(MONTH, [p].[ShippedDate], [p].[OrderDate]), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(MONTH, [p].[ShippedDate], [p].[OrderDate])), + DATEDIFF(DAY, [p].[ShippedDate], [p].[OrderDate]), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(DAY, [p].[ShippedDate], [p].[OrderDate])), + DATEDIFF(HOUR, [p].[ShippedDate], [p].[OrderDate]), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(HOUR, [p].[ShippedDate], [p].[OrderDate])), + DATEDIFF(MINUTE, [p].[ShippedDate], [p].[OrderDate]), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(MINUTE, [p].[ShippedDate], [p].[OrderDate])), + DATEDIFF(SECOND, [p].[ShippedDate], [p].[OrderDate]), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(SECOND, [p].[ShippedDate], [p].[OrderDate])), + DATEDIFF(MILLISECOND, [p].[ShippedDate], DateAdd(millisecond, 100, [p].[ShippedDate])), + IIF([p].[OrderDate] IS NULL, NULL, DATEDIFF(MILLISECOND, [p].[ShippedDate], DateAdd(millisecond, 100, [p].[ShippedDate]))) +FROM + [Orders] [p] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGetTable(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGetTable(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..41d8bb17afac --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGetTable(SqlServer.2022.MS,False).sql @@ -0,0 +1,22 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[CustomerID], + [e].[CompanyName], + [e].[ContactName], + [e].[ContactTitle], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[Phone], + [e].[Fax] +FROM + [Customers] [e] +WHERE + [e].[City] IS NOT NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGetTable(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGetTable(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..4904b2476c62 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGetTable(SqlServer.2022.MS,True).sql @@ -0,0 +1,22 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[CustomerID], + [e].[CompanyName], + [e].[ContactName], + [e].[ContactTitle], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[Phone], + [e].[Fax] +FROM + [Customers] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[City] IS NOT NULL + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGlobalQueryFilters(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGlobalQueryFilters(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..1915d95334d5 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGlobalQueryFilters(SqlServer.2022.MS,False).sql @@ -0,0 +1,70 @@ +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder], [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[IsDeleted], [o].[Quantity], [o].[UnitPrice] +FROM [Products] AS [p] +INNER JOIN [Order Details] AS [o] ON [p].[ProductID] = [o].[ProductID] + + +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount] +FROM + [Products] [p] + INNER JOIN [Order Details] [d] ON [p].[ProductID] = [d].[ProductID] + + + +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder], [t].[OrderID], [t].[ProductID], [t].[Discount], [t].[IsDeleted], [t].[Quantity], [t].[UnitPrice] +FROM [Products] AS [p] +INNER JOIN ( + SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[IsDeleted], [o].[Quantity], [o].[UnitPrice] + FROM [Order Details] AS [o] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [p].[ProductID] = [t].[ProductID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount] +FROM + [Products] [p] + INNER JOIN [Order Details] [d] ON [p].[ProductID] = [d].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGlobalQueryFilters(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGlobalQueryFilters(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..c5c77320af87 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestGlobalQueryFilters(SqlServer.2022.MS,True).sql @@ -0,0 +1,74 @@ +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder], [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[IsDeleted], [o].[Quantity], [o].[UnitPrice] +FROM [Products] AS [p] +INNER JOIN [Order Details] AS [o] ON [p].[ProductID] = [o].[ProductID] + + +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount] +FROM + [Products] [p] + INNER JOIN [Order Details] [d] ON [p].[ProductID] = [d].[ProductID] +WHERE + [d].[IsDeleted] = 0 + + + +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder], [t].[OrderID], [t].[ProductID], [t].[Discount], [t].[IsDeleted], [t].[Quantity], [t].[UnitPrice] +FROM [Products] AS [p] +INNER JOIN ( + SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[IsDeleted], [o].[Quantity], [o].[UnitPrice] + FROM [Order Details] AS [o] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [p].[ProductID] = [t].[ProductID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount] +FROM + [Products] [p] + INNER JOIN [Order Details] [d] ON [p].[ProductID] = [d].[ProductID] +WHERE + [p].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestInclude(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestInclude(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..d92951a23629 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestInclude(SqlServer.2022.MS,False).sql @@ -0,0 +1,138 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_4='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_5='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[Freight], [o].[IsDeleted], [o].[OrderDate], [o].[RequiredDate], [o].[ShipAddress], [o].[ShipCity], [o].[ShipCountry], [o].[ShipName], [o].[ShipPostalCode], [o].[ShipRegion], [o].[ShipVia], [o].[ShippedDate], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[IsDeleted], [t2].[TerritoryID0], [t2].[IsDeleted0], [t2].[RegionID], [t2].[TerritoryDescription], [t4].[OrderID], [t4].[ProductID], [t4].[Discount], [t4].[IsDeleted], [t4].[Quantity], [t4].[UnitPrice], [t4].[ProductID0], [t4].[CategoryID], [t4].[Discontinued], [t4].[IsDeleted0], [t4].[ProductName], [t4].[QuantityPerUnit], [t4].[ReorderLevel], [t4].[SupplierID], [t4].[UnitPrice0], [t4].[UnitsInStock], [t4].[UnitsOnOrder] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] + FROM [Employees] AS [e] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[EmployeeID] = [t].[EmployeeID] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[TerritoryID], [e0].[IsDeleted], [t1].[TerritoryID] AS [TerritoryID0], [t1].[IsDeleted] AS [IsDeleted0], [t1].[RegionID], [t1].[TerritoryDescription] + FROM [EmployeeTerritories] AS [e0] + INNER JOIN ( + SELECT [t0].[TerritoryID], [t0].[IsDeleted], [t0].[RegionID], [t0].[TerritoryDescription] + FROM [Territories] AS [t0] + WHERE (@__ef_filter__p_4 = CAST(1 AS bit)) OR ([t0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [e0].[TerritoryID] = [t1].[TerritoryID] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t2] ON [t].[EmployeeID] = [t2].[EmployeeID] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t3].[ProductID] AS [ProductID0], [t3].[CategoryID], [t3].[Discontinued], [t3].[IsDeleted] AS [IsDeleted0], [t3].[ProductName], [t3].[QuantityPerUnit], [t3].[ReorderLevel], [t3].[SupplierID], [t3].[UnitPrice] AS [UnitPrice0], [t3].[UnitsInStock], [t3].[UnitsOnOrder] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_5 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t3] ON [o0].[ProductID] = [t3].[ProductID] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t4] ON [o].[OrderID] = [t4].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[TerritoryID0], [t4].[OrderID], [t4].[ProductID], [t4].[ProductID0] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[EmployeeId], + [d].[IsDeleted], + [d].[EmployeeID], + [d].[TerritoryID], + [a_Territory].[IsDeleted], + [a_Territory].[TerritoryID], + [a_Territory].[TerritoryDescription], + [a_Territory].[RegionID] +FROM + ( + SELECT DISTINCT + [a_Employee].[EmployeeID] as [EmployeeId] + FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] + ) [m_1] + INNER JOIN [EmployeeTerritories] [d] ON [m_1].[EmployeeId] = [d].[EmployeeID] + INNER JOIN [Territories] [a_Territory] ON [d].[TerritoryID] = [a_Territory].[TerritoryID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderId], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry], + [a_Employee].[IsDeleted], + [a_Employee].[EmployeeID], + [a_Employee].[LastName], + [a_Employee].[FirstName], + [a_Employee].[Title], + [a_Employee].[TitleOfCourtesy], + [a_Employee].[BirthDate], + [a_Employee].[HireDate], + [a_Employee].[Address], + [a_Employee].[City], + [a_Employee].[Region], + [a_Employee].[PostalCode], + [a_Employee].[Country], + [a_Employee].[HomePhone], + [a_Employee].[Extension], + [a_Employee].[Photo], + [a_Employee].[Notes], + [a_Employee].[ReportsTo], + [a_Employee].[PhotoPath] +FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestInclude(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestInclude(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..6e78baa9156c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestInclude(SqlServer.2022.MS,True).sql @@ -0,0 +1,148 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_4='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_5='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[Freight], [o].[IsDeleted], [o].[OrderDate], [o].[RequiredDate], [o].[ShipAddress], [o].[ShipCity], [o].[ShipCountry], [o].[ShipName], [o].[ShipPostalCode], [o].[ShipRegion], [o].[ShipVia], [o].[ShippedDate], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[IsDeleted], [t2].[TerritoryID0], [t2].[IsDeleted0], [t2].[RegionID], [t2].[TerritoryDescription], [t4].[OrderID], [t4].[ProductID], [t4].[Discount], [t4].[IsDeleted], [t4].[Quantity], [t4].[UnitPrice], [t4].[ProductID0], [t4].[CategoryID], [t4].[Discontinued], [t4].[IsDeleted0], [t4].[ProductName], [t4].[QuantityPerUnit], [t4].[ReorderLevel], [t4].[SupplierID], [t4].[UnitPrice0], [t4].[UnitsInStock], [t4].[UnitsOnOrder] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] + FROM [Employees] AS [e] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[EmployeeID] = [t].[EmployeeID] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[TerritoryID], [e0].[IsDeleted], [t1].[TerritoryID] AS [TerritoryID0], [t1].[IsDeleted] AS [IsDeleted0], [t1].[RegionID], [t1].[TerritoryDescription] + FROM [EmployeeTerritories] AS [e0] + INNER JOIN ( + SELECT [t0].[TerritoryID], [t0].[IsDeleted], [t0].[RegionID], [t0].[TerritoryDescription] + FROM [Territories] AS [t0] + WHERE (@__ef_filter__p_4 = CAST(1 AS bit)) OR ([t0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [e0].[TerritoryID] = [t1].[TerritoryID] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t2] ON [t].[EmployeeID] = [t2].[EmployeeID] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t3].[ProductID] AS [ProductID0], [t3].[CategoryID], [t3].[Discontinued], [t3].[IsDeleted] AS [IsDeleted0], [t3].[ProductName], [t3].[QuantityPerUnit], [t3].[ReorderLevel], [t3].[SupplierID], [t3].[UnitPrice] AS [UnitPrice0], [t3].[UnitsInStock], [t3].[UnitsOnOrder] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_5 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t3] ON [o0].[ProductID] = [t3].[ProductID] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t4] ON [o].[OrderID] = [t4].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t2].[EmployeeID], [t2].[TerritoryID], [t2].[TerritoryID0], [t4].[OrderID], [t4].[ProductID], [t4].[ProductID0] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[EmployeeId], + [d].[IsDeleted], + [d].[EmployeeID], + [d].[TerritoryID], + [a_Territory].[IsDeleted], + [a_Territory].[TerritoryID], + [a_Territory].[TerritoryDescription], + [a_Territory].[RegionID] +FROM + ( + SELECT DISTINCT + [a_Employee].[EmployeeID] as [EmployeeId] + FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] AND [a_Employee].[IsDeleted] = 0 + WHERE + [e].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [EmployeeTerritories] [d] ON [m_1].[EmployeeId] = [d].[EmployeeID] + INNER JOIN [Territories] [a_Territory] ON [d].[TerritoryID] = [a_Territory].[TerritoryID] +WHERE + [a_Territory].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderId], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [a_Product].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry], + [a_Employee].[IsDeleted], + [a_Employee].[EmployeeID], + [a_Employee].[LastName], + [a_Employee].[FirstName], + [a_Employee].[Title], + [a_Employee].[TitleOfCourtesy], + [a_Employee].[BirthDate], + [a_Employee].[HireDate], + [a_Employee].[Address], + [a_Employee].[City], + [a_Employee].[Region], + [a_Employee].[PostalCode], + [a_Employee].[Country], + [a_Employee].[HomePhone], + [a_Employee].[Extension], + [a_Employee].[Photo], + [a_Employee].[Notes], + [a_Employee].[ReportsTo], + [a_Employee].[PhotoPath] +FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] AND [a_Employee].[IsDeleted] = 0 +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestIncludeString(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestIncludeString(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..504f075fff4c --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestIncludeString(SqlServer.2022.MS,False).sql @@ -0,0 +1,128 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_4='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[Freight], [o].[IsDeleted], [o].[OrderDate], [o].[RequiredDate], [o].[ShipAddress], [o].[ShipCity], [o].[ShipCountry], [o].[ShipName], [o].[ShipPostalCode], [o].[ShipRegion], [o].[ShipVia], [o].[ShippedDate], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy], [t0].[EmployeeID], [t0].[TerritoryID], [t0].[IsDeleted], [t2].[OrderID], [t2].[ProductID], [t2].[Discount], [t2].[IsDeleted], [t2].[Quantity], [t2].[UnitPrice], [t2].[ProductID0], [t2].[CategoryID], [t2].[Discontinued], [t2].[IsDeleted0], [t2].[ProductName], [t2].[QuantityPerUnit], [t2].[ReorderLevel], [t2].[SupplierID], [t2].[UnitPrice0], [t2].[UnitsInStock], [t2].[UnitsOnOrder] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] + FROM [Employees] AS [e] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[EmployeeID] = [t].[EmployeeID] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[TerritoryID], [e0].[IsDeleted] + FROM [EmployeeTerritories] AS [e0] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t0] ON [t].[EmployeeID] = [t0].[EmployeeID] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t1].[ProductID] AS [ProductID0], [t1].[CategoryID], [t1].[Discontinued], [t1].[IsDeleted] AS [IsDeleted0], [t1].[ProductName], [t1].[QuantityPerUnit], [t1].[ReorderLevel], [t1].[SupplierID], [t1].[UnitPrice] AS [UnitPrice0], [t1].[UnitsInStock], [t1].[UnitsOnOrder] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_4 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [o0].[ProductID] = [t1].[ProductID] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t2] ON [o].[OrderID] = [t2].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t0].[EmployeeID], [t0].[TerritoryID], [t2].[OrderID], [t2].[ProductID], [t2].[ProductID0] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[EmployeeId], + [d].[IsDeleted], + [d].[EmployeeID], + [d].[TerritoryID] +FROM + ( + SELECT DISTINCT + [a_Employee].[EmployeeID] as [EmployeeId] + FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] + ) [m_1] + INNER JOIN [EmployeeTerritories] [d] ON [m_1].[EmployeeId] = [d].[EmployeeID] + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderId], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry], + [a_Employee].[IsDeleted], + [a_Employee].[EmployeeID], + [a_Employee].[LastName], + [a_Employee].[FirstName], + [a_Employee].[Title], + [a_Employee].[TitleOfCourtesy], + [a_Employee].[BirthDate], + [a_Employee].[HireDate], + [a_Employee].[Address], + [a_Employee].[City], + [a_Employee].[Region], + [a_Employee].[PostalCode], + [a_Employee].[Country], + [a_Employee].[HomePhone], + [a_Employee].[Extension], + [a_Employee].[Photo], + [a_Employee].[Notes], + [a_Employee].[ReportsTo], + [a_Employee].[PhotoPath] +FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestIncludeString(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestIncludeString(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..c6b90b2c9ee5 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestIncludeString(SqlServer.2022.MS,True).sql @@ -0,0 +1,138 @@ +Parameters: +@__ef_filter__p_1='?' (DbType = Boolean), @__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_4='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[Freight], [o].[IsDeleted], [o].[OrderDate], [o].[RequiredDate], [o].[ShipAddress], [o].[ShipCity], [o].[ShipCountry], [o].[ShipName], [o].[ShipPostalCode], [o].[ShipRegion], [o].[ShipVia], [o].[ShippedDate], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy], [t0].[EmployeeID], [t0].[TerritoryID], [t0].[IsDeleted], [t2].[OrderID], [t2].[ProductID], [t2].[Discount], [t2].[IsDeleted], [t2].[Quantity], [t2].[UnitPrice], [t2].[ProductID0], [t2].[CategoryID], [t2].[Discontinued], [t2].[IsDeleted0], [t2].[ProductName], [t2].[QuantityPerUnit], [t2].[ReorderLevel], [t2].[SupplierID], [t2].[UnitPrice0], [t2].[UnitsInStock], [t2].[UnitsOnOrder] +FROM [Orders] AS [o] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] + FROM [Employees] AS [e] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [o].[EmployeeID] = [t].[EmployeeID] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[TerritoryID], [e0].[IsDeleted] + FROM [EmployeeTerritories] AS [e0] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t0] ON [t].[EmployeeID] = [t0].[EmployeeID] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[IsDeleted], [o0].[Quantity], [o0].[UnitPrice], [t1].[ProductID] AS [ProductID0], [t1].[CategoryID], [t1].[Discontinued], [t1].[IsDeleted] AS [IsDeleted0], [t1].[ProductName], [t1].[QuantityPerUnit], [t1].[ReorderLevel], [t1].[SupplierID], [t1].[UnitPrice] AS [UnitPrice0], [t1].[UnitsInStock], [t1].[UnitsOnOrder] + FROM [Order Details] AS [o0] + INNER JOIN ( + SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder] + FROM [Products] AS [p] + WHERE (@__ef_filter__p_4 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [o0].[ProductID] = [t1].[ProductID] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t2] ON [o].[OrderID] = [t2].[OrderID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [o].[OrderID], [t0].[EmployeeID], [t0].[TerritoryID], [t2].[OrderID], [t2].[ProductID], [t2].[ProductID0] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[EmployeeId], + [d].[IsDeleted], + [d].[EmployeeID], + [d].[TerritoryID] +FROM + ( + SELECT DISTINCT + [a_Employee].[EmployeeID] as [EmployeeId] + FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] AND [a_Employee].[IsDeleted] = 0 + WHERE + [e].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [EmployeeTerritories] [d] ON [m_1].[EmployeeId] = [d].[EmployeeID] +WHERE + [d].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderId], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + ( + SELECT DISTINCT + [e].[OrderID] as [OrderId] + FROM + [Orders] [e] + WHERE + [e].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderId] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [a_Product].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry], + [a_Employee].[IsDeleted], + [a_Employee].[EmployeeID], + [a_Employee].[LastName], + [a_Employee].[FirstName], + [a_Employee].[Title], + [a_Employee].[TitleOfCourtesy], + [a_Employee].[BirthDate], + [a_Employee].[HireDate], + [a_Employee].[Address], + [a_Employee].[City], + [a_Employee].[Region], + [a_Employee].[PostalCode], + [a_Employee].[Country], + [a_Employee].[HomePhone], + [a_Employee].[Extension], + [a_Employee].[Photo], + [a_Employee].[Notes], + [a_Employee].[ReportsTo], + [a_Employee].[PhotoPath] +FROM + [Orders] [e] + LEFT JOIN [Employees] [a_Employee] ON [e].[EmployeeID] = [a_Employee].[EmployeeID] AND [a_Employee].[IsDeleted] = 0 +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestLoadFilter(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestLoadFilter(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..bb6aca03f8c1 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestLoadFilter(SqlServer.2022.MS,False).sql @@ -0,0 +1,125 @@ +Parameters: +@__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean) + +SELECT [p].[ProductName], [p].[ProductID], [t3].[Discount], [t3].[OrderID], [t3].[CustomerID], [t3].[EmployeeID], [t3].[Freight], [t3].[IsDeleted], [t3].[OrderDate], [t3].[RequiredDate], [t3].[ShipAddress], [t3].[ShipCity], [t3].[ShipCountry], [t3].[ShipName], [t3].[ShipPostalCode], [t3].[ShipRegion], [t3].[ShipVia], [t3].[ShippedDate], [t3].[OrderID0], [t3].[ProductID], [t3].[ProductID0], [t3].[ProductID1], [t3].[CategoryID], [t3].[Discontinued], [t3].[IsDeleted0], [t3].[ProductName], [t3].[QuantityPerUnit], [t3].[ReorderLevel], [t3].[SupplierID], [t3].[UnitPrice], [t3].[UnitsInStock], [t3].[UnitsOnOrder] +FROM [Products] AS [p] +LEFT JOIN ( + SELECT [o].[Discount], [t].[OrderID], [t].[CustomerID], [t].[EmployeeID], [t].[Freight], [t].[IsDeleted], [t].[OrderDate], [t].[RequiredDate], [t].[ShipAddress], [t].[ShipCity], [t].[ShipCountry], [t].[ShipName], [t].[ShipPostalCode], [t].[ShipRegion], [t].[ShipVia], [t].[ShippedDate], [o].[OrderID] AS [OrderID0], [o].[ProductID], [t0].[ProductID] AS [ProductID0], [t2].[ProductID] AS [ProductID1], [t2].[CategoryID], [t2].[Discontinued], [t2].[IsDeleted] AS [IsDeleted0], [t2].[ProductName], [t2].[QuantityPerUnit], [t2].[ReorderLevel], [t2].[SupplierID], [t2].[UnitPrice], [t2].[UnitsInStock], [t2].[UnitsOnOrder] + FROM [Order Details] AS [o] + INNER JOIN ( + SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[Freight], [o0].[IsDeleted], [o0].[OrderDate], [o0].[RequiredDate], [o0].[ShipAddress], [o0].[ShipCity], [o0].[ShipCountry], [o0].[ShipName], [o0].[ShipPostalCode], [o0].[ShipRegion], [o0].[ShipVia], [o0].[ShippedDate] + FROM [Orders] AS [o0] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t] ON [o].[OrderID] = [t].[OrderID] + INNER JOIN ( + SELECT [p0].[ProductID], [p0].[CategoryID], [p0].[Discontinued], [p0].[IsDeleted], [p0].[ProductName], [p0].[QuantityPerUnit], [p0].[ReorderLevel], [p0].[SupplierID], [p0].[UnitPrice], [p0].[UnitsInStock], [p0].[UnitsOnOrder] + FROM [Products] AS [p0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t0] ON [o].[ProductID] = [t0].[ProductID] + LEFT JOIN ( + SELECT [s].[SupplierID], [s].[Address], [s].[City], [s].[CompanyName], [s].[ContactName], [s].[ContactTitle], [s].[Country], [s].[Fax], [s].[HomePage], [s].[IsDeleted], [s].[Phone], [s].[PostalCode], [s].[Region] + FROM [Suppliers] AS [s] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([s].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [t0].[SupplierID] = [t1].[SupplierID] + LEFT JOIN ( + SELECT [p1].[ProductID], [p1].[CategoryID], [p1].[Discontinued], [p1].[IsDeleted], [p1].[ProductName], [p1].[QuantityPerUnit], [p1].[ReorderLevel], [p1].[SupplierID], [p1].[UnitPrice], [p1].[UnitsInStock], [p1].[UnitsOnOrder] + FROM [Products] AS [p1] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p1].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t2] ON [t1].[SupplierID] = [t2].[SupplierID] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +) AS [t3] ON [p].[ProductID] = [t3].[ProductID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [p].[ProductID], [t3].[OrderID0], [t3].[ProductID], [t3].[OrderID], [t3].[ProductID0], [t3].[ProductID1] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[SupplierId], + [m_1].[ProductId], + [d_1].[IsDeleted], + [d_1].[ProductID], + [d_1].[ProductName], + [d_1].[SupplierID], + [d_1].[CategoryID], + [d_1].[QuantityPerUnit], + [d_1].[UnitPrice], + [d_1].[UnitsInStock], + [d_1].[UnitsOnOrder], + [d_1].[ReorderLevel], + [d_1].[Discontinued] +FROM + ( + SELECT DISTINCT + [a_Supplier].[SupplierID] as [SupplierId], + [t1].[ProductId] + FROM + ( + SELECT DISTINCT + [e].[ProductID] as [ProductId] + FROM + [Products] [e] + WHERE + [e].[IsDeleted] = 0 + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[ProductId] = [d].[ProductID] + INNER JOIN [Orders] [e_1] ON [d].[OrderID] = [e_1].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + LEFT JOIN [Suppliers] [a_Supplier] ON [a_Product].[SupplierID] = [a_Supplier].[SupplierID] AND [a_Supplier].[IsDeleted] = 0 + WHERE + [e_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Products] [d_1] ON [m_1].[SupplierId] = [d_1].[SupplierID] OR [m_1].[SupplierId] IS NULL AND [d_1].[SupplierID] IS NULL +WHERE + [d_1].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductID], + [d].[Discount], + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry], + [a_Supplier].[SupplierID] +FROM + [Products] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[ProductID] = [d].[ProductID] + INNER JOIN [Orders] [e] ON [d].[OrderID] = [e].[OrderID] + LEFT JOIN [Suppliers] [a_Supplier] ON [m_1].[SupplierID] = [a_Supplier].[SupplierID] AND [a_Supplier].[IsDeleted] = 0 +WHERE + [m_1].[IsDeleted] = 0 AND [e].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [p].[ProductName], + [p].[ProductID] +FROM + [Products] [p] +WHERE + [p].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestLoadFilter(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestLoadFilter(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..bb6aca03f8c1 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestLoadFilter(SqlServer.2022.MS,True).sql @@ -0,0 +1,125 @@ +Parameters: +@__ef_filter__p_2='?' (DbType = Boolean), @__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_3='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean) + +SELECT [p].[ProductName], [p].[ProductID], [t3].[Discount], [t3].[OrderID], [t3].[CustomerID], [t3].[EmployeeID], [t3].[Freight], [t3].[IsDeleted], [t3].[OrderDate], [t3].[RequiredDate], [t3].[ShipAddress], [t3].[ShipCity], [t3].[ShipCountry], [t3].[ShipName], [t3].[ShipPostalCode], [t3].[ShipRegion], [t3].[ShipVia], [t3].[ShippedDate], [t3].[OrderID0], [t3].[ProductID], [t3].[ProductID0], [t3].[ProductID1], [t3].[CategoryID], [t3].[Discontinued], [t3].[IsDeleted0], [t3].[ProductName], [t3].[QuantityPerUnit], [t3].[ReorderLevel], [t3].[SupplierID], [t3].[UnitPrice], [t3].[UnitsInStock], [t3].[UnitsOnOrder] +FROM [Products] AS [p] +LEFT JOIN ( + SELECT [o].[Discount], [t].[OrderID], [t].[CustomerID], [t].[EmployeeID], [t].[Freight], [t].[IsDeleted], [t].[OrderDate], [t].[RequiredDate], [t].[ShipAddress], [t].[ShipCity], [t].[ShipCountry], [t].[ShipName], [t].[ShipPostalCode], [t].[ShipRegion], [t].[ShipVia], [t].[ShippedDate], [o].[OrderID] AS [OrderID0], [o].[ProductID], [t0].[ProductID] AS [ProductID0], [t2].[ProductID] AS [ProductID1], [t2].[CategoryID], [t2].[Discontinued], [t2].[IsDeleted] AS [IsDeleted0], [t2].[ProductName], [t2].[QuantityPerUnit], [t2].[ReorderLevel], [t2].[SupplierID], [t2].[UnitPrice], [t2].[UnitsInStock], [t2].[UnitsOnOrder] + FROM [Order Details] AS [o] + INNER JOIN ( + SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[Freight], [o0].[IsDeleted], [o0].[OrderDate], [o0].[RequiredDate], [o0].[ShipAddress], [o0].[ShipCity], [o0].[ShipCountry], [o0].[ShipName], [o0].[ShipPostalCode], [o0].[ShipRegion], [o0].[ShipVia], [o0].[ShippedDate] + FROM [Orders] AS [o0] + WHERE (@__ef_filter__p_2 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t] ON [o].[OrderID] = [t].[OrderID] + INNER JOIN ( + SELECT [p0].[ProductID], [p0].[CategoryID], [p0].[Discontinued], [p0].[IsDeleted], [p0].[ProductName], [p0].[QuantityPerUnit], [p0].[ReorderLevel], [p0].[SupplierID], [p0].[UnitPrice], [p0].[UnitsInStock], [p0].[UnitsOnOrder] + FROM [Products] AS [p0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p0].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t0] ON [o].[ProductID] = [t0].[ProductID] + LEFT JOIN ( + SELECT [s].[SupplierID], [s].[Address], [s].[City], [s].[CompanyName], [s].[ContactName], [s].[ContactTitle], [s].[Country], [s].[Fax], [s].[HomePage], [s].[IsDeleted], [s].[Phone], [s].[PostalCode], [s].[Region] + FROM [Suppliers] AS [s] + WHERE (@__ef_filter__p_3 = CAST(1 AS bit)) OR ([s].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t1] ON [t0].[SupplierID] = [t1].[SupplierID] + LEFT JOIN ( + SELECT [p1].[ProductID], [p1].[CategoryID], [p1].[Discontinued], [p1].[IsDeleted], [p1].[ProductName], [p1].[QuantityPerUnit], [p1].[ReorderLevel], [p1].[SupplierID], [p1].[UnitPrice], [p1].[UnitsInStock], [p1].[UnitsOnOrder] + FROM [Products] AS [p1] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p1].[IsDeleted] <> CAST(1 AS bit)) + ) AS [t2] ON [t1].[SupplierID] = [t2].[SupplierID] + WHERE (@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit)) +) AS [t3] ON [p].[ProductID] = [t3].[ProductID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) +ORDER BY [p].[ProductID], [t3].[OrderID0], [t3].[ProductID], [t3].[OrderID], [t3].[ProductID0], [t3].[ProductID1] + + + + +-- SqlServer.2022 + +SELECT + [m_1].[SupplierId], + [m_1].[ProductId], + [d_1].[IsDeleted], + [d_1].[ProductID], + [d_1].[ProductName], + [d_1].[SupplierID], + [d_1].[CategoryID], + [d_1].[QuantityPerUnit], + [d_1].[UnitPrice], + [d_1].[UnitsInStock], + [d_1].[UnitsOnOrder], + [d_1].[ReorderLevel], + [d_1].[Discontinued] +FROM + ( + SELECT DISTINCT + [a_Supplier].[SupplierID] as [SupplierId], + [t1].[ProductId] + FROM + ( + SELECT DISTINCT + [e].[ProductID] as [ProductId] + FROM + [Products] [e] + WHERE + [e].[IsDeleted] = 0 + ) [t1] + INNER JOIN [Order Details] [d] ON [t1].[ProductId] = [d].[ProductID] + INNER JOIN [Orders] [e_1] ON [d].[OrderID] = [e_1].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + LEFT JOIN [Suppliers] [a_Supplier] ON [a_Product].[SupplierID] = [a_Supplier].[SupplierID] AND [a_Supplier].[IsDeleted] = 0 + WHERE + [e_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + ) [m_1] + INNER JOIN [Products] [d_1] ON [m_1].[SupplierId] = [d_1].[SupplierID] OR [m_1].[SupplierId] IS NULL AND [d_1].[SupplierID] IS NULL +WHERE + [d_1].[IsDeleted] = 0 + + + +-- SqlServer.2022 + +SELECT + [m_1].[ProductID], + [d].[Discount], + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry], + [a_Supplier].[SupplierID] +FROM + [Products] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[ProductID] = [d].[ProductID] + INNER JOIN [Orders] [e] ON [d].[OrderID] = [e].[OrderID] + LEFT JOIN [Suppliers] [a_Supplier] ON [m_1].[SupplierID] = [a_Supplier].[SupplierID] AND [a_Supplier].[IsDeleted] = 0 +WHERE + [m_1].[IsDeleted] = 0 AND [e].[IsDeleted] = 0 AND [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [p].[ProductName], + [p].[ProductID] +FROM + [Products] [p] +WHERE + [p].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNestingFunctions(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNestingFunctions(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..634e36833d26 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNestingFunctions(SqlServer.2022.MS,False).sql @@ -0,0 +1,71 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder], [t].[ProductID], [t].[CategoryID], [t].[Discontinued], [t].[IsDeleted], [t].[ProductName], [t].[QuantityPerUnit], [t].[ReorderLevel], [t].[SupplierID], [t].[UnitPrice], [t].[UnitsInStock], [t].[UnitsOnOrder] +FROM [Products] AS [p] +CROSS JOIN ( + SELECT [p0].[ProductID], [p0].[CategoryID], [p0].[Discontinued], [p0].[IsDeleted], [p0].[ProductName], [p0].[QuantityPerUnit], [p0].[ReorderLevel], [p0].[SupplierID], [p0].[UnitPrice], [p0].[UnitsInStock], [p0].[UnitsOnOrder] + FROM [Products] AS [p0] + WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p0].[IsDeleted] <> CAST(1 AS bit))) AND (( + SELECT COUNT(*) + FROM [Order Details] AS [o] + WHERE ((@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit))) AND ([p0].[ProductID] = [o].[ProductID])) > 0) +) AS [t] +WHERE (((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (( + SELECT COUNT(*) + FROM [Order Details] AS [o0] + WHERE ((@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit))) AND ([p].[ProductID] = [o0].[ProductID])) > 0)) AND ([p].[ProductID] = [t].[ProductID]) +ORDER BY [p].[ProductID] + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued], + [pd2].[IsDeleted], + [pd2].[ProductID], + [pd2].[ProductName], + [pd2].[SupplierID], + [pd2].[CategoryID], + [pd2].[QuantityPerUnit], + [pd2].[UnitPrice], + [pd2].[UnitsInStock], + [pd2].[UnitsOnOrder], + [pd2].[ReorderLevel], + [pd2].[Discontinued] +FROM + [Products] [e], + [Products] [pd2] +WHERE + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_1] + WHERE + [e].[ProductID] = [e_1].[ProductID] + ) > 0 AND + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_2] + WHERE + [pd2].[ProductID] = [e_2].[ProductID] + ) > 0 AND + [e].[ProductID] = [pd2].[ProductID] +ORDER BY + [e].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNestingFunctions(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNestingFunctions(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..8a39117009de --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNestingFunctions(SqlServer.2022.MS,True).sql @@ -0,0 +1,73 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean) + +SELECT [p].[ProductID], [p].[CategoryID], [p].[Discontinued], [p].[IsDeleted], [p].[ProductName], [p].[QuantityPerUnit], [p].[ReorderLevel], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [p].[UnitsOnOrder], [t].[ProductID], [t].[CategoryID], [t].[Discontinued], [t].[IsDeleted], [t].[ProductName], [t].[QuantityPerUnit], [t].[ReorderLevel], [t].[SupplierID], [t].[UnitPrice], [t].[UnitsInStock], [t].[UnitsOnOrder] +FROM [Products] AS [p] +CROSS JOIN ( + SELECT [p0].[ProductID], [p0].[CategoryID], [p0].[Discontinued], [p0].[IsDeleted], [p0].[ProductName], [p0].[QuantityPerUnit], [p0].[ReorderLevel], [p0].[SupplierID], [p0].[UnitPrice], [p0].[UnitsInStock], [p0].[UnitsOnOrder] + FROM [Products] AS [p0] + WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p0].[IsDeleted] <> CAST(1 AS bit))) AND (( + SELECT COUNT(*) + FROM [Order Details] AS [o] + WHERE ((@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o].[IsDeleted] <> CAST(1 AS bit))) AND ([p0].[ProductID] = [o].[ProductID])) > 0) +) AS [t] +WHERE (((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND (( + SELECT COUNT(*) + FROM [Order Details] AS [o0] + WHERE ((@__ef_filter__p_1 = CAST(1 AS bit)) OR ([o0].[IsDeleted] <> CAST(1 AS bit))) AND ([p].[ProductID] = [o0].[ProductID])) > 0)) AND ([p].[ProductID] = [t].[ProductID]) +ORDER BY [p].[ProductID] + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued], + [pd2].[IsDeleted], + [pd2].[ProductID], + [pd2].[ProductName], + [pd2].[SupplierID], + [pd2].[CategoryID], + [pd2].[QuantityPerUnit], + [pd2].[UnitPrice], + [pd2].[UnitsInStock], + [pd2].[UnitsOnOrder], + [pd2].[ReorderLevel], + [pd2].[Discontinued] +FROM + [Products] [e], + [Products] [pd2] +WHERE + [e].[IsDeleted] = 0 AND + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_1] + WHERE + [e_1].[IsDeleted] = 0 AND [e].[ProductID] = [e_1].[ProductID] + ) > 0 AND + [pd2].[IsDeleted] = 0 AND + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_2] + WHERE + [e_2].[IsDeleted] = 0 AND [pd2].[ProductID] = [e_2].[ProductID] + ) > 0 AND + [e].[ProductID] = [pd2].[ProductID] +ORDER BY + [e].[ProductID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNullability(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNullability(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..581d0633289b --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNullability(SqlServer.2022.MS,False).sql @@ -0,0 +1,39 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean), @__test_0='?' (DbType = Int32) + +SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] +FROM [Employees] AS [e] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit))) AND ([e].[EmployeeID] = @__test_0) + + +-- SqlServer.2022 +DECLARE @test Int -- Int32 +SET @test = 1 + +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath] +FROM + [Employees] [e] +WHERE + [e].[EmployeeID] = @test + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNullability(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNullability(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..7a654fbad967 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestNullability(SqlServer.2022.MS,True).sql @@ -0,0 +1,39 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean), @__test_0='?' (DbType = Int32) + +SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy] +FROM [Employees] AS [e] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit))) AND ([e].[EmployeeID] = @__test_0) + + +-- SqlServer.2022 +DECLARE @test Int -- Int32 +SET @test = 1 + +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath] +FROM + [Employees] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[EmployeeID] = @test + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestSetUpdate(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestSetUpdate(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..262aaf656ea3 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestSetUpdate(SqlServer.2022.MS,False).sql @@ -0,0 +1,23 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[IsDeleted], [c].[Phone], [c].[PostalCode], [c].[Region] +FROM [Customers] AS [c] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 +DECLARE @CompanyName NVarChar(40) -- String +SET @CompanyName = N'Alfreds Futterkiste' +DECLARE @CustomerId NVarChar(5) -- String +SET @CustomerId = N'ALFKI' + +UPDATE + [Customers] +SET + [CompanyName] = @CompanyName +WHERE + [Customers].[CustomerID] = @CustomerId + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestSetUpdate(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestSetUpdate(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..6f5ed001a282 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestSetUpdate(SqlServer.2022.MS,True).sql @@ -0,0 +1,23 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[IsDeleted], [c].[Phone], [c].[PostalCode], [c].[Region] +FROM [Customers] AS [c] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([c].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 +DECLARE @CompanyName NVarChar(40) -- String +SET @CompanyName = N'Alfreds Futterkiste' +DECLARE @CustomerId NVarChar(5) -- String +SET @CustomerId = N'ALFKI' + +UPDATE + [Customers] +SET + [CompanyName] = @CompanyName +WHERE + [Customers].[IsDeleted] = 0 AND [Customers].[CustomerID] = @CustomerId + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestShadowProperty(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestShadowProperty(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..5b5630efb13f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestShadowProperty(SqlServer.2022.MS,False).sql @@ -0,0 +1,17 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[QuantityPerUnit] AS [Quantity] +FROM [Products] AS [p] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [p].[QuantityPerUnit] +FROM + [Products] [p] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestShadowProperty(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestShadowProperty(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..bdfa0ee4058f --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestShadowProperty(SqlServer.2022.MS,True).sql @@ -0,0 +1,19 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT [p].[QuantityPerUnit] AS [Quantity] +FROM [Products] AS [p] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +SELECT + [p].[QuantityPerUnit] +FROM + [Products] [p] +WHERE + [p].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTagWith(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTagWith(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..7d71d9dc4014 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTagWith(SqlServer.2022.MS,False).sql @@ -0,0 +1,63 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +-- Tagged query + +SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy] +FROM [Employees] AS [e] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[Address], [e0].[BirthDate], [e0].[City], [e0].[Country], [e0].[Extension], [e0].[FirstName], [e0].[HireDate], [e0].[HomePhone], [e0].[IsDeleted], [e0].[LastName], [e0].[Notes], [e0].[Photo], [e0].[PhotoPath], [e0].[PostalCode], [e0].[Region], [e0].[ReportsTo], [e0].[Title], [e0].[TitleOfCourtesy] + FROM [Employees] AS [e0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [e].[ReportsTo] = [t].[EmployeeID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +/* Tagged query */ +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath], + [a_ReportsToNavigation].[IsDeleted], + [a_ReportsToNavigation].[EmployeeID], + [a_ReportsToNavigation].[LastName], + [a_ReportsToNavigation].[FirstName], + [a_ReportsToNavigation].[Title], + [a_ReportsToNavigation].[TitleOfCourtesy], + [a_ReportsToNavigation].[BirthDate], + [a_ReportsToNavigation].[HireDate], + [a_ReportsToNavigation].[Address], + [a_ReportsToNavigation].[City], + [a_ReportsToNavigation].[Region], + [a_ReportsToNavigation].[PostalCode], + [a_ReportsToNavigation].[Country], + [a_ReportsToNavigation].[HomePhone], + [a_ReportsToNavigation].[Extension], + [a_ReportsToNavigation].[Photo], + [a_ReportsToNavigation].[Notes], + [a_ReportsToNavigation].[ReportsTo], + [a_ReportsToNavigation].[PhotoPath] +FROM + [Employees] [e] + LEFT JOIN [Employees] [a_ReportsToNavigation] ON [e].[ReportsTo] = [a_ReportsToNavigation].[EmployeeID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTagWith(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTagWith(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..2546ea629557 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTagWith(SqlServer.2022.MS,True).sql @@ -0,0 +1,65 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +-- Tagged query + +SELECT [e].[EmployeeID], [e].[Address], [e].[BirthDate], [e].[City], [e].[Country], [e].[Extension], [e].[FirstName], [e].[HireDate], [e].[HomePhone], [e].[IsDeleted], [e].[LastName], [e].[Notes], [e].[Photo], [e].[PhotoPath], [e].[PostalCode], [e].[Region], [e].[ReportsTo], [e].[Title], [e].[TitleOfCourtesy], [t].[EmployeeID], [t].[Address], [t].[BirthDate], [t].[City], [t].[Country], [t].[Extension], [t].[FirstName], [t].[HireDate], [t].[HomePhone], [t].[IsDeleted], [t].[LastName], [t].[Notes], [t].[Photo], [t].[PhotoPath], [t].[PostalCode], [t].[Region], [t].[ReportsTo], [t].[Title], [t].[TitleOfCourtesy] +FROM [Employees] AS [e] +LEFT JOIN ( + SELECT [e0].[EmployeeID], [e0].[Address], [e0].[BirthDate], [e0].[City], [e0].[Country], [e0].[Extension], [e0].[FirstName], [e0].[HireDate], [e0].[HomePhone], [e0].[IsDeleted], [e0].[LastName], [e0].[Notes], [e0].[Photo], [e0].[PhotoPath], [e0].[PostalCode], [e0].[Region], [e0].[ReportsTo], [e0].[Title], [e0].[TitleOfCourtesy] + FROM [Employees] AS [e0] + WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e0].[IsDeleted] <> CAST(1 AS bit)) +) AS [t] ON [e].[ReportsTo] = [t].[EmployeeID] +WHERE (@__ef_filter__p_0 = CAST(1 AS bit)) OR ([e].[IsDeleted] <> CAST(1 AS bit)) + + +-- SqlServer.2022 + +/* Tagged query */ +SELECT + [e].[IsDeleted], + [e].[EmployeeID], + [e].[LastName], + [e].[FirstName], + [e].[Title], + [e].[TitleOfCourtesy], + [e].[BirthDate], + [e].[HireDate], + [e].[Address], + [e].[City], + [e].[Region], + [e].[PostalCode], + [e].[Country], + [e].[HomePhone], + [e].[Extension], + [e].[Photo], + [e].[Notes], + [e].[ReportsTo], + [e].[PhotoPath], + [a_ReportsToNavigation].[IsDeleted], + [a_ReportsToNavigation].[EmployeeID], + [a_ReportsToNavigation].[LastName], + [a_ReportsToNavigation].[FirstName], + [a_ReportsToNavigation].[Title], + [a_ReportsToNavigation].[TitleOfCourtesy], + [a_ReportsToNavigation].[BirthDate], + [a_ReportsToNavigation].[HireDate], + [a_ReportsToNavigation].[Address], + [a_ReportsToNavigation].[City], + [a_ReportsToNavigation].[Region], + [a_ReportsToNavigation].[PostalCode], + [a_ReportsToNavigation].[Country], + [a_ReportsToNavigation].[HomePhone], + [a_ReportsToNavigation].[Extension], + [a_ReportsToNavigation].[Photo], + [a_ReportsToNavigation].[Notes], + [a_ReportsToNavigation].[ReportsTo], + [a_ReportsToNavigation].[PhotoPath] +FROM + [Employees] [e] + LEFT JOIN [Employees] [a_ReportsToNavigation] ON [e].[ReportsTo] = [a_ReportsToNavigation].[EmployeeID] AND [a_ReportsToNavigation].[IsDeleted] = 0 +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestToList(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestToList(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..beffe951a801 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestToList(SqlServer.2022.MS,False).sql @@ -0,0 +1,55 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestToList(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestToList(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..7ad21fbf6a37 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestToList(SqlServer.2022.MS,True).sql @@ -0,0 +1,60 @@ + + +-- SqlServer.2022 + +SELECT + [m_1].[OrderID], + [d].[IsDeleted], + [d].[OrderID], + [d].[ProductID], + [d].[UnitPrice], + [d].[Quantity], + [d].[Discount], + [a_Product].[IsDeleted], + [a_Product].[ProductID], + [a_Product].[ProductName], + [a_Product].[SupplierID], + [a_Product].[CategoryID], + [a_Product].[QuantityPerUnit], + [a_Product].[UnitPrice], + [a_Product].[UnitsInStock], + [a_Product].[UnitsOnOrder], + [a_Product].[ReorderLevel], + [a_Product].[Discontinued] +FROM + [Orders] [m_1] + INNER JOIN [Order Details] [d] ON [m_1].[OrderID] = [d].[OrderID] + INNER JOIN [Products] [a_Product] ON [d].[ProductID] = [a_Product].[ProductID] +WHERE + [m_1].[IsDeleted] = 0 AND [a_Product].[IsDeleted] = 0 AND + [d].[IsDeleted] = 0 + + + + + +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[OrderID], + [e].[CustomerID], + [e].[EmployeeID], + [e].[OrderDate], + [e].[RequiredDate], + [e].[ShippedDate], + [e].[ShipVia], + [e].[Freight], + [e].[ShipName], + [e].[ShipAddress], + [e].[ShipCity], + [e].[ShipRegion], + [e].[ShipPostalCode], + [e].[ShipCountry] +FROM + [Orders] [e] +WHERE + [e].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransaction(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransaction(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..2f87bb5c45fe --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransaction(SqlServer.2022.MS,False).sql @@ -0,0 +1,29 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT MAX([p].[QuantityPerUnit]) +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND ([p].[ProductName] LIKE N'U%') + + +-- SqlServer.2022 + +SELECT + MAX([e].[QuantityPerUnit]) +FROM + [Products] [e] +WHERE + [e].[ProductName] LIKE N'U%' ESCAPE N'~' + + + +-- SqlServer.2022 + +DELETE [e] +FROM + [Products] [e] +WHERE + [e].[ProductName] = N'a' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransaction(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransaction(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..e44eefaf3d7b --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransaction(SqlServer.2022.MS,True).sql @@ -0,0 +1,29 @@ +Parameters: +@__ef_filter__p_0='?' (DbType = Boolean) + +SELECT MAX([p].[QuantityPerUnit]) +FROM [Products] AS [p] +WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([p].[IsDeleted] <> CAST(1 AS bit))) AND ([p].[ProductName] LIKE N'U%') + + +-- SqlServer.2022 + +SELECT + MAX([e].[QuantityPerUnit]) +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[ProductName] LIKE N'U%' ESCAPE N'~' + + + +-- SqlServer.2022 + +DELETE [e] +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND [e].[ProductName] = N'a' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformation(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformation(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..de3bb736e95a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformation(SqlServer.2022.MS,False).sql @@ -0,0 +1,25 @@ +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [c_1].[IsDeleted], + [c_1].[CategoryID], + [c_1].[CategoryName], + [c_1].[Description], + [c_1].[Picture] +FROM + [Products] [p] + INNER JOIN [Categories] [c_1] ON [c_1].[CategoryID] = [p].[CategoryID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformation(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformation(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..ee908bd88b77 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformation(SqlServer.2022.MS,True).sql @@ -0,0 +1,27 @@ +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [c_1].[IsDeleted], + [c_1].[CategoryID], + [c_1].[CategoryName], + [c_1].[Description], + [c_1].[Picture] +FROM + [Products] [p] + INNER JOIN [Categories] [c_1] ON [c_1].[CategoryID] = [p].[CategoryID] +WHERE + [p].[IsDeleted] = 0 AND [c_1].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformationTable(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformationTable(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..de3bb736e95a --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformationTable(SqlServer.2022.MS,False).sql @@ -0,0 +1,25 @@ +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [c_1].[IsDeleted], + [c_1].[CategoryID], + [c_1].[CategoryName], + [c_1].[Description], + [c_1].[Picture] +FROM + [Products] [p] + INNER JOIN [Categories] [c_1] ON [c_1].[CategoryID] = [p].[CategoryID] + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformationTable(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformationTable(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..ee908bd88b77 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestTransformationTable(SqlServer.2022.MS,True).sql @@ -0,0 +1,27 @@ +-- SqlServer.2022 + +SELECT + [p].[IsDeleted], + [p].[ProductID], + [p].[ProductName], + [p].[SupplierID], + [p].[CategoryID], + [p].[QuantityPerUnit], + [p].[UnitPrice], + [p].[UnitsInStock], + [p].[UnitsOnOrder], + [p].[ReorderLevel], + [p].[Discontinued], + [c_1].[IsDeleted], + [c_1].[CategoryID], + [c_1].[CategoryName], + [c_1].[Description], + [c_1].[Picture] +FROM + [Products] [p] + INNER JOIN [Categories] [c_1] ON [c_1].[CategoryID] = [p].[CategoryID] +WHERE + [p].[IsDeleted] = 0 AND [c_1].[IsDeleted] = 0 + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdate(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdate(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..6cc0084c3173 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdate(SqlServer.2022.MS,False).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022 +DECLARE @test Int -- Int32 +SET @test = 1 + +UPDATE + [Employees] +SET + [Address] = [Employees].[Address] +WHERE + [Employees].[EmployeeID] = @test + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdate(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdate(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..6cc0084c3173 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdate(SqlServer.2022.MS,True).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022 +DECLARE @test Int -- Int32 +SET @test = 1 + +UPDATE + [Employees] +SET + [Address] = [Employees].[Address] +WHERE + [Employees].[EmployeeID] = @test + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdateAsync(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdateAsync(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..6cc0084c3173 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdateAsync(SqlServer.2022.MS,False).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022 +DECLARE @test Int -- Int32 +SET @test = 1 + +UPDATE + [Employees] +SET + [Address] = [Employees].[Address] +WHERE + [Employees].[EmployeeID] = @test + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdateAsync(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdateAsync(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..6cc0084c3173 --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestUpdateAsync(SqlServer.2022.MS,True).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022 +DECLARE @test Int -- Int32 +SET @test = 1 + +UPDATE + [Employees] +SET + [Address] = [Employees].[Address] +WHERE + [Employees].[EmployeeID] = @test + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestView(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestView(SqlServer.2022.MS,False).sql new file mode 100644 index 000000000000..39c7d48fa4ff --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestView(SqlServer.2022.MS,False).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + ( + SELECT + COUNT(*) + FROM + [Order Details] [e_1] + WHERE + [e].[ProductID] = [e_1].[ProductID] + ) > 0 AND + [e].[ProductName] LIKE N'a%' ESCAPE N'~' + + + diff --git a/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestView(SqlServer.2022.MS,True).sql b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestView(SqlServer.2022.MS,True).sql new file mode 100644 index 000000000000..2f656cd95b4b --- /dev/null +++ b/SqlServer.2022.MS.EF31/LinqToDB/EntityFrameworkCore/Tests/ToolsTests/LinqToDB.EntityFrameworkCore.Tests.ToolsTests.TestView(SqlServer.2022.MS,True).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [e].[IsDeleted], + [e].[ProductID], + [e].[ProductName], + [e].[SupplierID], + [e].[CategoryID], + [e].[QuantityPerUnit], + [e].[UnitPrice], + [e].[UnitsInStock], + [e].[UnitsOnOrder], + [e].[ReorderLevel], + [e].[Discontinued] +FROM + [Products] [e] +WHERE + [e].[IsDeleted] = 0 AND ( + SELECT + COUNT(*) + FROM + [Order Details] [e_1] + WHERE + [e_1].[IsDeleted] = 0 AND [e].[ProductID] = [e_1].[ProductID] + ) > 0 AND + [e].[ProductName] LIKE N'a%' ESCAPE N'~' + + + diff --git a/SqlServer.2022.MS/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestGeographyMicrosoft(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestGeographyMicrosoft(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a1f7a85ddd64 --- /dev/null +++ b/SqlServer.2022.MS/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestGeographyMicrosoft(SqlServer.2022.MS).sql @@ -0,0 +1,17 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[geographyDataType].STSrid, + [t].[geographyDataType].Lat, + [t].[geographyDataType].Long, + [t].[geographyDataType].Z, + [t].[geographyDataType].M, + geography::GeomFromGml([t].[geographyDataType].AsGml(), 4326), + [t].[geographyDataType].AsGml(), + [t].[geographyDataType], + geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)'), + geography::Point(1, 1, 4326), + geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326) +FROM + [AllTypes2] [t] + diff --git a/SqlServer.2022.MS/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestHierarchyId(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestHierarchyId(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..cb6f0208cec3 --- /dev/null +++ b/SqlServer.2022.MS/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestHierarchyId(SqlServer.2022.MS).sql @@ -0,0 +1,16 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + hierarchyid::GetRoot(), + [t].[hierarchyidDataType].GetDescendant(hierarchyid::Parse('/1/3/4/'), hierarchyid::Parse('/1/3/5/')), + [t].[hierarchyidDataType].IsDescendantOf(hierarchyid::Parse('/1/')), + [t].[hierarchyidDataType].GetLevel(), + [t].[hierarchyidDataType].GetAncestor(0), + [t].[hierarchyidDataType].GetReparentedValue(hierarchyid::Parse('/1/'), hierarchyid::Parse('/2/')), + hierarchyid::Parse('/1/2/3/4/5/'), + [t].[hierarchyidDataType] +FROM + [AllTypes2] [t] +WHERE + [t].[hierarchyidDataType].GetLevel() > 0 + diff --git a/SqlServer.2022.MS/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like11(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like11(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..117f24dffd87 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like11(SqlServer.2022.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[FirstName] LIKE N'%hn%' AND [p].[PersonID] = 1 + diff --git a/SqlServer.2022.MS/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like12(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like12(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..3670c9a666dd --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like12(SqlServer.2022.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[FirstName] NOT LIKE N'%h~%n%' ESCAPE N'~' AND + [p].[PersonID] = 1 + diff --git a/SqlServer.2022/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestGeographyMicrosoft(SqlServer.2022).sql b/SqlServer.2022/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestGeographyMicrosoft(SqlServer.2022).sql new file mode 100644 index 000000000000..32da7465a304 --- /dev/null +++ b/SqlServer.2022/Tests/DataProvider/SqlServerTypesTests/Tests.DataProvider.SqlServerTypesTests.TestGeographyMicrosoft(SqlServer.2022).sql @@ -0,0 +1,17 @@ +-- SqlServer.2022 + +SELECT + [t].[geographyDataType].STSrid, + [t].[geographyDataType].Lat, + [t].[geographyDataType].Long, + [t].[geographyDataType].Z, + [t].[geographyDataType].M, + geography::GeomFromGml([t].[geographyDataType].AsGml(), 4326), + [t].[geographyDataType].AsGml(), + [t].[geographyDataType], + geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)'), + geography::Point(1, 1, 4326), + geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326) +FROM + [AllTypes2] [t] + diff --git a/SqlServer.2022/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like11(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like11(SqlServer.2022).sql new file mode 100644 index 000000000000..0ce2fcd2fff0 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like11(SqlServer.2022).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[FirstName] LIKE N'%hn%' AND [p].[PersonID] = 1 + diff --git a/SqlServer.2022/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like12(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like12(SqlServer.2022).sql new file mode 100644 index 000000000000..35a8ad6bc6b2 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/StringFunctionTests/Tests.Linq.StringFunctionTests.Like12(SqlServer.2022).sql @@ -0,0 +1,14 @@ +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[FirstName] NOT LIKE N'%h~%n%' ESCAPE N'~' AND + [p].[PersonID] = 1 +