diff --git a/benchmarks/Benchmarks.sln b/benchmarks/Benchmarks.sln
index e9923c42a06..cf4a12ce268 100644
--- a/benchmarks/Benchmarks.sln
+++ b/benchmarks/Benchmarks.sln
@@ -8,13 +8,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\.editorconfig = ..\.editorconfig
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks", "EFCore.Benchmarks\EFCore.Benchmarks.csproj", "{E4F44442-7AD2-480D-AD6B-AAC4424F5FA7}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EC34FF67-C5B1-47C5-ADD7-D30E5DABD242}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.EF6", "EFCore.Benchmarks.EF6\EFCore.Benchmarks.EF6.csproj", "{B4A5F452-58BB-4E9A-B0F0-3ADBE72B45CC}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{51D56015-664F-4ADD-8845-5F27F82124DA}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.EFCore", "EFCore.Benchmarks.EFCore\EFCore.Benchmarks.EFCore.csproj", "{7A16A0CD-5072-42AD-B529-F5CA4DF887D5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks", "src\EFCore.Benchmarks\EFCore.Benchmarks.csproj", "{24050F6A-0998-43D6-860B-2EC025D606C4}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.EFCore2", "EFCore.Benchmarks.EFCore2\EFCore.Benchmarks.EFCore2.csproj", "{281A64FC-F5D2-4A57-BC5B-3480BAC514DB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.Dev", "src\EFCore.Benchmarks.Dev\EFCore.Benchmarks.Dev.csproj", "{D0FB3432-7825-46DC-96DA-A348AD58FCE5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.SqlServer.Dev", "test\EFCore.Benchmarks.SqlServer.Dev\EFCore.Benchmarks.SqlServer.Dev.csproj", "{D314175F-6057-4EFD-BE1E-06B9C702D115}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.V2", "src\EFCore.Benchmarks.V2\EFCore.Benchmarks.V2.csproj", "{4610317A-2804-4D52-BB9A-22AFCE951D9E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.SqlServer.V2", "test\EFCore.Benchmarks.SqlServer.V2\EFCore.Benchmarks.SqlServer.V2.csproj", "{629DAC6E-50D4-48C5-A991-105249FCE9A1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.EF6", "test\EFCore.Benchmarks.EF6\EFCore.Benchmarks.EF6.csproj", "{F13E7369-B78E-4132-B5E6-9FB9DBA50638}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.Sqlite.Dev", "test\EFCore.Benchmarks.Sqlite.Dev\EFCore.Benchmarks.Sqlite.Dev.csproj", "{60DB667E-DD27-4B2D-887E-B7D07C556F60}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.Sqlite.V2", "test\EFCore.Benchmarks.Sqlite.V2\EFCore.Benchmarks.Sqlite.V2.csproj", "{81C9E4BB-039D-4A18-90AD-B413104D2BE9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -22,26 +34,52 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E4F44442-7AD2-480D-AD6B-AAC4424F5FA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E4F44442-7AD2-480D-AD6B-AAC4424F5FA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E4F44442-7AD2-480D-AD6B-AAC4424F5FA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E4F44442-7AD2-480D-AD6B-AAC4424F5FA7}.Release|Any CPU.Build.0 = Release|Any CPU
- {B4A5F452-58BB-4E9A-B0F0-3ADBE72B45CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B4A5F452-58BB-4E9A-B0F0-3ADBE72B45CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B4A5F452-58BB-4E9A-B0F0-3ADBE72B45CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B4A5F452-58BB-4E9A-B0F0-3ADBE72B45CC}.Release|Any CPU.Build.0 = Release|Any CPU
- {7A16A0CD-5072-42AD-B529-F5CA4DF887D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7A16A0CD-5072-42AD-B529-F5CA4DF887D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7A16A0CD-5072-42AD-B529-F5CA4DF887D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7A16A0CD-5072-42AD-B529-F5CA4DF887D5}.Release|Any CPU.Build.0 = Release|Any CPU
- {281A64FC-F5D2-4A57-BC5B-3480BAC514DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {281A64FC-F5D2-4A57-BC5B-3480BAC514DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {281A64FC-F5D2-4A57-BC5B-3480BAC514DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {281A64FC-F5D2-4A57-BC5B-3480BAC514DB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {24050F6A-0998-43D6-860B-2EC025D606C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {24050F6A-0998-43D6-860B-2EC025D606C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {24050F6A-0998-43D6-860B-2EC025D606C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {24050F6A-0998-43D6-860B-2EC025D606C4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D0FB3432-7825-46DC-96DA-A348AD58FCE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D0FB3432-7825-46DC-96DA-A348AD58FCE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D0FB3432-7825-46DC-96DA-A348AD58FCE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D0FB3432-7825-46DC-96DA-A348AD58FCE5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D314175F-6057-4EFD-BE1E-06B9C702D115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D314175F-6057-4EFD-BE1E-06B9C702D115}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D314175F-6057-4EFD-BE1E-06B9C702D115}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D314175F-6057-4EFD-BE1E-06B9C702D115}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4610317A-2804-4D52-BB9A-22AFCE951D9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4610317A-2804-4D52-BB9A-22AFCE951D9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4610317A-2804-4D52-BB9A-22AFCE951D9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4610317A-2804-4D52-BB9A-22AFCE951D9E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {629DAC6E-50D4-48C5-A991-105249FCE9A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {629DAC6E-50D4-48C5-A991-105249FCE9A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {629DAC6E-50D4-48C5-A991-105249FCE9A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {629DAC6E-50D4-48C5-A991-105249FCE9A1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F13E7369-B78E-4132-B5E6-9FB9DBA50638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F13E7369-B78E-4132-B5E6-9FB9DBA50638}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F13E7369-B78E-4132-B5E6-9FB9DBA50638}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F13E7369-B78E-4132-B5E6-9FB9DBA50638}.Release|Any CPU.Build.0 = Release|Any CPU
+ {60DB667E-DD27-4B2D-887E-B7D07C556F60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {60DB667E-DD27-4B2D-887E-B7D07C556F60}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {60DB667E-DD27-4B2D-887E-B7D07C556F60}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {60DB667E-DD27-4B2D-887E-B7D07C556F60}.Release|Any CPU.Build.0 = Release|Any CPU
+ {81C9E4BB-039D-4A18-90AD-B413104D2BE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {81C9E4BB-039D-4A18-90AD-B413104D2BE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {81C9E4BB-039D-4A18-90AD-B413104D2BE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81C9E4BB-039D-4A18-90AD-B413104D2BE9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {24050F6A-0998-43D6-860B-2EC025D606C4} = {EC34FF67-C5B1-47C5-ADD7-D30E5DABD242}
+ {D0FB3432-7825-46DC-96DA-A348AD58FCE5} = {EC34FF67-C5B1-47C5-ADD7-D30E5DABD242}
+ {D314175F-6057-4EFD-BE1E-06B9C702D115} = {51D56015-664F-4ADD-8845-5F27F82124DA}
+ {4610317A-2804-4D52-BB9A-22AFCE951D9E} = {EC34FF67-C5B1-47C5-ADD7-D30E5DABD242}
+ {629DAC6E-50D4-48C5-A991-105249FCE9A1} = {51D56015-664F-4ADD-8845-5F27F82124DA}
+ {F13E7369-B78E-4132-B5E6-9FB9DBA50638} = {51D56015-664F-4ADD-8845-5F27F82124DA}
+ {60DB667E-DD27-4B2D-887E-B7D07C556F60} = {51D56015-664F-4ADD-8845-5F27F82124DA}
+ {81C9E4BB-039D-4A18-90AD-B413104D2BE9} = {51D56015-664F-4ADD-8845-5F27F82124DA}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {162196A2-48F2-414D-8DBF-2B595159AAFC}
EndGlobalSection
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/EFCore.Benchmarks.EFCore.csproj b/benchmarks/EFCore.Benchmarks.EFCore/EFCore.Benchmarks.EFCore.csproj
deleted file mode 100644
index 811a9540d79..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore/EFCore.Benchmarks.EFCore.csproj
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- net461;netcoreapp2.0;netcoreapp2.1
- Microsoft.EntityFrameworkCore.Benchmarks.EFCore
- Exe
-
-
-
-
- PreserveNewest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/InitializationTests.cs b/benchmarks/EFCore.Benchmarks.EFCore/InitializationTests.cs
deleted file mode 100644
index 0ee9a056ec6..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore/InitializationTests.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Linq;
-using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.AdventureWorks;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
-using Microsoft.EntityFrameworkCore.Metadata.Conventions;
-
-// ReSharper disable InconsistentNaming
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore
-{
- public class InitializationTests
- {
-#if NET461
- private ColdStartSandbox _sandbox;
-#endif
- private ColdStartEnabledTests _testClass;
-
-#if NET461
- [Params(true, false)]
-#elif NETCOREAPP2_0
- [Params(false)]
-#endif
- public bool Cold { get; set; }
-
- [GlobalSetup]
- public virtual void Initialize()
- {
- if (Cold)
- {
-#if NET461
- _sandbox = new ColdStartSandbox();
- _testClass = _sandbox.CreateInstance();
-#endif
- }
- else
- {
- _testClass = new ColdStartEnabledTests();
- }
- }
-
-#if NET461
- [GlobalCleanup]
- public virtual void CleanupContext()
- {
- _sandbox?.Dispose();
- }
-#endif
-
- [Benchmark]
- public virtual void CreateAndDisposeUnusedContext()
- {
- _testClass.CreateAndDisposeUnusedContext(Cold ? 1 : 10000);
- }
-
- [Benchmark]
- public virtual void InitializeAndQuery_AdventureWorks()
- {
- _testClass.InitializeAndQuery_AdventureWorks(Cold ? 1 : 1000);
- }
-
- [Benchmark]
- public virtual void InitializeAndSaveChanges_AdventureWorks()
- {
- _testClass.InitializeAndSaveChanges_AdventureWorks(Cold ? 1 : 100);
- }
-
- [Benchmark]
- public virtual void BuildModel_AdventureWorks()
- {
- var builder = new ModelBuilder(SqlServerConventionSetBuilder.Build());
- AdventureWorksContext.ConfigureModel(builder);
-
- // ReSharper disable once UnusedVariable
- var model = builder.Model;
- }
-
- private class ColdStartEnabledTests : MarshalByRefObject
- {
- public void CreateAndDisposeUnusedContext(int count)
- {
- for (var i = 0; i < count; i++)
- {
- // ReSharper disable once UnusedVariable
- using (var context = AdventureWorksFixture.CreateContext())
- {
- }
- }
- }
-
- public void InitializeAndQuery_AdventureWorks(int count)
- {
- for (var i = 0; i < count; i++)
- {
- using (var context = AdventureWorksFixture.CreateContext())
- {
- // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
- context.Department.First();
- }
- }
- }
-
- public void InitializeAndSaveChanges_AdventureWorks(int count)
- {
- for (var i = 0; i < count; i++)
- {
- using (var context = AdventureWorksFixture.CreateContext())
- {
- context.Currency.Add(
- new Currency
- {
- CurrencyCode = "TMP",
- Name = "Temporary"
- });
-
- using (context.Database.BeginTransaction())
- {
- context.SaveChanges();
-
- // TODO: Don't mesure transaction rollback
- }
- }
- }
- }
- }
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Models/AdventureWorks/AdventureWorksFixture.cs b/benchmarks/EFCore.Benchmarks.EFCore/Models/AdventureWorks/AdventureWorksFixture.cs
deleted file mode 100644
index 24ad83ba2d4..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore/Models/AdventureWorks/AdventureWorksFixture.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks.TestHelpers;
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.AdventureWorks
-{
- public class AdventureWorksFixture : AdventureWorksFixtureBase
- {
- // This method is called from timed code, be careful when changing it
- public static AdventureWorksContext CreateContext()
- {
- return new AdventureWorksContext(ConnectionString);
- }
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Models/Orders/OrdersContext.cs b/benchmarks/EFCore.Benchmarks.EFCore/Models/Orders/OrdersContext.cs
deleted file mode 100644
index f261ac43e45..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore/Models/Orders/OrdersContext.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders
-{
- public class OrdersContext : DbContext
- {
- private readonly IServiceProvider _serviceProvider;
- private readonly string _connectionString;
- private readonly bool _disableBatching;
-
- public OrdersContext(string connectionString, bool disableBatching = false)
- {
- _connectionString = connectionString;
- _disableBatching = disableBatching;
- }
-
- public OrdersContext(IServiceProvider serviceProvider, string connectionString, bool disableBatching = false)
- {
- _serviceProvider = serviceProvider;
- _connectionString = connectionString;
- _disableBatching = disableBatching;
- }
-
- public DbSet Customers { get; set; }
- public DbSet Orders { get; set; }
- public DbSet OrderLines { get; set; }
- public DbSet Products { get; set; }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder
- .UseInternalServiceProvider(_serviceProvider)
- .UseSqlServer(
- _connectionString,
- b =>
- {
- if (_disableBatching)
- {
- b.MaxBatchSize(1);
- }
- });
- }
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/InitializationTests.cs b/benchmarks/EFCore.Benchmarks.EFCore2/InitializationTests.cs
deleted file mode 100644
index 9b8d615ae87..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore2/InitializationTests.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Linq;
-using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.AdventureWorks;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
-using Microsoft.EntityFrameworkCore.Metadata.Conventions;
-
-// ReSharper disable InconsistentNaming
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2
-{
- public class InitializationTests
- {
-#if NET461
- private ColdStartSandbox _sandbox;
-#endif
- private ColdStartEnabledTests _testClass;
-
-#if NET461
- [Params(true, false)]
-#elif NETCOREAPP2_0
- [Params(false)]
-#endif
- public bool Cold { get; set; }
-
- [GlobalSetup]
- public virtual void Initialize()
- {
- if (Cold)
- {
-#if NET461
- _sandbox = new ColdStartSandbox();
- _testClass = _sandbox.CreateInstance();
-#endif
- }
- else
- {
- _testClass = new ColdStartEnabledTests();
- }
- }
-
-#if NET461
- [GlobalCleanup]
- public virtual void CleanupContext()
- {
- _sandbox?.Dispose();
- }
-#endif
-
- [Benchmark]
- public virtual void CreateAndDisposeUnusedContext()
- {
- _testClass.CreateAndDisposeUnusedContext(Cold ? 1 : 10000);
- }
-
- [Benchmark]
- public virtual void InitializeAndQuery_AdventureWorks()
- {
- _testClass.InitializeAndQuery_AdventureWorks(Cold ? 1 : 1000);
- }
-
- [Benchmark]
- public virtual void InitializeAndSaveChanges_AdventureWorks()
- {
- _testClass.InitializeAndSaveChanges_AdventureWorks(Cold ? 1 : 100);
- }
-
- [Benchmark]
- public virtual void BuildModel_AdventureWorks()
- {
- var builder = new ModelBuilder(SqlServerConventionSetBuilder.Build());
- AdventureWorksContext.ConfigureModel(builder);
-
- // ReSharper disable once UnusedVariable
- var model = builder.Model;
- }
-
- private class ColdStartEnabledTests : MarshalByRefObject
- {
- public void CreateAndDisposeUnusedContext(int count)
- {
- for (var i = 0; i < count; i++)
- {
- // ReSharper disable once UnusedVariable
- using (var context = AdventureWorksFixture.CreateContext())
- {
- }
- }
- }
-
- public void InitializeAndQuery_AdventureWorks(int count)
- {
- for (var i = 0; i < count; i++)
- {
- using (var context = AdventureWorksFixture.CreateContext())
- {
- // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
- context.Department.First();
- }
- }
- }
-
- public void InitializeAndSaveChanges_AdventureWorks(int count)
- {
- for (var i = 0; i < count; i++)
- {
- using (var context = AdventureWorksFixture.CreateContext())
- {
- context.Currency.Add(
- new Currency
- {
- CurrencyCode = "TMP",
- Name = "Temporary"
- });
-
- using (context.Database.BeginTransaction())
- {
- context.SaveChanges();
-
- // TODO: Don't mesure transaction rollback
- }
- }
- }
- }
- }
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Models/AdventureWorks/AdventureWorksFixture.cs b/benchmarks/EFCore.Benchmarks.EFCore2/Models/AdventureWorks/AdventureWorksFixture.cs
deleted file mode 100644
index 3c9cd997153..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Models/AdventureWorks/AdventureWorksFixture.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks.TestHelpers;
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.AdventureWorks
-{
- public class AdventureWorksFixture : AdventureWorksFixtureBase
- {
- // This method is called from timed code, be careful when changing it
- public static AdventureWorksContext CreateContext()
- {
- return new AdventureWorksContext(ConnectionString);
- }
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Models/Orders/OrdersContext.cs b/benchmarks/EFCore.Benchmarks.EFCore2/Models/Orders/OrdersContext.cs
deleted file mode 100644
index 048e7aadb27..00000000000
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Models/Orders/OrdersContext.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders
-{
- public class OrdersContext : DbContext
- {
- private readonly IServiceProvider _serviceProvider;
- private readonly string _connectionString;
- private readonly bool _disableBatching;
-
- public OrdersContext(string connectionString, bool disableBatching = false)
- {
- _connectionString = connectionString;
- _disableBatching = disableBatching;
- }
-
- public OrdersContext(IServiceProvider serviceProvider, string connectionString, bool disableBatching = false)
- {
- _serviceProvider = serviceProvider;
- _connectionString = connectionString;
- _disableBatching = disableBatching;
- }
-
- public DbSet Customers { get; set; }
- public DbSet Orders { get; set; }
- public DbSet OrderLines { get; set; }
- public DbSet Products { get; set; }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder
- .UseInternalServiceProvider(_serviceProvider)
- .UseSqlServer(
- _connectionString,
- b =>
- {
- if (_disableBatching)
- {
- b.MaxBatchSize(1);
- }
- });
- }
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TestHelpers/AdventureWorksFixtureBase.cs b/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TestHelpers/AdventureWorksFixtureBase.cs
deleted file mode 100644
index d19d6c978a5..00000000000
--- a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TestHelpers/AdventureWorksFixtureBase.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks.TestHelpers
-{
- public class AdventureWorksFixtureBase
- {
- public static string ConnectionString { get; } = $"{BenchmarkConfig.Instance.BenchmarkDatabase}Database=AdventureWorks2014;";
- }
-}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/CalibrationTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/CalibrationTests.cs
similarity index 84%
rename from benchmarks/EFCore.Benchmarks.EFCore/CalibrationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/CalibrationTests.cs
index 8ff43b89766..0788efb1ad7 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/CalibrationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/CalibrationTests.cs
@@ -4,8 +4,9 @@
using System.Threading;
using BenchmarkDotNet.Attributes;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore
+namespace Microsoft.EntityFrameworkCore.Benchmarks
{
+ [BenchmarkJob]
public class CalibrationTests
{
[Benchmark]
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/ChangeTracker/DbSetOperationTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/ChangeTracker/DbSetOperationTests.cs
similarity index 78%
rename from benchmarks/EFCore.Benchmarks.EFCore2/ChangeTracker/DbSetOperationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/ChangeTracker/DbSetOperationTests.cs
index eb4ca9ffc01..2b5e15ea35c 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/ChangeTracker/DbSetOperationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/ChangeTracker/DbSetOperationTests.cs
@@ -3,26 +3,34 @@
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.ChangeTracker
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class DbSetOperationTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class DbSetOperationBase
{
- private readonly DbSetOperationFixture _fixture = new DbSetOperationFixture();
+ private OrdersFixtureBase _fixture;
+
protected List _customersWithoutPk;
protected List _customersWithPk;
- protected OrdersContext _context;
+ protected OrdersContextBase _context;
+
+ public abstract OrdersFixtureBase CreateFixture();
[Params(true, false)]
- public bool AutoDetectChanges { get; set; }
+ public virtual bool AutoDetectChanges { get; set; }
[GlobalSetup]
public virtual void CreateCustomers()
{
+ _fixture = CreateFixture();
+ _fixture.Initialize(0, 0, 0, 0);
_customersWithoutPk = _fixture.CreateCustomers(20000, setPrimaryKeys: false);
_customersWithPk = _fixture.CreateCustomers(20000, setPrimaryKeys: true);
}
@@ -41,7 +49,7 @@ public virtual void CleanupContext()
}
}
- public class AddDataVariations : Base
+ public abstract class AddDataVariationsBase : DbSetOperationBase
{
[Benchmark]
public virtual void Add()
@@ -74,7 +82,7 @@ public virtual void AttachRange()
}
}
- public class ExistingDataVariations : Base
+ public abstract class ExistingDataVariationsBase : DbSetOperationBase
{
[IterationSetup]
public override void InitializeContext()
@@ -113,13 +121,5 @@ public virtual void UpdateRange()
_context.Customers.UpdateRange(_customersWithPk);
}
}
-
- public class DbSetOperationFixture : OrdersFixture
- {
- public DbSetOperationFixture()
- : base("Perf_ChangeTracker_DbSetOperation", 0, 0, 0, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/ChangeTracker/FixupTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/ChangeTracker/FixupTests.cs
similarity index 80%
rename from benchmarks/EFCore.Benchmarks.EFCore2/ChangeTracker/FixupTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/ChangeTracker/FixupTests.cs
index d9b59da28ab..6f5cb12f730 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/ChangeTracker/FixupTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/ChangeTracker/FixupTests.cs
@@ -4,30 +4,37 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
+#pragma warning disable CA1034 // Nested types should not be visible
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.ChangeTracker
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class FixupTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class FixupBase
{
- private static readonly FixupFixture _fixture = new FixupFixture();
+ private OrdersFixtureBase _fixture;
+
protected List _customers;
protected List _ordersWithoutPk;
protected List _ordersWithPk;
- protected OrdersContext _context;
+ protected OrdersContextBase _context;
+
+ public abstract OrdersFixtureBase CreateFixture();
[Params(true, false)]
- public bool AutoDetectChanges { get; set; }
+ public virtual bool AutoDetectChanges { get; set; }
[GlobalSetup]
public virtual void CheckData()
{
+ _fixture = CreateFixture();
+ _fixture.Initialize(0, 5000, 2, 0);
+
using (var context = _fixture.CreateContext())
{
Assert.Equal(5000, context.Customers.Count());
@@ -53,7 +60,7 @@ public virtual void CleanupContext()
}
}
- public class ChildVariations : Base
+ public abstract class ChildVariationsBase : FixupBase
{
[IterationSetup]
public override void InitializeContext()
@@ -87,7 +94,7 @@ public virtual void QueryChildren()
}
}
- public class ParentVariations : Base
+ public abstract class ParentVariationsBase : FixupBase
{
[IterationSetup]
public override void InitializeContext()
@@ -120,13 +127,5 @@ public virtual void QueryParents()
_context.Customers.ToList();
}
}
-
- public class FixupFixture : OrdersFixture
- {
- public FixupFixture()
- : base("Perf_ChangeTracker_Fixup", 0, 5000, 2, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/src/EFCore.Benchmarks.Dev/EFCore.Benchmarks.Dev.csproj b/benchmarks/src/EFCore.Benchmarks.Dev/EFCore.Benchmarks.Dev.csproj
new file mode 100644
index 00000000000..034a15f9ed3
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/EFCore.Benchmarks.Dev.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net461;netcoreapp2.0;netcoreapp2.1
+ Microsoft.EntityFrameworkCore.Benchmarks
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Extensions.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Extensions.cs
similarity index 89%
rename from benchmarks/EFCore.Benchmarks.EFCore/Extensions.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Extensions.cs
index f01e47ed6fc..7b84d157970 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Extensions.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Extensions.cs
@@ -3,7 +3,7 @@
using System.Linq;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore
+namespace Microsoft.EntityFrameworkCore.Benchmarks
{
public static class Extensions
{
diff --git a/benchmarks/src/EFCore.Benchmarks.Dev/Initialization/ColdStartEnabledTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Initialization/ColdStartEnabledTests.cs
new file mode 100644
index 00000000000..d9788431252
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Initialization/ColdStartEnabledTests.cs
@@ -0,0 +1,62 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Linq;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+// ReSharper disable InconsistentNaming
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public abstract class ColdStartEnabledTests : MarshalByRefObject
+ {
+ protected abstract AdventureWorksContextBase CreateContext();
+
+ public void CreateAndDisposeUnusedContext(int count)
+ {
+ for (var i = 0; i < count; i++)
+ {
+ // ReSharper disable once UnusedVariable
+ using (var context = CreateContext())
+ {
+ }
+ }
+ }
+
+ public void InitializeAndQuery_AdventureWorks(int count)
+ {
+ for (var i = 0; i < count; i++)
+ {
+ using (var context = CreateContext())
+ {
+ // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
+ context.Department.First();
+ }
+ }
+ }
+
+ public void InitializeAndSaveChanges_AdventureWorks(int count)
+ {
+ for (var i = 0; i < count; i++)
+ {
+ using (var context = CreateContext())
+ {
+ context.Currency.Add(
+ new Currency
+ {
+ CurrencyCode = "TMP",
+ Name = "Temporary"
+ });
+
+ using (context.Database.BeginTransaction())
+ {
+ context.SaveChanges();
+
+ // TODO: Don't mesure transaction rollback
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/benchmarks/src/EFCore.Benchmarks.Dev/Initialization/InitializationTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Initialization/InitializationTests.cs
new file mode 100644
index 00000000000..ccc48919539
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Initialization/InitializationTests.cs
@@ -0,0 +1,79 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using BenchmarkDotNet.Attributes;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public abstract class InitializationTests
+ where T : ColdStartEnabledTests, new()
+ {
+#if NET461
+ private ColdStartSandbox _sandbox;
+#endif
+ private ColdStartEnabledTests _testClass;
+
+#if NET461
+ [Params(true, false)]
+#elif NETCOREAPP2_0 || NETCOREAPP2_1
+ [Params(false)]
+#endif
+ public bool Cold { get; set; }
+
+ [GlobalSetup]
+ public virtual void Initialize()
+ {
+ if (Cold)
+ {
+#if NET461
+ _sandbox = new ColdStartSandbox();
+ _testClass = _sandbox.CreateInstance();
+#endif
+ }
+ else
+ {
+ _testClass = new T();
+ }
+ }
+
+#if NET461
+ [GlobalCleanup]
+ public virtual void CleanupContext()
+ {
+ _sandbox?.Dispose();
+ }
+#endif
+
+ [Benchmark]
+ public virtual void CreateAndDisposeUnusedContext()
+ {
+ _testClass.CreateAndDisposeUnusedContext(Cold ? 1 : 10000);
+ }
+
+ [Benchmark]
+ public virtual void InitializeAndQuery_AdventureWorks()
+ {
+ _testClass.InitializeAndQuery_AdventureWorks(Cold ? 1 : 1000);
+ }
+
+ [Benchmark]
+ public virtual void InitializeAndSaveChanges_AdventureWorks()
+ {
+ _testClass.InitializeAndSaveChanges_AdventureWorks(Cold ? 1 : 100);
+ }
+
+ [Benchmark]
+ public virtual void BuildModel_AdventureWorks()
+ {
+ var builder = new ModelBuilder(CreateConventionSet());
+ AdventureWorksContextBase.ConfigureModel(builder);
+
+ // ReSharper disable once UnusedVariable
+ var model = builder.Model;
+ }
+
+ protected abstract ConventionSet CreateConventionSet();
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Models/AdventureWorks/AdventureWorksContext.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Models/AdventureWorks/AdventureWorksContextBase.cs
similarity index 98%
rename from benchmarks/EFCore.Benchmarks.EFCore/Models/AdventureWorks/AdventureWorksContext.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Models/AdventureWorks/AdventureWorksContextBase.cs
index f988646ddf9..3d41d924048 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Models/AdventureWorks/AdventureWorksContext.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Models/AdventureWorks/AdventureWorksContextBase.cs
@@ -1,27 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.AdventureWorks
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
{
- public class AdventureWorksContext : DbContext
+ public abstract class AdventureWorksContextBase : DbContext
{
- private readonly string _connectionString;
- private readonly IServiceProvider _serviceProvider;
-
- public AdventureWorksContext(string connectionString)
- {
- _connectionString = connectionString;
- }
-
- public AdventureWorksContext(string connectionString, IServiceProvider serviceProvider)
- {
- _connectionString = connectionString;
- _serviceProvider = serviceProvider;
- }
-
public virtual DbSet Address { get; set; }
public virtual DbSet AddressType { get; set; }
public virtual DbSet BillOfMaterials { get; set; }
@@ -90,11 +74,13 @@ public AdventureWorksContext(string connectionString, IServiceProvider servicePr
public virtual DbSet WorkOrder { get; set; }
public virtual DbSet WorkOrderRouting { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder options)
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
- options.UseSqlServer(_connectionString).UseInternalServiceProvider(_serviceProvider);
+ ConfigureProvider(optionsBuilder);
}
+ protected abstract void ConfigureProvider(DbContextOptionsBuilder optionsBuilder);
+
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ConfigureModel(modelBuilder);
diff --git a/benchmarks/src/EFCore.Benchmarks.Dev/Models/Orders/OrdersContextBase.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Models/Orders/OrdersContextBase.cs
new file mode 100644
index 00000000000..6fec6938cb8
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Models/Orders/OrdersContextBase.cs
@@ -0,0 +1,29 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public abstract class OrdersContextBase : DbContext
+ {
+ private readonly IServiceProvider _serviceProvider;
+
+ protected OrdersContextBase(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ }
+
+ public DbSet Customers { get; set; }
+ public DbSet Orders { get; set; }
+ public DbSet OrderLines { get; set; }
+ public DbSet Products { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ ConfigureProvider(optionsBuilder.UseInternalServiceProvider(_serviceProvider));
+ }
+
+ protected abstract void ConfigureProvider(DbContextOptionsBuilder optionsBuilder);
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Models/Orders/OrdersFixture.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Models/Orders/OrdersFixtureBase.cs
similarity index 65%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Models/Orders/OrdersFixture.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Models/Orders/OrdersFixtureBase.cs
index e55f16cab3e..cd2362688cd 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Models/Orders/OrdersFixture.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Models/Orders/OrdersFixtureBase.cs
@@ -1,70 +1,64 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Data.SqlClient;
using System.Linq;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
{
- public class OrdersFixture : OrdersFixtureBase
+ public abstract class OrdersFixtureBase : OrdersFixtureSeedBase
{
- private readonly int _productCount;
- private readonly int _customerCount;
- private readonly int _ordersPerCustomer;
- private readonly int _linesPerOrder;
+ private IServiceProvider _serviceProvider;
+ private int _productCount;
+ private int _customerCount;
+ private int _ordersPerCustomer;
+ private int _linesPerOrder;
- public OrdersFixture(string databaseName, int productCount, int customerCount, int ordersPerCustomer, int linesPerOrder)
+ public void Initialize(int productCount, int customerCount, int ordersPerCustomer, int linesPerOrder, Action seedAction = null)
{
- ConnectionString = $"{BenchmarkConfig.Instance.BenchmarkDatabase}Database={databaseName};";
_productCount = productCount;
_customerCount = customerCount;
_ordersPerCustomer = ordersPerCustomer;
_linesPerOrder = linesPerOrder;
- EnsureDatabaseCreated();
+ EnsureDatabaseCreated(seedAction);
}
- public string ConnectionString { get; }
-
- public virtual OrdersContext CreateContext()
+ public void SetServiceProvider(IServiceProvider serviceProvider)
{
- return new OrdersContext(ConnectionString);
+ _serviceProvider = serviceProvider;
}
- protected virtual void OnDatabaseCreated(OrdersContext context)
- {
- }
+ public abstract OrdersContextBase CreateContext(IServiceProvider serviceProvider = null, bool disableBatching = false);
- private void EnsureDatabaseCreated()
+ private void EnsureDatabaseCreated(Action seedAction)
{
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
var database = context.GetService();
if (!database.Exists())
{
context.Database.EnsureCreated();
InsertSeedData();
- OnDatabaseCreated(context);
+ seedAction?.Invoke(context);
}
else if (!IsDatabaseCorrect(context))
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
InsertSeedData();
- OnDatabaseCreated(context);
+ seedAction?.Invoke(context);
}
Assert.True(IsDatabaseCorrect(context));
}
}
- private bool IsDatabaseCorrect(OrdersContext context)
+ private bool IsDatabaseCorrect(OrdersContextBase context)
{
try
{
@@ -88,21 +82,21 @@ private bool IsDatabaseCorrect(OrdersContext context)
private void InsertSeedData()
{
var products = CreateProducts(_productCount, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.Products.AddRange(products);
context.SaveChanges();
}
var customers = CreateCustomers(_customerCount, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.Customers.AddRange(customers);
context.SaveChanges();
}
var orders = CreateOrders(customers, _ordersPerCustomer, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.Orders.AddRange(orders);
context.SaveChanges();
@@ -110,7 +104,7 @@ private void InsertSeedData()
var lines = CreateOrderLines(products, orders, _linesPerOrder, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.OrderLines.AddRange(lines);
context.SaveChanges();
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Query/FuncletizationTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Query/FuncletizationTests.cs
similarity index 63%
rename from benchmarks/EFCore.Benchmarks.EFCore/Query/FuncletizationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Query/FuncletizationTests.cs
index 9284e53b212..b8c77ec0ab8 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Query/FuncletizationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Query/FuncletizationTests.cs
@@ -3,23 +3,27 @@
using System.Linq;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class FuncletizationTests
+ public abstract class FuncletizationTests
{
- private static readonly FuncletizationFixture _fixture = new FuncletizationFixture();
- private static readonly int _funcletizationIterationCount = 100;
- private OrdersContext _context;
+ private OrdersContextBase _context;
+
+ protected virtual int FuncletizationIterationCount => 100;
+ protected abstract OrdersFixtureBase CreateFixture();
[GlobalSetup]
public virtual void InitializeContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(100, 0, 0, 0);
+
+ _context = fixture.CreateContext();
Assert.Equal(100, _context.Products.Count());
}
@@ -34,7 +38,7 @@ public virtual void CleanupContext()
public virtual void NewQueryInstance()
{
var val = 11;
- for (var i = 0; i < _funcletizationIterationCount; i++)
+ for (var i = 0; i < FuncletizationIterationCount; i++)
{
_context.Products.Where(p => p.ProductId < val).ToList();
}
@@ -46,7 +50,7 @@ public virtual void SameQueryInstance()
var val = 11;
var query = _context.Products.Where(p => p.ProductId < val);
- for (var i = 0; i < _funcletizationIterationCount; i++)
+ for (var i = 0; i < FuncletizationIterationCount; i++)
{
// ReSharper disable once PossibleMultipleEnumeration
query.ToList();
@@ -57,25 +61,17 @@ public virtual void SameQueryInstance()
public virtual void ValueFromObject()
{
var valueHolder = new ValueHolder();
- for (var i = 0; i < _funcletizationIterationCount; i++)
+ for (var i = 0; i < FuncletizationIterationCount; i++)
{
_context.Products.Where(p => p.ProductId < valueHolder.SecondLevelProperty).ToList();
}
}
- public class ValueHolder
+ protected class ValueHolder
{
public int FirstLevelProperty { get; } = 11;
public int SecondLevelProperty => FirstLevelProperty;
}
-
- public class FuncletizationFixture : OrdersFixture
- {
- public FuncletizationFixture()
- : base("Perf_Query_Funcletization", 100, 0, 0, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Query/NavigationsQueryTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Query/NavigationsQueryTests.cs
similarity index 70%
rename from benchmarks/EFCore.Benchmarks.EFCore/Query/NavigationsQueryTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Query/NavigationsQueryTests.cs
index d5febddec10..f33a6ee7ddc 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Query/NavigationsQueryTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Query/NavigationsQueryTests.cs
@@ -4,19 +4,17 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.AdventureWorks;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class NavigationsQueryTests
+ public abstract class NavigationsQueryTests
{
- private AdventureWorksContext _context;
+ private AdventureWorksContextBase _context;
private IQueryable _query;
- private static readonly int _queriesPerIteration = 10;
+
+ protected virtual int QueriesPerIteration => 10;
[Params(true, false)]
public bool Async { get; set; }
@@ -24,10 +22,12 @@ public class NavigationsQueryTests
[Params(true, false)]
public bool Filter { get; set; }
+ protected abstract AdventureWorksContextBase CreateContext();
+
[GlobalSetup]
public virtual void InitializeContext()
{
- _context = AdventureWorksFixture.CreateContext();
+ _context = CreateContext();
_query = Filter
? _context.Store.Where(s => s.SalesPerson.Bonus > 3000)
: _context.Store.Where(s => s.SalesPerson.Bonus >= 0);
@@ -42,9 +42,9 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task PredicateAcrossOptionalNavigation()
+ public virtual async Task PredicateAcrossOptionalNavigation()
{
- for (var i = 0; i < _queriesPerIteration; i++)
+ for (var i = 0; i < QueriesPerIteration; i++)
{
if (Async)
{
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Query/QueryCompilationTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Query/QueryCompilationTests.cs
similarity index 51%
rename from benchmarks/EFCore.Benchmarks.EFCore/Query/QueryCompilationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Query/QueryCompilationTests.cs
index c2fe3343c26..adb0509e279 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Query/QueryCompilationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Query/QueryCompilationTests.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
@@ -13,21 +12,29 @@
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
// ReSharper disable InconsistentNaming
-// ReSharper disable UnassignedGetOnlyAutoProperty
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class QueryCompilationTests
+ public abstract class QueryCompilationTests
{
- private static readonly QueryCompilationFixture _fixture = new QueryCompilationFixture();
- private OrdersContext _context;
+ private OrdersContextBase _context;
private IQueryable _simpleQuery;
private IQueryable _complexQuery;
+ public abstract OrdersFixtureBase CreateFixture();
+ public abstract IServiceCollection AddProviderServices(IServiceCollection services);
+
[GlobalSetup]
public virtual void InitializeContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(0, 0, 0, 0);
+
+ var noQueryCacheServiceProvider = AddProviderServices(new ServiceCollection())
+ .AddSingleton()
+ .BuildServiceProvider();
+
+ _context = fixture.CreateContext(noQueryCacheServiceProvider);
_simpleQuery = _context.Products
.AsNoTracking();
_complexQuery = _context.Products
@@ -71,7 +78,7 @@ public virtual void FilterOrderProject()
}
}
- public class DTO
+ private class DTO
{
public int ProductId { get; set; }
public string Name { get; set; }
@@ -82,62 +89,42 @@ public class DTO
public int Surplus { get; set; }
}
- public class QueryCompilationFixture : OrdersFixture
+ private class NonCachingMemoryCache : IMemoryCache
{
- private readonly IServiceProvider _noQueryCacheServiceProvider;
-
- public QueryCompilationFixture()
- : base("Perf_Query_Compilation", 0, 0, 0, 0)
+ public bool TryGetValue(object key, out object value)
{
- _noQueryCacheServiceProvider = new ServiceCollection()
- .AddEntityFrameworkSqlServer()
- .AddSingleton()
- .BuildServiceProvider();
+ value = null;
+ return false;
}
- public override OrdersContext CreateContext()
+ public ICacheEntry CreateEntry(object key)
{
- return new OrdersContext(_noQueryCacheServiceProvider, ConnectionString);
+ return new FakeEntry();
}
- // ReSharper disable once ClassNeverInstantiated.Local
- private class NonCachingMemoryCache : IMemoryCache
+ private class FakeEntry : ICacheEntry
{
- public bool TryGetValue(object key, out object value)
- {
- value = null;
- return false;
- }
-
- public ICacheEntry CreateEntry(object key)
+ public virtual void Dispose()
{
- return new FakeEntry();
}
- private class FakeEntry : ICacheEntry
- {
- public virtual void Dispose()
- {
- }
-
- public object Key { get; }
- public object Value { get; set; }
- public DateTimeOffset? AbsoluteExpiration { get; set; }
- public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
- public TimeSpan? SlidingExpiration { get; set; }
- public IList ExpirationTokens { get; }
- public IList PostEvictionCallbacks { get; }
- public CacheItemPriority Priority { get; set; }
- public long? Size { get; set; }
- }
+ public object Key { get; }
+ public object Value { get; set; }
+ public DateTimeOffset? AbsoluteExpiration { get; set; }
+ public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
+ public TimeSpan? SlidingExpiration { get; set; }
+ public IList ExpirationTokens { get; }
+ public IList PostEvictionCallbacks { get; }
+ public CacheItemPriority Priority { get; set; }
+ public long? Size { get; set; }
+ }
- public virtual void Remove(object key)
- {
- }
+ public virtual void Remove(object key)
+ {
+ }
- public virtual void Dispose()
- {
- }
+ public virtual void Dispose()
+ {
}
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Query/RawSqlQueryTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Query/RawSqlQueryTests.cs
similarity index 58%
rename from benchmarks/EFCore.Benchmarks.EFCore/Query/RawSqlQueryTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Query/RawSqlQueryTests.cs
index 67c75a1de07..56144a5af80 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Query/RawSqlQueryTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Query/RawSqlQueryTests.cs
@@ -4,29 +4,42 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
// ReSharper disable FormatStringProblem
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class RawSqlQueryTests
+ public abstract class RawSqlQueryTests
{
- private static readonly RawSqlQueryFixture _fixture = new RawSqlQueryFixture();
- private OrdersContext _context;
+ private OrdersContextBase _context;
+
+ protected abstract OrdersFixtureBase CreateFixture();
+ protected abstract string StoredProcedureCreationScript { get; }
[Params(true, false)]
- public bool Async;
+ public virtual bool Async { get; set; }
[Params(true, false)]
- public bool Tracking;
+ public virtual bool Tracking { get; set; }
[GlobalSetup]
public virtual void CreateContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(
+ 1000, 1000, 2, 2,
+ ctx =>
+ {
+ if (!string.IsNullOrEmpty(StoredProcedureCreationScript))
+ {
+ ctx.Database.ExecuteSqlCommand(StoredProcedureCreationScript);
+ }
+ });
+
+ _context = fixture.CreateContext();
Assert.Equal(1000, _context.Products.Count());
Assert.Equal(1000, _context.Customers.Count());
@@ -41,10 +54,10 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task SelectAll()
+ public virtual async Task SelectAll()
{
var query = _context.Products
- .FromSql("SELECT * FROM dbo.Products")
+ .FromSql(@"SELECT * FROM ""Products""")
.ApplyTracking(Tracking);
if (Async)
@@ -58,10 +71,10 @@ public async Task SelectAll()
}
[Benchmark]
- public async Task SelectParameterized()
+ public virtual async Task SelectParameterized()
{
var query = _context.Products
- .FromSql("SELECT * FROM dbo.Products WHERE CurrentPrice >= @p0 AND CurrentPrice <= @p1", 10, 14)
+ .FromSql(@"SELECT * FROM ""Products"" WHERE ""CurrentPrice"" >= @p0 AND ""CurrentPrice"" <= @p1", 10, 14)
.ApplyTracking(Tracking);
if (Async)
@@ -75,10 +88,10 @@ public async Task SelectParameterized()
}
[Benchmark]
- public async Task SelectComposed()
+ public virtual async Task SelectComposed()
{
var query = _context.Products
- .FromSql("SELECT * FROM dbo.Products")
+ .FromSql(@"SELECT * FROM ""Products""")
.ApplyTracking(Tracking)
.Where(p => p.CurrentPrice >= 10 && p.CurrentPrice <= 14)
.OrderBy(p => p.Name);
@@ -94,10 +107,10 @@ public async Task SelectComposed()
}
[Benchmark]
- public async Task StoredProcedure()
+ public virtual async Task StoredProcedure()
{
var query = _context.Products
- .FromSql("EXECUTE dbo.SearchProducts @p0, @p1", 10, 14)
+ .FromSql(@"EXECUTE dbo.SearchProducts @p0, @p1", 10, 14)
.ApplyTracking(Tracking);
if (Async)
@@ -109,25 +122,5 @@ public async Task StoredProcedure()
query.ToList();
}
}
-
- public class RawSqlQueryFixture : OrdersFixture
- {
- public RawSqlQueryFixture()
- : base("Perf_Query_RawSql", 1000, 1000, 2, 2)
- {
- }
-
- protected override void OnDatabaseCreated(OrdersContext context)
- {
- context.Database.ExecuteSqlCommand(
- @"CREATE PROCEDURE dbo.SearchProducts
- @minPrice decimal(18, 2),
- @maxPrice decimal(18, 2)
- AS
- BEGIN
- SELECT * FROM dbo.Products WHERE CurrentPrice >= @minPrice AND CurrentPrice <= @maxPrice
- END");
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Query/SimpleQueryTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/Query/SimpleQueryTests.cs
similarity index 82%
rename from benchmarks/EFCore.Benchmarks.EFCore/Query/SimpleQueryTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/Query/SimpleQueryTests.cs
index 914756507a4..9e32dc9e673 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Query/SimpleQueryTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/Query/SimpleQueryTests.cs
@@ -4,28 +4,32 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class SimpleQueryTests
+ public abstract class SimpleQueryTests
{
- private static readonly SimpleQueryFixture _fixture = new SimpleQueryFixture();
- private OrdersContext _context;
+ private OrdersContextBase _context;
+
+ protected abstract OrdersFixtureBase CreateFixture();
[Params(true, false)]
- public bool Async;
+ public virtual bool Async { get; set; }
[Params(true, false)]
- public bool Tracking;
+ public virtual bool Tracking { get; set; }
[GlobalSetup]
public virtual void CreateContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(1000, 1000, 2, 2);
+
+ _context = fixture.CreateContext();
Assert.Equal(1000, _context.Products.Count());
Assert.Equal(1000, _context.Customers.Count());
@@ -39,7 +43,7 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task LoadAll()
+ public virtual async Task LoadAll()
{
var query = _context.Products
.ApplyTracking(Tracking);
@@ -55,7 +59,7 @@ public async Task LoadAll()
}
[Benchmark]
- public async Task Where()
+ public virtual async Task Where()
{
var query = _context.Products
.ApplyTracking(Tracking)
@@ -72,7 +76,7 @@ public async Task Where()
}
[Benchmark]
- public async Task OrderBy()
+ public virtual async Task OrderBy()
{
var query = _context.Products
.ApplyTracking(Tracking)
@@ -89,7 +93,7 @@ public async Task OrderBy()
}
[Benchmark]
- public async Task Count()
+ public virtual async Task Count()
{
var query = _context.Products;
@@ -104,7 +108,7 @@ public async Task Count()
}
[Benchmark]
- public async Task SkipTake()
+ public virtual async Task SkipTake()
{
var query = _context.Products
.ApplyTracking(Tracking)
@@ -123,7 +127,7 @@ public async Task SkipTake()
}
[Benchmark]
- public async Task GroupBy()
+ public virtual async Task GroupBy()
{
var query = _context.Products
.GroupBy(p => p.Retail)
@@ -145,7 +149,7 @@ public async Task GroupBy()
}
[Benchmark]
- public async Task Include()
+ public virtual async Task Include()
{
var query = _context.Customers
.ApplyTracking(Tracking)
@@ -162,7 +166,7 @@ public async Task Include()
}
[Benchmark]
- public async Task Projection()
+ public virtual async Task Projection()
{
var query = _context.Products
.Select(
@@ -188,7 +192,7 @@ public async Task Projection()
}
[Benchmark]
- public async Task ProjectionAcrossNavigation()
+ public virtual async Task ProjectionAcrossNavigation()
{
var query = _context.Orders
.Select(
@@ -213,13 +217,5 @@ public async Task ProjectionAcrossNavigation()
query.ToList();
}
}
-
- public class SimpleQueryFixture : OrdersFixture
- {
- public SimpleQueryFixture()
- : base("Perf_Query_Simple", 1000, 1000, 2, 2)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/UpdatePipeline/SimpleUpdatePipelineTests.cs b/benchmarks/src/EFCore.Benchmarks.Dev/UpdatePipeline/SimpleUpdatePipelineTests.cs
similarity index 69%
rename from benchmarks/EFCore.Benchmarks.EFCore2/UpdatePipeline/SimpleUpdatePipelineTests.cs
rename to benchmarks/src/EFCore.Benchmarks.Dev/UpdatePipeline/SimpleUpdatePipelineTests.cs
index 4984e4e2e9f..ce7432adca7 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/UpdatePipeline/SimpleUpdatePipelineTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.Dev/UpdatePipeline/SimpleUpdatePipelineTests.cs
@@ -4,31 +4,44 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Microsoft.EntityFrameworkCore.Storage;
using Xunit;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.UpdatePipeline
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class SimpleUpdatePipelineTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class UpdatePipelineBase
{
- protected static readonly SimpleUpdatePipelineFixture _fixture = new SimpleUpdatePipelineFixture();
- protected OrdersContext _context;
+ protected OrdersFixtureBase _fixture;
+ protected OrdersContextBase _context;
private IDbContextTransaction _transaction;
private int _recordsAffected = -1;
+ public abstract OrdersFixtureBase CreateFixture();
+
[Params(true, false)]
- public bool Async;
+ public virtual bool Async { get; set; }
[Params(true, false)]
- public bool Batching;
+ public virtual bool Batching { get; set; }
+
+ [GlobalSetup]
+ public virtual void InitializeFixture()
+ {
+ _fixture = CreateFixture();
+ _fixture.Initialize(0, 1000, 0, 0);
+ }
[IterationSetup]
public virtual void InitializeContext()
{
- _context = _fixture.CreateContext(Batching);
+ _context = _fixture.CreateContext(disableBatching: Batching);
_transaction = _context.Database.BeginTransaction();
}
@@ -45,7 +58,7 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task UpdatePipeline()
+ public virtual async Task UpdatePipeline()
{
_recordsAffected = Async
? await _context.SaveChangesAsync()
@@ -53,7 +66,7 @@ public async Task UpdatePipeline()
}
}
- public class Insert : Base
+ public abstract class InsertBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -65,7 +78,7 @@ public override void InitializeContext()
}
}
- public class Update : Base
+ public abstract class UpdateBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -79,7 +92,7 @@ public override void InitializeContext()
}
}
- public class Delete : Base
+ public abstract class DeleteBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -90,7 +103,7 @@ public override void InitializeContext()
}
}
- public class Mixed : Base
+ public abstract class MixedBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -112,18 +125,5 @@ public override void InitializeContext()
}
}
}
-
- public class SimpleUpdatePipelineFixture : OrdersFixture
- {
- public SimpleUpdatePipelineFixture()
- : base("Perf_UpdatePipeline_Simple", 0, 1000, 0, 0)
- {
- }
-
- public OrdersContext CreateContext(bool batching)
- {
- return new OrdersContext(ConnectionString, disableBatching: !batching);
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/CalibrationTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/CalibrationTests.cs
similarity index 84%
rename from benchmarks/EFCore.Benchmarks.EFCore2/CalibrationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/CalibrationTests.cs
index 9a459256135..0788efb1ad7 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/CalibrationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/CalibrationTests.cs
@@ -4,8 +4,9 @@
using System.Threading;
using BenchmarkDotNet.Attributes;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2
+namespace Microsoft.EntityFrameworkCore.Benchmarks
{
+ [BenchmarkJob]
public class CalibrationTests
{
[Benchmark]
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/ChangeTracker/DbSetOperationTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/ChangeTracker/DbSetOperationTests.cs
similarity index 78%
rename from benchmarks/EFCore.Benchmarks.EFCore/ChangeTracker/DbSetOperationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/ChangeTracker/DbSetOperationTests.cs
index 8122921d1d1..2b5e15ea35c 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/ChangeTracker/DbSetOperationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/ChangeTracker/DbSetOperationTests.cs
@@ -3,26 +3,34 @@
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.ChangeTracker
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class DbSetOperationTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class DbSetOperationBase
{
- private readonly DbSetOperationFixture _fixture = new DbSetOperationFixture();
+ private OrdersFixtureBase _fixture;
+
protected List _customersWithoutPk;
protected List _customersWithPk;
- protected OrdersContext _context;
+ protected OrdersContextBase _context;
+
+ public abstract OrdersFixtureBase CreateFixture();
[Params(true, false)]
- public bool AutoDetectChanges { get; set; }
+ public virtual bool AutoDetectChanges { get; set; }
[GlobalSetup]
public virtual void CreateCustomers()
{
+ _fixture = CreateFixture();
+ _fixture.Initialize(0, 0, 0, 0);
_customersWithoutPk = _fixture.CreateCustomers(20000, setPrimaryKeys: false);
_customersWithPk = _fixture.CreateCustomers(20000, setPrimaryKeys: true);
}
@@ -41,7 +49,7 @@ public virtual void CleanupContext()
}
}
- public class AddDataVariations : Base
+ public abstract class AddDataVariationsBase : DbSetOperationBase
{
[Benchmark]
public virtual void Add()
@@ -74,7 +82,7 @@ public virtual void AttachRange()
}
}
- public class ExistingDataVariations : Base
+ public abstract class ExistingDataVariationsBase : DbSetOperationBase
{
[IterationSetup]
public override void InitializeContext()
@@ -113,13 +121,5 @@ public virtual void UpdateRange()
_context.Customers.UpdateRange(_customersWithPk);
}
}
-
- public class DbSetOperationFixture : OrdersFixture
- {
- public DbSetOperationFixture()
- : base("Perf_ChangeTracker_DbSetOperation", 0, 0, 0, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/ChangeTracker/FixupTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/ChangeTracker/FixupTests.cs
similarity index 80%
rename from benchmarks/EFCore.Benchmarks.EFCore/ChangeTracker/FixupTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/ChangeTracker/FixupTests.cs
index 0bc512a20f1..6f5cb12f730 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/ChangeTracker/FixupTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/ChangeTracker/FixupTests.cs
@@ -4,30 +4,37 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
+#pragma warning disable CA1034 // Nested types should not be visible
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.ChangeTracker
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class FixupTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class FixupBase
{
- private static readonly FixupFixture _fixture = new FixupFixture();
+ private OrdersFixtureBase _fixture;
+
protected List _customers;
protected List _ordersWithoutPk;
protected List _ordersWithPk;
- protected OrdersContext _context;
+ protected OrdersContextBase _context;
+
+ public abstract OrdersFixtureBase CreateFixture();
[Params(true, false)]
- public bool AutoDetectChanges { get; set; }
+ public virtual bool AutoDetectChanges { get; set; }
[GlobalSetup]
public virtual void CheckData()
{
+ _fixture = CreateFixture();
+ _fixture.Initialize(0, 5000, 2, 0);
+
using (var context = _fixture.CreateContext())
{
Assert.Equal(5000, context.Customers.Count());
@@ -53,7 +60,7 @@ public virtual void CleanupContext()
}
}
- public class ChildVariations : Base
+ public abstract class ChildVariationsBase : FixupBase
{
[IterationSetup]
public override void InitializeContext()
@@ -87,7 +94,7 @@ public virtual void QueryChildren()
}
}
- public class ParentVariations : Base
+ public abstract class ParentVariationsBase : FixupBase
{
[IterationSetup]
public override void InitializeContext()
@@ -120,13 +127,5 @@ public virtual void QueryParents()
_context.Customers.ToList();
}
}
-
- public class FixupFixture : OrdersFixture
- {
- public FixupFixture()
- : base("Perf_ChangeTracker_Fixup", 0, 5000, 2, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/src/EFCore.Benchmarks.V2/EFCore.Benchmarks.V2.csproj b/benchmarks/src/EFCore.Benchmarks.V2/EFCore.Benchmarks.V2.csproj
new file mode 100644
index 00000000000..bec514c93f3
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.V2/EFCore.Benchmarks.V2.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net461;netcoreapp2.0
+ Microsoft.EntityFrameworkCore.Benchmarks
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Extensions.cs b/benchmarks/src/EFCore.Benchmarks.V2/Extensions.cs
similarity index 89%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Extensions.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Extensions.cs
index 44099177535..7b84d157970 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Extensions.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Extensions.cs
@@ -3,7 +3,7 @@
using System.Linq;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2
+namespace Microsoft.EntityFrameworkCore.Benchmarks
{
public static class Extensions
{
diff --git a/benchmarks/src/EFCore.Benchmarks.V2/Initialization/ColdStartEnabledTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Initialization/ColdStartEnabledTests.cs
new file mode 100644
index 00000000000..d9788431252
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Initialization/ColdStartEnabledTests.cs
@@ -0,0 +1,62 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Linq;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+// ReSharper disable InconsistentNaming
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public abstract class ColdStartEnabledTests : MarshalByRefObject
+ {
+ protected abstract AdventureWorksContextBase CreateContext();
+
+ public void CreateAndDisposeUnusedContext(int count)
+ {
+ for (var i = 0; i < count; i++)
+ {
+ // ReSharper disable once UnusedVariable
+ using (var context = CreateContext())
+ {
+ }
+ }
+ }
+
+ public void InitializeAndQuery_AdventureWorks(int count)
+ {
+ for (var i = 0; i < count; i++)
+ {
+ using (var context = CreateContext())
+ {
+ // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
+ context.Department.First();
+ }
+ }
+ }
+
+ public void InitializeAndSaveChanges_AdventureWorks(int count)
+ {
+ for (var i = 0; i < count; i++)
+ {
+ using (var context = CreateContext())
+ {
+ context.Currency.Add(
+ new Currency
+ {
+ CurrencyCode = "TMP",
+ Name = "Temporary"
+ });
+
+ using (context.Database.BeginTransaction())
+ {
+ context.SaveChanges();
+
+ // TODO: Don't mesure transaction rollback
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/benchmarks/src/EFCore.Benchmarks.V2/Initialization/InitializationTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Initialization/InitializationTests.cs
new file mode 100644
index 00000000000..ccc48919539
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Initialization/InitializationTests.cs
@@ -0,0 +1,79 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using BenchmarkDotNet.Attributes;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public abstract class InitializationTests
+ where T : ColdStartEnabledTests, new()
+ {
+#if NET461
+ private ColdStartSandbox _sandbox;
+#endif
+ private ColdStartEnabledTests _testClass;
+
+#if NET461
+ [Params(true, false)]
+#elif NETCOREAPP2_0 || NETCOREAPP2_1
+ [Params(false)]
+#endif
+ public bool Cold { get; set; }
+
+ [GlobalSetup]
+ public virtual void Initialize()
+ {
+ if (Cold)
+ {
+#if NET461
+ _sandbox = new ColdStartSandbox();
+ _testClass = _sandbox.CreateInstance();
+#endif
+ }
+ else
+ {
+ _testClass = new T();
+ }
+ }
+
+#if NET461
+ [GlobalCleanup]
+ public virtual void CleanupContext()
+ {
+ _sandbox?.Dispose();
+ }
+#endif
+
+ [Benchmark]
+ public virtual void CreateAndDisposeUnusedContext()
+ {
+ _testClass.CreateAndDisposeUnusedContext(Cold ? 1 : 10000);
+ }
+
+ [Benchmark]
+ public virtual void InitializeAndQuery_AdventureWorks()
+ {
+ _testClass.InitializeAndQuery_AdventureWorks(Cold ? 1 : 1000);
+ }
+
+ [Benchmark]
+ public virtual void InitializeAndSaveChanges_AdventureWorks()
+ {
+ _testClass.InitializeAndSaveChanges_AdventureWorks(Cold ? 1 : 100);
+ }
+
+ [Benchmark]
+ public virtual void BuildModel_AdventureWorks()
+ {
+ var builder = new ModelBuilder(CreateConventionSet());
+ AdventureWorksContextBase.ConfigureModel(builder);
+
+ // ReSharper disable once UnusedVariable
+ var model = builder.Model;
+ }
+
+ protected abstract ConventionSet CreateConventionSet();
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Models/AdventureWorks/AdventureWorksContext.cs b/benchmarks/src/EFCore.Benchmarks.V2/Models/AdventureWorks/AdventureWorksContextBase.cs
similarity index 98%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Models/AdventureWorks/AdventureWorksContext.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Models/AdventureWorks/AdventureWorksContextBase.cs
index 3bc59b3143a..3d41d924048 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Models/AdventureWorks/AdventureWorksContext.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Models/AdventureWorks/AdventureWorksContextBase.cs
@@ -1,27 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.AdventureWorks
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
{
- public class AdventureWorksContext : DbContext
+ public abstract class AdventureWorksContextBase : DbContext
{
- private readonly string _connectionString;
- private readonly IServiceProvider _serviceProvider;
-
- public AdventureWorksContext(string connectionString)
- {
- _connectionString = connectionString;
- }
-
- public AdventureWorksContext(string connectionString, IServiceProvider serviceProvider)
- {
- _connectionString = connectionString;
- _serviceProvider = serviceProvider;
- }
-
public virtual DbSet Address { get; set; }
public virtual DbSet AddressType { get; set; }
public virtual DbSet BillOfMaterials { get; set; }
@@ -90,11 +74,13 @@ public AdventureWorksContext(string connectionString, IServiceProvider servicePr
public virtual DbSet WorkOrder { get; set; }
public virtual DbSet WorkOrderRouting { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder options)
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
- options.UseSqlServer(_connectionString).UseInternalServiceProvider(_serviceProvider);
+ ConfigureProvider(optionsBuilder);
}
+ protected abstract void ConfigureProvider(DbContextOptionsBuilder optionsBuilder);
+
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ConfigureModel(modelBuilder);
diff --git a/benchmarks/src/EFCore.Benchmarks.V2/Models/Orders/OrdersContextBase.cs b/benchmarks/src/EFCore.Benchmarks.V2/Models/Orders/OrdersContextBase.cs
new file mode 100644
index 00000000000..6fec6938cb8
--- /dev/null
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Models/Orders/OrdersContextBase.cs
@@ -0,0 +1,29 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public abstract class OrdersContextBase : DbContext
+ {
+ private readonly IServiceProvider _serviceProvider;
+
+ protected OrdersContextBase(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ }
+
+ public DbSet Customers { get; set; }
+ public DbSet Orders { get; set; }
+ public DbSet OrderLines { get; set; }
+ public DbSet Products { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ ConfigureProvider(optionsBuilder.UseInternalServiceProvider(_serviceProvider));
+ }
+
+ protected abstract void ConfigureProvider(DbContextOptionsBuilder optionsBuilder);
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Models/Orders/OrdersFixture.cs b/benchmarks/src/EFCore.Benchmarks.V2/Models/Orders/OrdersFixtureBase.cs
similarity index 65%
rename from benchmarks/EFCore.Benchmarks.EFCore/Models/Orders/OrdersFixture.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Models/Orders/OrdersFixtureBase.cs
index 114e3eb3541..cd2362688cd 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Models/Orders/OrdersFixture.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Models/Orders/OrdersFixtureBase.cs
@@ -1,70 +1,64 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Data.SqlClient;
using System.Linq;
-using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
{
- public class OrdersFixture : OrdersFixtureBase
+ public abstract class OrdersFixtureBase : OrdersFixtureSeedBase
{
- private readonly int _productCount;
- private readonly int _customerCount;
- private readonly int _ordersPerCustomer;
- private readonly int _linesPerOrder;
+ private IServiceProvider _serviceProvider;
+ private int _productCount;
+ private int _customerCount;
+ private int _ordersPerCustomer;
+ private int _linesPerOrder;
- public OrdersFixture(string databaseName, int productCount, int customerCount, int ordersPerCustomer, int linesPerOrder)
+ public void Initialize(int productCount, int customerCount, int ordersPerCustomer, int linesPerOrder, Action seedAction = null)
{
- ConnectionString = $@"{BenchmarkConfig.Instance.BenchmarkDatabase}Database={databaseName};";
_productCount = productCount;
_customerCount = customerCount;
_ordersPerCustomer = ordersPerCustomer;
_linesPerOrder = linesPerOrder;
- EnsureDatabaseCreated();
+ EnsureDatabaseCreated(seedAction);
}
- public string ConnectionString { get; }
-
- public virtual OrdersContext CreateContext()
+ public void SetServiceProvider(IServiceProvider serviceProvider)
{
- return new OrdersContext(ConnectionString);
+ _serviceProvider = serviceProvider;
}
- protected virtual void OnDatabaseCreated(OrdersContext context)
- {
- }
+ public abstract OrdersContextBase CreateContext(IServiceProvider serviceProvider = null, bool disableBatching = false);
- private void EnsureDatabaseCreated()
+ private void EnsureDatabaseCreated(Action seedAction)
{
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
var database = context.GetService();
if (!database.Exists())
{
context.Database.EnsureCreated();
InsertSeedData();
- OnDatabaseCreated(context);
+ seedAction?.Invoke(context);
}
else if (!IsDatabaseCorrect(context))
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
InsertSeedData();
- OnDatabaseCreated(context);
+ seedAction?.Invoke(context);
}
Assert.True(IsDatabaseCorrect(context));
}
}
- private bool IsDatabaseCorrect(OrdersContext context)
+ private bool IsDatabaseCorrect(OrdersContextBase context)
{
try
{
@@ -88,21 +82,21 @@ private bool IsDatabaseCorrect(OrdersContext context)
private void InsertSeedData()
{
var products = CreateProducts(_productCount, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.Products.AddRange(products);
context.SaveChanges();
}
var customers = CreateCustomers(_customerCount, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.Customers.AddRange(customers);
context.SaveChanges();
}
var orders = CreateOrders(customers, _ordersPerCustomer, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.Orders.AddRange(orders);
context.SaveChanges();
@@ -110,7 +104,7 @@ private void InsertSeedData()
var lines = CreateOrderLines(products, orders, _linesPerOrder, setPrimaryKeys: false);
- using (var context = new OrdersContext(ConnectionString))
+ using (var context = CreateContext())
{
context.OrderLines.AddRange(lines);
context.SaveChanges();
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Query/FuncletizationTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Query/FuncletizationTests.cs
similarity index 63%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Query/FuncletizationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Query/FuncletizationTests.cs
index 83236f215b9..b8c77ec0ab8 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Query/FuncletizationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Query/FuncletizationTests.cs
@@ -3,23 +3,27 @@
using System.Linq;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class FuncletizationTests
+ public abstract class FuncletizationTests
{
- private static readonly FuncletizationFixture _fixture = new FuncletizationFixture();
- private static readonly int _funcletizationIterationCount = 100;
- private OrdersContext _context;
+ private OrdersContextBase _context;
+
+ protected virtual int FuncletizationIterationCount => 100;
+ protected abstract OrdersFixtureBase CreateFixture();
[GlobalSetup]
public virtual void InitializeContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(100, 0, 0, 0);
+
+ _context = fixture.CreateContext();
Assert.Equal(100, _context.Products.Count());
}
@@ -34,7 +38,7 @@ public virtual void CleanupContext()
public virtual void NewQueryInstance()
{
var val = 11;
- for (var i = 0; i < _funcletizationIterationCount; i++)
+ for (var i = 0; i < FuncletizationIterationCount; i++)
{
_context.Products.Where(p => p.ProductId < val).ToList();
}
@@ -46,7 +50,7 @@ public virtual void SameQueryInstance()
var val = 11;
var query = _context.Products.Where(p => p.ProductId < val);
- for (var i = 0; i < _funcletizationIterationCount; i++)
+ for (var i = 0; i < FuncletizationIterationCount; i++)
{
// ReSharper disable once PossibleMultipleEnumeration
query.ToList();
@@ -57,25 +61,17 @@ public virtual void SameQueryInstance()
public virtual void ValueFromObject()
{
var valueHolder = new ValueHolder();
- for (var i = 0; i < _funcletizationIterationCount; i++)
+ for (var i = 0; i < FuncletizationIterationCount; i++)
{
_context.Products.Where(p => p.ProductId < valueHolder.SecondLevelProperty).ToList();
}
}
- public class ValueHolder
+ protected class ValueHolder
{
public int FirstLevelProperty { get; } = 11;
public int SecondLevelProperty => FirstLevelProperty;
}
-
- public class FuncletizationFixture : OrdersFixture
- {
- public FuncletizationFixture()
- : base("Perf_Query_Funcletization", 100, 0, 0, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Query/NavigationsQueryTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Query/NavigationsQueryTests.cs
similarity index 70%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Query/NavigationsQueryTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Query/NavigationsQueryTests.cs
index 80c7e3c918c..f33a6ee7ddc 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Query/NavigationsQueryTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Query/NavigationsQueryTests.cs
@@ -4,19 +4,17 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.AdventureWorks;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class NavigationsQueryTests
+ public abstract class NavigationsQueryTests
{
- private AdventureWorksContext _context;
+ private AdventureWorksContextBase _context;
private IQueryable _query;
- private static readonly int _queriesPerIteration = 10;
+
+ protected virtual int QueriesPerIteration => 10;
[Params(true, false)]
public bool Async { get; set; }
@@ -24,10 +22,12 @@ public class NavigationsQueryTests
[Params(true, false)]
public bool Filter { get; set; }
+ protected abstract AdventureWorksContextBase CreateContext();
+
[GlobalSetup]
public virtual void InitializeContext()
{
- _context = AdventureWorksFixture.CreateContext();
+ _context = CreateContext();
_query = Filter
? _context.Store.Where(s => s.SalesPerson.Bonus > 3000)
: _context.Store.Where(s => s.SalesPerson.Bonus >= 0);
@@ -42,9 +42,9 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task PredicateAcrossOptionalNavigation()
+ public virtual async Task PredicateAcrossOptionalNavigation()
{
- for (var i = 0; i < _queriesPerIteration; i++)
+ for (var i = 0; i < QueriesPerIteration; i++)
{
if (Async)
{
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Query/QueryCompilationTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Query/QueryCompilationTests.cs
similarity index 51%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Query/QueryCompilationTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Query/QueryCompilationTests.cs
index 443ce60059a..adb0509e279 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Query/QueryCompilationTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Query/QueryCompilationTests.cs
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
@@ -13,21 +12,29 @@
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
// ReSharper disable InconsistentNaming
-// ReSharper disable UnassignedGetOnlyAutoProperty
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class QueryCompilationTests
+ public abstract class QueryCompilationTests
{
- private static readonly QueryCompilationFixture _fixture = new QueryCompilationFixture();
- private OrdersContext _context;
+ private OrdersContextBase _context;
private IQueryable _simpleQuery;
private IQueryable _complexQuery;
+ public abstract OrdersFixtureBase CreateFixture();
+ public abstract IServiceCollection AddProviderServices(IServiceCollection services);
+
[GlobalSetup]
public virtual void InitializeContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(0, 0, 0, 0);
+
+ var noQueryCacheServiceProvider = AddProviderServices(new ServiceCollection())
+ .AddSingleton()
+ .BuildServiceProvider();
+
+ _context = fixture.CreateContext(noQueryCacheServiceProvider);
_simpleQuery = _context.Products
.AsNoTracking();
_complexQuery = _context.Products
@@ -71,7 +78,7 @@ public virtual void FilterOrderProject()
}
}
- public class DTO
+ private class DTO
{
public int ProductId { get; set; }
public string Name { get; set; }
@@ -82,62 +89,42 @@ public class DTO
public int Surplus { get; set; }
}
- public class QueryCompilationFixture : OrdersFixture
+ private class NonCachingMemoryCache : IMemoryCache
{
- private readonly IServiceProvider _noQueryCacheServiceProvider;
-
- public QueryCompilationFixture()
- : base("Perf_Query_Compilation", 0, 0, 0, 0)
+ public bool TryGetValue(object key, out object value)
{
- _noQueryCacheServiceProvider = new ServiceCollection()
- .AddEntityFrameworkSqlServer()
- .AddSingleton()
- .BuildServiceProvider();
+ value = null;
+ return false;
}
- public override OrdersContext CreateContext()
+ public ICacheEntry CreateEntry(object key)
{
- return new OrdersContext(_noQueryCacheServiceProvider, ConnectionString);
+ return new FakeEntry();
}
- // ReSharper disable once ClassNeverInstantiated.Local
- private class NonCachingMemoryCache : IMemoryCache
+ private class FakeEntry : ICacheEntry
{
- public bool TryGetValue(object key, out object value)
- {
- value = null;
- return false;
- }
-
- public ICacheEntry CreateEntry(object key)
+ public virtual void Dispose()
{
- return new FakeEntry();
}
- private class FakeEntry : ICacheEntry
- {
- public virtual void Dispose()
- {
- }
-
- public object Key { get; }
- public object Value { get; set; }
- public DateTimeOffset? AbsoluteExpiration { get; set; }
- public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
- public TimeSpan? SlidingExpiration { get; set; }
- public IList ExpirationTokens { get; }
- public IList PostEvictionCallbacks { get; }
- public CacheItemPriority Priority { get; set; }
- public long? Size { get; set; }
- }
+ public object Key { get; }
+ public object Value { get; set; }
+ public DateTimeOffset? AbsoluteExpiration { get; set; }
+ public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
+ public TimeSpan? SlidingExpiration { get; set; }
+ public IList ExpirationTokens { get; }
+ public IList PostEvictionCallbacks { get; }
+ public CacheItemPriority Priority { get; set; }
+ public long? Size { get; set; }
+ }
- public virtual void Remove(object key)
- {
- }
+ public virtual void Remove(object key)
+ {
+ }
- public virtual void Dispose()
- {
- }
+ public virtual void Dispose()
+ {
}
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Query/RawSqlQueryTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Query/RawSqlQueryTests.cs
similarity index 58%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Query/RawSqlQueryTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Query/RawSqlQueryTests.cs
index afae898cdb8..56144a5af80 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Query/RawSqlQueryTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Query/RawSqlQueryTests.cs
@@ -4,29 +4,42 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
// ReSharper disable FormatStringProblem
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class RawSqlQueryTests
+ public abstract class RawSqlQueryTests
{
- private static readonly RawSqlQueryFixture _fixture = new RawSqlQueryFixture();
- private OrdersContext _context;
+ private OrdersContextBase _context;
+
+ protected abstract OrdersFixtureBase CreateFixture();
+ protected abstract string StoredProcedureCreationScript { get; }
[Params(true, false)]
- public bool Async;
+ public virtual bool Async { get; set; }
[Params(true, false)]
- public bool Tracking;
+ public virtual bool Tracking { get; set; }
[GlobalSetup]
public virtual void CreateContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(
+ 1000, 1000, 2, 2,
+ ctx =>
+ {
+ if (!string.IsNullOrEmpty(StoredProcedureCreationScript))
+ {
+ ctx.Database.ExecuteSqlCommand(StoredProcedureCreationScript);
+ }
+ });
+
+ _context = fixture.CreateContext();
Assert.Equal(1000, _context.Products.Count());
Assert.Equal(1000, _context.Customers.Count());
@@ -41,10 +54,10 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task SelectAll()
+ public virtual async Task SelectAll()
{
var query = _context.Products
- .FromSql("SELECT * FROM dbo.Products")
+ .FromSql(@"SELECT * FROM ""Products""")
.ApplyTracking(Tracking);
if (Async)
@@ -58,10 +71,10 @@ public async Task SelectAll()
}
[Benchmark]
- public async Task SelectParameterized()
+ public virtual async Task SelectParameterized()
{
var query = _context.Products
- .FromSql("SELECT * FROM dbo.Products WHERE CurrentPrice >= @p0 AND CurrentPrice <= @p1", 10, 14)
+ .FromSql(@"SELECT * FROM ""Products"" WHERE ""CurrentPrice"" >= @p0 AND ""CurrentPrice"" <= @p1", 10, 14)
.ApplyTracking(Tracking);
if (Async)
@@ -75,10 +88,10 @@ public async Task SelectParameterized()
}
[Benchmark]
- public async Task SelectComposed()
+ public virtual async Task SelectComposed()
{
var query = _context.Products
- .FromSql("SELECT * FROM dbo.Products")
+ .FromSql(@"SELECT * FROM ""Products""")
.ApplyTracking(Tracking)
.Where(p => p.CurrentPrice >= 10 && p.CurrentPrice <= 14)
.OrderBy(p => p.Name);
@@ -94,10 +107,10 @@ public async Task SelectComposed()
}
[Benchmark]
- public async Task StoredProcedure()
+ public virtual async Task StoredProcedure()
{
var query = _context.Products
- .FromSql("EXECUTE dbo.SearchProducts @p0, @p1", 10, 14)
+ .FromSql(@"EXECUTE dbo.SearchProducts @p0, @p1", 10, 14)
.ApplyTracking(Tracking);
if (Async)
@@ -109,25 +122,5 @@ public async Task StoredProcedure()
query.ToList();
}
}
-
- public class RawSqlQueryFixture : OrdersFixture
- {
- public RawSqlQueryFixture()
- : base("Perf_Query_RawSql", 1000, 1000, 2, 2)
- {
- }
-
- protected override void OnDatabaseCreated(OrdersContext context)
- {
- context.Database.ExecuteSqlCommand(
- @"CREATE PROCEDURE dbo.SearchProducts
- @minPrice decimal(18, 2),
- @maxPrice decimal(18, 2)
- AS
- BEGIN
- SELECT * FROM dbo.Products WHERE CurrentPrice >= @minPrice AND CurrentPrice <= @maxPrice
- END");
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Query/SimpleQueryTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/Query/SimpleQueryTests.cs
similarity index 82%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Query/SimpleQueryTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/Query/SimpleQueryTests.cs
index 47592ae443f..9e32dc9e673 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Query/SimpleQueryTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/Query/SimpleQueryTests.cs
@@ -4,28 +4,32 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Query
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
{
- public class SimpleQueryTests
+ public abstract class SimpleQueryTests
{
- private static readonly SimpleQueryFixture _fixture = new SimpleQueryFixture();
- private OrdersContext _context;
+ private OrdersContextBase _context;
+
+ protected abstract OrdersFixtureBase CreateFixture();
[Params(true, false)]
- public bool Async;
+ public virtual bool Async { get; set; }
[Params(true, false)]
- public bool Tracking;
+ public virtual bool Tracking { get; set; }
[GlobalSetup]
public virtual void CreateContext()
{
- _context = _fixture.CreateContext();
+ var fixture = CreateFixture();
+ fixture.Initialize(1000, 1000, 2, 2);
+
+ _context = fixture.CreateContext();
Assert.Equal(1000, _context.Products.Count());
Assert.Equal(1000, _context.Customers.Count());
@@ -39,7 +43,7 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task LoadAll()
+ public virtual async Task LoadAll()
{
var query = _context.Products
.ApplyTracking(Tracking);
@@ -55,7 +59,7 @@ public async Task LoadAll()
}
[Benchmark]
- public async Task Where()
+ public virtual async Task Where()
{
var query = _context.Products
.ApplyTracking(Tracking)
@@ -72,7 +76,7 @@ public async Task Where()
}
[Benchmark]
- public async Task OrderBy()
+ public virtual async Task OrderBy()
{
var query = _context.Products
.ApplyTracking(Tracking)
@@ -89,7 +93,7 @@ public async Task OrderBy()
}
[Benchmark]
- public async Task Count()
+ public virtual async Task Count()
{
var query = _context.Products;
@@ -104,7 +108,7 @@ public async Task Count()
}
[Benchmark]
- public async Task SkipTake()
+ public virtual async Task SkipTake()
{
var query = _context.Products
.ApplyTracking(Tracking)
@@ -123,7 +127,7 @@ public async Task SkipTake()
}
[Benchmark]
- public async Task GroupBy()
+ public virtual async Task GroupBy()
{
var query = _context.Products
.GroupBy(p => p.Retail)
@@ -145,7 +149,7 @@ public async Task GroupBy()
}
[Benchmark]
- public async Task Include()
+ public virtual async Task Include()
{
var query = _context.Customers
.ApplyTracking(Tracking)
@@ -162,7 +166,7 @@ public async Task Include()
}
[Benchmark]
- public async Task Projection()
+ public virtual async Task Projection()
{
var query = _context.Products
.Select(
@@ -188,7 +192,7 @@ public async Task Projection()
}
[Benchmark]
- public async Task ProjectionAcrossNavigation()
+ public virtual async Task ProjectionAcrossNavigation()
{
var query = _context.Orders
.Select(
@@ -213,13 +217,5 @@ public async Task ProjectionAcrossNavigation()
query.ToList();
}
}
-
- public class SimpleQueryFixture : OrdersFixture
- {
- public SimpleQueryFixture()
- : base("Perf_Query_Simple", 1000, 1000, 2, 2)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/UpdatePipeline/SimpleUpdatePipelineTests.cs b/benchmarks/src/EFCore.Benchmarks.V2/UpdatePipeline/SimpleUpdatePipelineTests.cs
similarity index 69%
rename from benchmarks/EFCore.Benchmarks.EFCore/UpdatePipeline/SimpleUpdatePipelineTests.cs
rename to benchmarks/src/EFCore.Benchmarks.V2/UpdatePipeline/SimpleUpdatePipelineTests.cs
index 4cdd18c6b5b..ce7432adca7 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/UpdatePipeline/SimpleUpdatePipelineTests.cs
+++ b/benchmarks/src/EFCore.Benchmarks.V2/UpdatePipeline/SimpleUpdatePipelineTests.cs
@@ -4,31 +4,44 @@
using System.Linq;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Models.Orders;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Microsoft.EntityFrameworkCore.Storage;
using Xunit;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore.UpdatePipeline
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class SimpleUpdatePipelineTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class UpdatePipelineBase
{
- protected static readonly SimpleUpdatePipelineFixture _fixture = new SimpleUpdatePipelineFixture();
- protected OrdersContext _context;
+ protected OrdersFixtureBase _fixture;
+ protected OrdersContextBase _context;
private IDbContextTransaction _transaction;
private int _recordsAffected = -1;
+ public abstract OrdersFixtureBase CreateFixture();
+
[Params(true, false)]
- public bool Async;
+ public virtual bool Async { get; set; }
[Params(true, false)]
- public bool Batching;
+ public virtual bool Batching { get; set; }
+
+ [GlobalSetup]
+ public virtual void InitializeFixture()
+ {
+ _fixture = CreateFixture();
+ _fixture.Initialize(0, 1000, 0, 0);
+ }
[IterationSetup]
public virtual void InitializeContext()
{
- _context = _fixture.CreateContext(Batching);
+ _context = _fixture.CreateContext(disableBatching: Batching);
_transaction = _context.Database.BeginTransaction();
}
@@ -45,7 +58,7 @@ public virtual void CleanupContext()
}
[Benchmark]
- public async Task UpdatePipeline()
+ public virtual async Task UpdatePipeline()
{
_recordsAffected = Async
? await _context.SaveChangesAsync()
@@ -53,7 +66,7 @@ public async Task UpdatePipeline()
}
}
- public class Insert : Base
+ public abstract class InsertBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -65,7 +78,7 @@ public override void InitializeContext()
}
}
- public class Update : Base
+ public abstract class UpdateBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -79,7 +92,7 @@ public override void InitializeContext()
}
}
- public class Delete : Base
+ public abstract class DeleteBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -90,7 +103,7 @@ public override void InitializeContext()
}
}
- public class Mixed : Base
+ public abstract class MixedBase : UpdatePipelineBase
{
[IterationSetup]
public override void InitializeContext()
@@ -112,18 +125,5 @@ public override void InitializeContext()
}
}
}
-
- public class SimpleUpdatePipelineFixture : OrdersFixture
- {
- public SimpleUpdatePipelineFixture()
- : base("Perf_UpdatePipeline_Simple", 0, 1000, 0, 0)
- {
- }
-
- public OrdersContext CreateContext(bool batching)
- {
- return new OrdersContext(ConnectionString, disableBatching: !batching);
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks/BenchmarkConfig.cs b/benchmarks/src/EFCore.Benchmarks/BenchmarkConfig.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/BenchmarkConfig.cs
rename to benchmarks/src/EFCore.Benchmarks/BenchmarkConfig.cs
diff --git a/benchmarks/EFCore.Benchmarks/BenchmarkJobAttribute.cs b/benchmarks/src/EFCore.Benchmarks/BenchmarkJobAttribute.cs
similarity index 89%
rename from benchmarks/EFCore.Benchmarks/BenchmarkJobAttribute.cs
rename to benchmarks/src/EFCore.Benchmarks/BenchmarkJobAttribute.cs
index 54fbc43b94c..da28ec3edb3 100644
--- a/benchmarks/EFCore.Benchmarks/BenchmarkJobAttribute.cs
+++ b/benchmarks/src/EFCore.Benchmarks/BenchmarkJobAttribute.cs
@@ -9,7 +9,9 @@
namespace Microsoft.EntityFrameworkCore.Benchmarks
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)]
+#pragma warning disable CA1813 // Avoid unsealed attributes
public class BenchmarkJobAttribute : Attribute, IConfigSource
+#pragma warning restore CA1813 // Avoid unsealed attributes
{
public BenchmarkJobAttribute()
{
diff --git a/benchmarks/EFCore.Benchmarks/BenchmarkResult.cs b/benchmarks/src/EFCore.Benchmarks/BenchmarkResult.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/BenchmarkResult.cs
rename to benchmarks/src/EFCore.Benchmarks/BenchmarkResult.cs
diff --git a/benchmarks/EFCore.Benchmarks/BenchmarkSummaryProcessor.cs b/benchmarks/src/EFCore.Benchmarks/BenchmarkSummaryProcessor.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/BenchmarkSummaryProcessor.cs
rename to benchmarks/src/EFCore.Benchmarks/BenchmarkSummaryProcessor.cs
diff --git a/benchmarks/EFCore.Benchmarks/ColdStartSandbox.cs b/benchmarks/src/EFCore.Benchmarks/ColdStartSandbox.cs
similarity index 97%
rename from benchmarks/EFCore.Benchmarks/ColdStartSandbox.cs
rename to benchmarks/src/EFCore.Benchmarks/ColdStartSandbox.cs
index 6a7b5f4d7f4..60e398b0bc8 100644
--- a/benchmarks/EFCore.Benchmarks/ColdStartSandbox.cs
+++ b/benchmarks/src/EFCore.Benchmarks/ColdStartSandbox.cs
@@ -41,7 +41,7 @@ private object CreateInstance(Type type, params object[] args)
activationAttributes: null);
}
- public virtual void Dispose()
+ public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
diff --git a/benchmarks/EFCore.Benchmarks/EFCore.Benchmarks.csproj b/benchmarks/src/EFCore.Benchmarks/EFCore.Benchmarks.csproj
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/EFCore.Benchmarks.csproj
rename to benchmarks/src/EFCore.Benchmarks/EFCore.Benchmarks.csproj
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Address.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Address.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Address.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Address.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/AddressType.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/AddressType.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/AddressType.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/AddressType.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BillOfMaterials.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BillOfMaterials.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BillOfMaterials.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BillOfMaterials.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntity.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntity.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntity.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntity.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityAddress.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityAddress.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityAddress.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityAddress.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityContact.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityContact.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityContact.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/BusinessEntityContact.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ContactType.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ContactType.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ContactType.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ContactType.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CountryRegion.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CountryRegion.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CountryRegion.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CountryRegion.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CountryRegionCurrency.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CountryRegionCurrency.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CountryRegionCurrency.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CountryRegionCurrency.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CreditCard.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CreditCard.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CreditCard.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CreditCard.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Culture.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Culture.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Culture.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Culture.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Currency.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Currency.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Currency.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Currency.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CurrencyRate.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CurrencyRate.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/CurrencyRate.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/CurrencyRate.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Customer.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Customer.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Customer.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Customer.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Department.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Department.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Department.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Department.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/EmailAddress.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/EmailAddress.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/EmailAddress.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/EmailAddress.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Employee.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Employee.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Employee.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Employee.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/EmployeeDepartmentHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/EmployeeDepartmentHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/EmployeeDepartmentHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/EmployeeDepartmentHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/EmployeePayHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/EmployeePayHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/EmployeePayHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/EmployeePayHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Illustration.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Illustration.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Illustration.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Illustration.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/JobCandidate.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/JobCandidate.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/JobCandidate.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/JobCandidate.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Location.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Location.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Location.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Location.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Password.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Password.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Password.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Password.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Person.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Person.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Person.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Person.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PersonCreditCard.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PersonCreditCard.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PersonCreditCard.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PersonCreditCard.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PersonPhone.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PersonPhone.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PersonPhone.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PersonPhone.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PhoneNumberType.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PhoneNumberType.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PhoneNumberType.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PhoneNumberType.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Product.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Product.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Product.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Product.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductCategory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductCategory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductCategory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductCategory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductCostHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductCostHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductCostHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductCostHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductDescription.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductDescription.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductDescription.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductDescription.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductDocument.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductDocument.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductDocument.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductDocument.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductInventory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductInventory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductInventory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductInventory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductListPriceHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductListPriceHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductListPriceHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductListPriceHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductModel.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductModel.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductModel.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductModel.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductModelIllustration.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductModelIllustration.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductModelIllustration.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductModelIllustration.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductModelProductDescriptionCulture.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductModelProductDescriptionCulture.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductModelProductDescriptionCulture.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductModelProductDescriptionCulture.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductPhoto.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductPhoto.cs
similarity index 75%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductPhoto.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductPhoto.cs
index b6993886b72..7940c32bb23 100644
--- a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductPhoto.cs
+++ b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductPhoto.cs
@@ -14,10 +14,14 @@ public ProductPhoto()
}
public int ProductPhotoID { get; set; }
+#pragma warning disable CA1819 // Properties should not return arrays
public byte[] LargePhoto { get; set; }
+#pragma warning restore CA1819 // Properties should not return arrays
public string LargePhotoFileName { get; set; }
public DateTime ModifiedDate { get; set; }
+#pragma warning disable CA1819 // Properties should not return arrays
public byte[] ThumbNailPhoto { get; set; }
+#pragma warning restore CA1819 // Properties should not return arrays
public string ThumbnailPhotoFileName { get; set; }
public virtual ICollection ProductProductPhoto { get; set; }
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductProductPhoto.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductProductPhoto.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductProductPhoto.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductProductPhoto.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductReview.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductReview.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductReview.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductReview.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductSubcategory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductSubcategory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductSubcategory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductSubcategory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductVendor.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductVendor.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ProductVendor.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ProductVendor.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderDetail.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderDetail.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderDetail.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderDetail.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderHeader.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderHeader.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderHeader.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/PurchaseOrderHeader.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderDetail.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderDetail.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderDetail.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderDetail.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeader.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeader.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeader.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeader.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeaderSalesReason.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeaderSalesReason.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeaderSalesReason.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesOrderHeaderSalesReason.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesPerson.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesPerson.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesPerson.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesPerson.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesPersonQuotaHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesPersonQuotaHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesPersonQuotaHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesPersonQuotaHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesReason.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesReason.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesReason.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesReason.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesTaxRate.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesTaxRate.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesTaxRate.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesTaxRate.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritoryHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritoryHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritoryHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SalesTerritoryHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ScrapReason.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ScrapReason.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ScrapReason.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ScrapReason.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Shift.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Shift.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Shift.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Shift.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ShipMethod.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ShipMethod.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ShipMethod.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ShipMethod.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ShoppingCartItem.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ShoppingCartItem.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/ShoppingCartItem.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/ShoppingCartItem.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SpecialOffer.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SpecialOffer.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SpecialOffer.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SpecialOffer.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SpecialOfferProduct.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SpecialOfferProduct.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/SpecialOfferProduct.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/SpecialOfferProduct.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/StateProvince.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/StateProvince.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/StateProvince.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/StateProvince.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Store.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Store.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Store.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Store.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistory.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistory.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistory.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistory.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistoryArchive.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistoryArchive.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistoryArchive.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/TransactionHistoryArchive.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/UnitMeasure.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/UnitMeasure.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/UnitMeasure.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/UnitMeasure.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Vendor.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Vendor.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/Vendor.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/Vendor.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/WorkOrder.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/WorkOrder.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/WorkOrder.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/WorkOrder.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/AdventureWorks/WorkOrderRouting.cs b/benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/WorkOrderRouting.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/AdventureWorks/WorkOrderRouting.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/AdventureWorks/WorkOrderRouting.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/Orders/Customer.cs b/benchmarks/src/EFCore.Benchmarks/Models/Orders/Customer.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/Orders/Customer.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/Orders/Customer.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/Orders/Order.cs b/benchmarks/src/EFCore.Benchmarks/Models/Orders/Order.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/Orders/Order.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/Orders/Order.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/Orders/OrderLine.cs b/benchmarks/src/EFCore.Benchmarks/Models/Orders/OrderLine.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/Orders/OrderLine.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/Orders/OrderLine.cs
diff --git a/benchmarks/EFCore.Benchmarks/Models/Orders/OrdersFixtureBase.cs b/benchmarks/src/EFCore.Benchmarks/Models/Orders/OrdersFixtureBase.cs
similarity index 99%
rename from benchmarks/EFCore.Benchmarks/Models/Orders/OrdersFixtureBase.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/Orders/OrdersFixtureBase.cs
index 8c5f7c8be93..46060c8986d 100644
--- a/benchmarks/EFCore.Benchmarks/Models/Orders/OrdersFixtureBase.cs
+++ b/benchmarks/src/EFCore.Benchmarks/Models/Orders/OrdersFixtureBase.cs
@@ -6,7 +6,7 @@
namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
{
- public abstract class OrdersFixtureBase
+ public abstract class OrdersFixtureSeedBase
{
public virtual List CreateCustomers(int customerCount, bool setPrimaryKeys)
{
diff --git a/benchmarks/EFCore.Benchmarks/Models/Orders/Product.cs b/benchmarks/src/EFCore.Benchmarks/Models/Orders/Product.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks/Models/Orders/Product.cs
rename to benchmarks/src/EFCore.Benchmarks/Models/Orders/Product.cs
diff --git a/benchmarks/EFCore.Benchmarks/SqlServerBenchmarkResultProcessor.cs b/benchmarks/src/EFCore.Benchmarks/SqlServerBenchmarkResultProcessor.cs
similarity index 96%
rename from benchmarks/EFCore.Benchmarks/SqlServerBenchmarkResultProcessor.cs
rename to benchmarks/src/EFCore.Benchmarks/SqlServerBenchmarkResultProcessor.cs
index 6a6197d6480..83dba4ebb7c 100644
--- a/benchmarks/EFCore.Benchmarks/SqlServerBenchmarkResultProcessor.cs
+++ b/benchmarks/src/EFCore.Benchmarks/SqlServerBenchmarkResultProcessor.cs
@@ -9,7 +9,7 @@ namespace Microsoft.EntityFrameworkCore.Benchmarks
{
public class SqlServerBenchmarkResultProcessor
{
- private static readonly string _insertCommand =
+ private const string _insertCommand =
@"INSERT INTO [dbo].[BenchmarkDotNetRuns]
([MachineName]
,[Framework]
@@ -49,7 +49,7 @@ public class SqlServerBenchmarkResultProcessor
,@TimeElapsedStandardDeviation
,@MemoryAllocated)";
- private static readonly string _tableCreationCommand =
+ private const string _tableCreationCommand =
@"IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='benchmarkdotnetruns' and xtype='U')
CREATE TABLE [dbo].[BenchmarkDotNetRuns](
[Id] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
@@ -84,7 +84,7 @@ public virtual void SaveSummary(string connectionString, BenchmarkResult result)
}
}
- private void EnsureRunsTableCreated(SqlConnection conn)
+ private static void EnsureRunsTableCreated(SqlConnection conn)
{
var cmd = conn.CreateCommand();
cmd.CommandText = _tableCreationCommand;
diff --git a/benchmarks/EFCore.Benchmarks.EF6/ChangeTracker/DbSetOperationTests.cs b/benchmarks/test/EFCore.Benchmarks.EF6/ChangeTracker/DbSetOperationTests.cs
similarity index 87%
rename from benchmarks/EFCore.Benchmarks.EF6/ChangeTracker/DbSetOperationTests.cs
rename to benchmarks/test/EFCore.Benchmarks.EF6/ChangeTracker/DbSetOperationTests.cs
index 8392a269a9e..207a4451260 100644
--- a/benchmarks/EFCore.Benchmarks.EF6/ChangeTracker/DbSetOperationTests.cs
+++ b/benchmarks/test/EFCore.Benchmarks.EF6/ChangeTracker/DbSetOperationTests.cs
@@ -7,13 +7,18 @@
using Microsoft.EntityFrameworkCore.Benchmarks.EF6.Models.Orders;
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+#pragma warning disable CA1034 // Nested types should not be visible
+
namespace Microsoft.EntityFrameworkCore.Benchmarks.EF6.ChangeTracker
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class DbSetOperationTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class DbSetOperationBase
{
- private readonly DbSetOperationFixture _fixture = new DbSetOperationFixture();
+ private static readonly OrdersFixture _fixture
+ = new OrdersFixture("Perf_ChangeTracker_DbSetOperation_EF6", 0, 0, 0, 0);
protected List _customersWithoutPk;
protected List _customersWithPk;
@@ -42,7 +47,7 @@ public virtual void CleanupContext()
}
}
- public abstract class AddDataVariations : Base
+ public abstract class AddDataVariations : DbSetOperationBase
{
[Benchmark]
public virtual void Add()
@@ -72,7 +77,7 @@ public virtual void Attach()
// API for bulk attach in EF6.x
}
- public abstract class ExistingDataVariations : Base
+ public abstract class ExistingDataVariations : DbSetOperationBase
{
[IterationSetup]
public override void InitializeContext()
@@ -134,13 +139,5 @@ public class ExistingDataVariationsWithAutoDetectChangesOff : ExistingDataVariat
{
protected override bool AutoDetectChanges => false;
}
-
- public class DbSetOperationFixture : OrdersFixture
- {
- public DbSetOperationFixture()
- : base("Perf_ChangeTracker_DbSetOperation_EF6", 0, 0, 0, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EF6/ChangeTracker/FixupTests.cs b/benchmarks/test/EFCore.Benchmarks.EF6/ChangeTracker/FixupTests.cs
similarity index 88%
rename from benchmarks/EFCore.Benchmarks.EF6/ChangeTracker/FixupTests.cs
rename to benchmarks/test/EFCore.Benchmarks.EF6/ChangeTracker/FixupTests.cs
index 45b9fc3bc64..c793d68048e 100644
--- a/benchmarks/EFCore.Benchmarks.EF6/ChangeTracker/FixupTests.cs
+++ b/benchmarks/test/EFCore.Benchmarks.EF6/ChangeTracker/FixupTests.cs
@@ -8,15 +8,18 @@
using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
using Xunit;
-// ReSharper disable ReturnValueOfPureMethodIsNotUsed
+#pragma warning disable CA1034 // Nested types should not be visible
namespace Microsoft.EntityFrameworkCore.Benchmarks.EF6.ChangeTracker
{
+#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class FixupTests
+#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
- public abstract class Base
+ public abstract class FixupBase
{
- private static readonly FixupFixture _fixture = new FixupFixture();
+ private static readonly OrdersFixture _fixture
+ = new OrdersFixture("Perf_ChangeTracker_Fixup_EF6", 0, 5000, 2, 0);
protected List _customers;
protected List _ordersWithoutPk;
@@ -53,7 +56,7 @@ public virtual void CleanupContext()
}
}
- public abstract class ChildVariations : Base
+ public abstract class ChildVariations : FixupBase
{
[IterationSetup]
public override void InitializeContext()
@@ -88,7 +91,7 @@ public virtual void QueryChildren()
}
}
- public abstract class ParentVariations : Base
+ public abstract class ParentVariations : FixupBase
{
[IterationSetup]
public override void InitializeContext()
@@ -142,13 +145,5 @@ public class ParentVariationsWithAutoDetectChangesOff : ParentVariations
{
protected override bool AutoDetectChanges => false;
}
-
- public class FixupFixture : OrdersFixture
- {
- public FixupFixture()
- : base("Perf_ChangeTracker_Fixup_EF6", 0, 5000, 2, 0)
- {
- }
- }
}
}
diff --git a/benchmarks/EFCore.Benchmarks.EF6/EFCore.Benchmarks.EF6.csproj b/benchmarks/test/EFCore.Benchmarks.EF6/EFCore.Benchmarks.EF6.csproj
similarity index 83%
rename from benchmarks/EFCore.Benchmarks.EF6/EFCore.Benchmarks.EF6.csproj
rename to benchmarks/test/EFCore.Benchmarks.EF6/EFCore.Benchmarks.EF6.csproj
index 2ddb8ee3522..6ed1a2909d3 100644
--- a/benchmarks/EFCore.Benchmarks.EF6/EFCore.Benchmarks.EF6.csproj
+++ b/benchmarks/test/EFCore.Benchmarks.EF6/EFCore.Benchmarks.EF6.csproj
@@ -3,7 +3,7 @@
net461
Microsoft.EntityFrameworkCore.Benchmarks.EF6
- exe
+ Exe
@@ -14,7 +14,7 @@
-
+
diff --git a/benchmarks/EFCore.Benchmarks.EF6/Extensions.cs b/benchmarks/test/EFCore.Benchmarks.EF6/Extensions.cs
similarity index 93%
rename from benchmarks/EFCore.Benchmarks.EF6/Extensions.cs
rename to benchmarks/test/EFCore.Benchmarks.EF6/Extensions.cs
index 19dee3c24a4..d09a6bf40f1 100644
--- a/benchmarks/EFCore.Benchmarks.EF6/Extensions.cs
+++ b/benchmarks/test/EFCore.Benchmarks.EF6/Extensions.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
@@ -24,9 +25,9 @@ public static IQueryable DisableQueryCache(this IQueryable)
.GetProperty("System.Data.Entity.Internal.Linq.IInternalQueryAdapter.InternalQuery", BindingFlags.NonPublic | BindingFlags.Instance)
.GetMethod
- .Invoke(query, new object[0]);
+ .Invoke(query, Array.Empty
-
+
-
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Initialization/ColdStartEnabledSqlServerTest.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Initialization/ColdStartEnabledSqlServerTest.cs
new file mode 100644
index 00000000000..0b9cb3fc67c
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Initialization/ColdStartEnabledSqlServerTest.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public class ColdStartEnabledSqlServerTest : ColdStartEnabledTests
+ {
+ protected override AdventureWorksContextBase CreateContext()
+ {
+ return AdventureWorksFixture.CreateContext();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Initialization/InitializationSqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Initialization/InitializationSqlServerTests.cs
new file mode 100644
index 00000000000..cd395b5e5fa
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Initialization/InitializationSqlServerTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public class InitializationSqlServerTests : InitializationTests
+ {
+ protected override ConventionSet CreateConventionSet()
+ {
+ return SqlServerConventionSetBuilder.Build();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/AdventureWorks/AdventureWorksContext.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/AdventureWorks/AdventureWorksContext.cs
new file mode 100644
index 00000000000..22460b367ef
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/AdventureWorks/AdventureWorksContext.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
+{
+ public class AdventureWorksContext : AdventureWorksContextBase
+ {
+ private readonly string _connectionString;
+
+ public AdventureWorksContext(string connectionString)
+ {
+ _connectionString = connectionString;
+ }
+
+ protected override void ConfigureProvider(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlServer(_connectionString);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/AdventureWorks/AdventureWorksFixture.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/AdventureWorks/AdventureWorksFixture.cs
new file mode 100644
index 00000000000..e999cc067ee
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/AdventureWorks/AdventureWorksFixture.cs
@@ -0,0 +1,16 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
+{
+ public static class AdventureWorksFixture
+ {
+ private static string _connectionString = $"{BenchmarkConfig.Instance.BenchmarkDatabase}Database=AdventureWorks2014;";
+
+ // This method is called from timed code, be careful when changing it
+ public static AdventureWorksContextBase CreateContext()
+ {
+ return new AdventureWorksContext(_connectionString);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/Orders/OrdersContext.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/Orders/OrdersContext.cs
new file mode 100644
index 00000000000..38c39237768
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/Orders/OrdersContext.cs
@@ -0,0 +1,26 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public class OrdersContext : OrdersContextBase
+ {
+ private readonly string _connectionString;
+ private readonly bool _disableBatching;
+
+ public OrdersContext(string connectionString, IServiceProvider serviceProvider = null, bool disableBatching = false)
+ : base(serviceProvider)
+ {
+ _connectionString = connectionString;
+ _disableBatching = disableBatching;
+ }
+
+ protected override void ConfigureProvider(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlServer(_connectionString, b => { if (_disableBatching) { b.MaxBatchSize(1); } });
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/Orders/OrdersFixture.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/Orders/OrdersFixture.cs
new file mode 100644
index 00000000000..963386d7d55
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Models/Orders/OrdersFixture.cs
@@ -0,0 +1,22 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public class OrdersFixture : OrdersFixtureBase
+ {
+ private readonly string _connectionString;
+
+ public OrdersFixture(string databaseName)
+ {
+ _connectionString = $@"{BenchmarkConfig.Instance.BenchmarkDatabase}Database={databaseName};";
+ }
+
+ public override OrdersContextBase CreateContext(IServiceProvider serviceProvider = null, bool disableBatching = false)
+ {
+ return new OrdersContext(_connectionString, serviceProvider, disableBatching);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Program.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Program.cs
new file mode 100644
index 00000000000..7001078d0c0
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Program.cs
@@ -0,0 +1,44 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using BenchmarkDotNet.Running;
+using Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker;
+using Microsoft.EntityFrameworkCore.Benchmarks.Initialization;
+using Microsoft.EntityFrameworkCore.Benchmarks.Query;
+using Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks
+{
+ public static class Program
+ {
+ public static void Main(string[] args)
+ {
+ var benchmarkSummaryProcessor = new BenchmarkSummaryProcessor();
+
+ // Calibration
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+
+ // Initialization
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+
+ // ChangeTracker
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+
+ // Query
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+
+ // Update
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ }
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Properties/AssemblyInfo.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Properties/AssemblyInfo.cs
similarity index 100%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Properties/AssemblyInfo.cs
rename to benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Properties/AssemblyInfo.cs
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/FuncletizationSqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/FuncletizationSqlServerTests.cs
new file mode 100644
index 00000000000..0c968314fc6
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/FuncletizationSqlServerTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class FuncletizationSqlServerTests : FuncletizationTests
+ {
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Funcletization");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/NavigationsQuerySqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/NavigationsQuerySqlServerTests.cs
new file mode 100644
index 00000000000..92cc36c4b6a
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/NavigationsQuerySqlServerTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class NavigationsQuerySqlServerTests : NavigationsQueryTests
+ {
+ protected override AdventureWorksContextBase CreateContext()
+ {
+ return AdventureWorksFixture.CreateContext();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/QueryCompilationSqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/QueryCompilationSqlServerTests.cs
new file mode 100644
index 00000000000..6dd3c5ab708
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/QueryCompilationSqlServerTests.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class QueryCompilationSqlServerTests : QueryCompilationTests
+ {
+ public override IServiceCollection AddProviderServices(IServiceCollection services)
+ {
+ return services.AddEntityFrameworkSqlServer();
+ }
+
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Compilation");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/RawSqlQuerySqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/RawSqlQuerySqlServerTests.cs
new file mode 100644
index 00000000000..351649b638d
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/RawSqlQuerySqlServerTests.cs
@@ -0,0 +1,24 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class RawSqlQuerySqlServerTests : RawSqlQueryTests
+ {
+ protected override string StoredProcedureCreationScript
+ => @"CREATE PROCEDURE dbo.SearchProducts
+ @minPrice decimal(18, 2),
+ @maxPrice decimal(18, 2)
+ AS
+ BEGIN
+ SELECT * FROM dbo.Products WHERE CurrentPrice >= @minPrice AND CurrentPrice <= @maxPrice
+ END";
+
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_RawSql");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/SimpleQuerySqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/SimpleQuerySqlServerTests.cs
new file mode 100644
index 00000000000..014fbd498fd
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/Query/SimpleQuerySqlServerTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class SimpleQuerySqlServerTests : SimpleQueryTests
+ {
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Simple");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/UpdatePipeline/SimpleUpdatePipelineSqlServerTests.cs b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/UpdatePipeline/SimpleUpdatePipelineSqlServerTests.cs
new file mode 100644
index 00000000000..d70c11de4e8
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/UpdatePipeline/SimpleUpdatePipelineSqlServerTests.cs
@@ -0,0 +1,44 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline
+{
+ public class SimpleUpdatePipelineSqlServerTests : SimpleUpdatePipelineTests
+ {
+ public class Insert : InsertBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Update : UpdateBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Delete : DeleteBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Mixed : MixedBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/config.json b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/config.json
new file mode 100644
index 00000000000..a21e3919533
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.SqlServer.V2/config.json
@@ -0,0 +1,10 @@
+{
+ "benchmarks": {
+ "runIterations": false,
+ "resultDatabases": {
+ "local": "Server=(localdb)\\mssqllocaldb;Database=Benchmarks;Trusted_Connection=True;"
+ },
+ "benchmarkDatabase": "Server=(localdb)\\mssqllocaldb;Trusted_Connection=True;MultipleActiveResultSets=true;",
+ "productVersion": "EF Core SqlServer 2.0.1"
+ }
+}
\ No newline at end of file
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/ChangeTracker/DbSetOperationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/ChangeTracker/DbSetOperationSqliteTests.cs
new file mode 100644
index 00000000000..bdd12aacb66
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/ChangeTracker/DbSetOperationSqliteTests.cs
@@ -0,0 +1,28 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
+{
+ public class DbSetOperationSqliteTests : DbSetOperationTests
+ {
+ public class AddDataVariations : AddDataVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_DbSetOperation");
+ }
+ }
+
+ public class ExistingDataVariations : ExistingDataVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_DbSetOperation");
+ }
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/ChangeTracker/FixupSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/ChangeTracker/FixupSqliteTests.cs
new file mode 100644
index 00000000000..e66dd5d27f3
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/ChangeTracker/FixupSqliteTests.cs
@@ -0,0 +1,28 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
+{
+ public class FixupSqliteTests : FixupTests
+ {
+ public class ChildVariations : ChildVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_Fixup");
+ }
+ }
+
+ public class ParentVariations : ParentVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_Fixup");
+ }
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/EFCore.Benchmarks.Sqlite.Dev.csproj b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/EFCore.Benchmarks.Sqlite.Dev.csproj
new file mode 100644
index 00000000000..db8bca55a04
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/EFCore.Benchmarks.Sqlite.Dev.csproj
@@ -0,0 +1,25 @@
+
+
+
+ net461;netcoreapp2.0;netcoreapp2.1
+ Microsoft.EntityFrameworkCore.Benchmarks
+ Exe
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Initialization/ColdStartEnabledSqliteTest.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Initialization/ColdStartEnabledSqliteTest.cs
new file mode 100644
index 00000000000..d6704534f85
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Initialization/ColdStartEnabledSqliteTest.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public class ColdStartEnabledSqliteTest : ColdStartEnabledTests
+ {
+ protected override AdventureWorksContextBase CreateContext()
+ {
+ return AdventureWorksFixture.CreateContext();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Initialization/InitializationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Initialization/InitializationSqliteTests.cs
new file mode 100644
index 00000000000..b873c81ecc2
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Initialization/InitializationSqliteTests.cs
@@ -0,0 +1,31 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public class InitializationSqliteTests : InitializationTests
+ {
+ protected override ConventionSet CreateConventionSet()
+ {
+ return SqliteConventionSetBuilder.Build();
+ }
+
+ // TODO: Following are disabled due to no database.
+ public override void CreateAndDisposeUnusedContext()
+ {
+ base.CreateAndDisposeUnusedContext();
+ }
+
+ public override void InitializeAndQuery_AdventureWorks()
+ {
+ base.InitializeAndQuery_AdventureWorks();
+ }
+
+ public override void InitializeAndSaveChanges_AdventureWorks()
+ {
+ base.InitializeAndSaveChanges_AdventureWorks();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/AdventureWorks/AdventureWorksContext.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/AdventureWorks/AdventureWorksContext.cs
new file mode 100644
index 00000000000..76896a07125
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/AdventureWorks/AdventureWorksContext.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
+{
+ public class AdventureWorksContext : AdventureWorksContextBase
+ {
+ private readonly string _connectionString;
+
+ public AdventureWorksContext(string connectionString)
+ {
+ _connectionString = connectionString;
+ }
+
+ protected override void ConfigureProvider(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlite(_connectionString);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/AdventureWorks/AdventureWorksFixture.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/AdventureWorks/AdventureWorksFixture.cs
new file mode 100644
index 00000000000..113506bf473
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/AdventureWorks/AdventureWorksFixture.cs
@@ -0,0 +1,17 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
+{
+ public static class AdventureWorksFixture
+ {
+ // TODO: No database for Sqlite
+ private static string _connectionString = $"DataSource=AdventureWorks2014;";
+
+ // This method is called from timed code, be careful when changing it
+ public static AdventureWorksContextBase CreateContext()
+ {
+ return new AdventureWorksContext(_connectionString);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/Orders/OrdersContext.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/Orders/OrdersContext.cs
new file mode 100644
index 00000000000..b40e4ebb0c6
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/Orders/OrdersContext.cs
@@ -0,0 +1,26 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public class OrdersContext : OrdersContextBase
+ {
+ private readonly string _connectionString;
+ private readonly bool _disableBatching;
+
+ public OrdersContext(string connectionString, IServiceProvider serviceProvider = null, bool disableBatching = false)
+ : base(serviceProvider)
+ {
+ _connectionString = connectionString;
+ _disableBatching = disableBatching;
+ }
+
+ protected override void ConfigureProvider(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlite(_connectionString, b => { if (_disableBatching) { b.MaxBatchSize(1); } });
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/Orders/OrdersFixture.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/Orders/OrdersFixture.cs
new file mode 100644
index 00000000000..9b57d14238c
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Models/Orders/OrdersFixture.cs
@@ -0,0 +1,22 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public class OrdersFixture : OrdersFixtureBase
+ {
+ private readonly string _connectionString;
+
+ public OrdersFixture(string databaseName)
+ {
+ _connectionString = $@"DataSource={databaseName};";
+ }
+
+ public override OrdersContextBase CreateContext(IServiceProvider serviceProvider = null, bool disableBatching = false)
+ {
+ return new OrdersContext(_connectionString, serviceProvider, disableBatching);
+ }
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/Program.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Program.cs
similarity index 62%
rename from benchmarks/EFCore.Benchmarks.EFCore2/Program.cs
rename to benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Program.cs
index 2619bd2272b..105662b5430 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/Program.cs
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Program.cs
@@ -2,13 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using BenchmarkDotNet.Running;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.ChangeTracker;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.Query;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore2.UpdatePipeline;
+using Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker;
+using Microsoft.EntityFrameworkCore.Benchmarks.Initialization;
+using Microsoft.EntityFrameworkCore.Benchmarks.Query;
+using Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore2
+namespace Microsoft.EntityFrameworkCore.Benchmarks
{
- public class Program
+ public static class Program
{
public static void Main(string[] args)
{
@@ -18,26 +19,26 @@ public static void Main(string[] args)
benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// Initialization
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// ChangeTracker
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// Query
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// Update
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
}
}
}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Properties/AssemblyInfo.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000000..bec3b1fd1e7
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Properties/AssemblyInfo.cs
@@ -0,0 +1,8 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using BenchmarkDotNet.Attributes;
+using Microsoft.EntityFrameworkCore.Benchmarks;
+
+[assembly: BenchmarkJob]
+[assembly: MemoryDiagnoser]
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/FuncletizationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/FuncletizationSqliteTests.cs
new file mode 100644
index 00000000000..87af17bf0da
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/FuncletizationSqliteTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class FuncletizationSqliteTests : FuncletizationTests
+ {
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Funcletization");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/NavigationsQuerySqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/NavigationsQuerySqliteTests.cs
new file mode 100644
index 00000000000..ec206708211
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/NavigationsQuerySqliteTests.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class NavigationsQuerySqliteTests : NavigationsQueryTests
+ {
+ protected override AdventureWorksContextBase CreateContext()
+ {
+ return AdventureWorksFixture.CreateContext();
+ }
+
+ public override Task PredicateAcrossOptionalNavigation()
+ {
+ return base.PredicateAcrossOptionalNavigation();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/QueryCompilationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/QueryCompilationSqliteTests.cs
new file mode 100644
index 00000000000..a7854f4dc19
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/QueryCompilationSqliteTests.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class QueryCompilationSqliteTests : QueryCompilationTests
+ {
+ public override IServiceCollection AddProviderServices(IServiceCollection services)
+ {
+ return services.AddEntityFrameworkSqlite();
+ }
+
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Compilation");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/RawSqlQuerySqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/RawSqlQuerySqliteTests.cs
new file mode 100644
index 00000000000..7d8d62af5c5
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/RawSqlQuerySqliteTests.cs
@@ -0,0 +1,25 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class RawSqlQuerySqliteTests : RawSqlQueryTests
+ {
+ protected override string StoredProcedureCreationScript
+ => @"";
+
+ // TODO: Define stored procedure creation script
+ public override Task StoredProcedure()
+ {
+ return base.StoredProcedure();
+ }
+
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_RawSql");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/SimpleQuerySqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/SimpleQuerySqliteTests.cs
new file mode 100644
index 00000000000..bc0d351d05f
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/Query/SimpleQuerySqliteTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class SimpleQuerySqliteTests : SimpleQueryTests
+ {
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Simple");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/UpdatePipeline/SimpleUpdatePipelineSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/UpdatePipeline/SimpleUpdatePipelineSqliteTests.cs
new file mode 100644
index 00000000000..84e45cc8496
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/UpdatePipeline/SimpleUpdatePipelineSqliteTests.cs
@@ -0,0 +1,44 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline
+{
+ public class SimpleUpdatePipelineSqliteTests : SimpleUpdatePipelineTests
+ {
+ public class Insert : InsertBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Update : UpdateBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Delete : DeleteBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Mixed : MixedBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/config.json b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/config.json
similarity index 87%
rename from benchmarks/EFCore.Benchmarks.EFCore/config.json
rename to benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/config.json
index 1648f24e18f..246117be4de 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/config.json
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.Dev/config.json
@@ -5,6 +5,6 @@
"local": "Server=(localdb)\\mssqllocaldb;Database=Benchmarks;Trusted_Connection=True;"
},
"benchmarkDatabase": "Server=(localdb)\\mssqllocaldb;Trusted_Connection=True;MultipleActiveResultSets=true;",
- "productVersion": "EF Core dev"
+ "productVersion": "EF Core Sqlite dev"
}
}
\ No newline at end of file
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/ChangeTracker/DbSetOperationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/ChangeTracker/DbSetOperationSqliteTests.cs
new file mode 100644
index 00000000000..bdd12aacb66
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/ChangeTracker/DbSetOperationSqliteTests.cs
@@ -0,0 +1,28 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
+{
+ public class DbSetOperationSqliteTests : DbSetOperationTests
+ {
+ public class AddDataVariations : AddDataVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_DbSetOperation");
+ }
+ }
+
+ public class ExistingDataVariations : ExistingDataVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_DbSetOperation");
+ }
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/ChangeTracker/FixupSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/ChangeTracker/FixupSqliteTests.cs
new file mode 100644
index 00000000000..e66dd5d27f3
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/ChangeTracker/FixupSqliteTests.cs
@@ -0,0 +1,28 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker
+{
+ public class FixupSqliteTests : FixupTests
+ {
+ public class ChildVariations : ChildVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_Fixup");
+ }
+ }
+
+ public class ParentVariations : ParentVariationsBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_ChangeTracker_Fixup");
+ }
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/EFCore.Benchmarks.Sqlite.V2.csproj b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/EFCore.Benchmarks.Sqlite.V2.csproj
new file mode 100644
index 00000000000..3cb34176695
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/EFCore.Benchmarks.Sqlite.V2.csproj
@@ -0,0 +1,24 @@
+
+
+
+ net461;netcoreapp2.0;
+ Microsoft.EntityFrameworkCore.Benchmarks
+ Exe
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Initialization/ColdStartEnabledSqliteTest.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Initialization/ColdStartEnabledSqliteTest.cs
new file mode 100644
index 00000000000..d6704534f85
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Initialization/ColdStartEnabledSqliteTest.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public class ColdStartEnabledSqliteTest : ColdStartEnabledTests
+ {
+ protected override AdventureWorksContextBase CreateContext()
+ {
+ return AdventureWorksFixture.CreateContext();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Initialization/InitializationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Initialization/InitializationSqliteTests.cs
new file mode 100644
index 00000000000..b873c81ecc2
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Initialization/InitializationSqliteTests.cs
@@ -0,0 +1,31 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Metadata.Conventions;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Initialization
+{
+ public class InitializationSqliteTests : InitializationTests
+ {
+ protected override ConventionSet CreateConventionSet()
+ {
+ return SqliteConventionSetBuilder.Build();
+ }
+
+ // TODO: Following are disabled due to no database.
+ public override void CreateAndDisposeUnusedContext()
+ {
+ base.CreateAndDisposeUnusedContext();
+ }
+
+ public override void InitializeAndQuery_AdventureWorks()
+ {
+ base.InitializeAndQuery_AdventureWorks();
+ }
+
+ public override void InitializeAndSaveChanges_AdventureWorks()
+ {
+ base.InitializeAndSaveChanges_AdventureWorks();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/AdventureWorks/AdventureWorksContext.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/AdventureWorks/AdventureWorksContext.cs
new file mode 100644
index 00000000000..76896a07125
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/AdventureWorks/AdventureWorksContext.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
+{
+ public class AdventureWorksContext : AdventureWorksContextBase
+ {
+ private readonly string _connectionString;
+
+ public AdventureWorksContext(string connectionString)
+ {
+ _connectionString = connectionString;
+ }
+
+ protected override void ConfigureProvider(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlite(_connectionString);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/AdventureWorks/AdventureWorksFixture.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/AdventureWorks/AdventureWorksFixture.cs
new file mode 100644
index 00000000000..113506bf473
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/AdventureWorks/AdventureWorksFixture.cs
@@ -0,0 +1,17 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
+{
+ public static class AdventureWorksFixture
+ {
+ // TODO: No database for Sqlite
+ private static string _connectionString = $"DataSource=AdventureWorks2014;";
+
+ // This method is called from timed code, be careful when changing it
+ public static AdventureWorksContextBase CreateContext()
+ {
+ return new AdventureWorksContext(_connectionString);
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/Orders/OrdersContext.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/Orders/OrdersContext.cs
new file mode 100644
index 00000000000..b40e4ebb0c6
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/Orders/OrdersContext.cs
@@ -0,0 +1,26 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public class OrdersContext : OrdersContextBase
+ {
+ private readonly string _connectionString;
+ private readonly bool _disableBatching;
+
+ public OrdersContext(string connectionString, IServiceProvider serviceProvider = null, bool disableBatching = false)
+ : base(serviceProvider)
+ {
+ _connectionString = connectionString;
+ _disableBatching = disableBatching;
+ }
+
+ protected override void ConfigureProvider(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseSqlite(_connectionString, b => { if (_disableBatching) { b.MaxBatchSize(1); } });
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/Orders/OrdersFixture.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/Orders/OrdersFixture.cs
new file mode 100644
index 00000000000..9b57d14238c
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Models/Orders/OrdersFixture.cs
@@ -0,0 +1,22 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
+{
+ public class OrdersFixture : OrdersFixtureBase
+ {
+ private readonly string _connectionString;
+
+ public OrdersFixture(string databaseName)
+ {
+ _connectionString = $@"DataSource={databaseName};";
+ }
+
+ public override OrdersContextBase CreateContext(IServiceProvider serviceProvider = null, bool disableBatching = false)
+ {
+ return new OrdersContext(_connectionString, serviceProvider, disableBatching);
+ }
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore/Program.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Program.cs
similarity index 62%
rename from benchmarks/EFCore.Benchmarks.EFCore/Program.cs
rename to benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Program.cs
index 922e2fa922f..105662b5430 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore/Program.cs
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Program.cs
@@ -2,13 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using BenchmarkDotNet.Running;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.ChangeTracker;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.Query;
-using Microsoft.EntityFrameworkCore.Benchmarks.EFCore.UpdatePipeline;
+using Microsoft.EntityFrameworkCore.Benchmarks.ChangeTracker;
+using Microsoft.EntityFrameworkCore.Benchmarks.Initialization;
+using Microsoft.EntityFrameworkCore.Benchmarks.Query;
+using Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline;
-namespace Microsoft.EntityFrameworkCore.Benchmarks.EFCore
+namespace Microsoft.EntityFrameworkCore.Benchmarks
{
- public class Program
+ public static class Program
{
public static void Main(string[] args)
{
@@ -18,26 +19,26 @@ public static void Main(string[] args)
benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// Initialization
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// ChangeTracker
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// Query
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
// Update
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
- benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
+ benchmarkSummaryProcessor.Process(BenchmarkRunner.Run());
}
}
}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Properties/AssemblyInfo.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000000..bec3b1fd1e7
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Properties/AssemblyInfo.cs
@@ -0,0 +1,8 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using BenchmarkDotNet.Attributes;
+using Microsoft.EntityFrameworkCore.Benchmarks;
+
+[assembly: BenchmarkJob]
+[assembly: MemoryDiagnoser]
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/FuncletizationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/FuncletizationSqliteTests.cs
new file mode 100644
index 00000000000..87af17bf0da
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/FuncletizationSqliteTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class FuncletizationSqliteTests : FuncletizationTests
+ {
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Funcletization");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/NavigationsQuerySqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/NavigationsQuerySqliteTests.cs
new file mode 100644
index 00000000000..ec206708211
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/NavigationsQuerySqliteTests.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class NavigationsQuerySqliteTests : NavigationsQueryTests
+ {
+ protected override AdventureWorksContextBase CreateContext()
+ {
+ return AdventureWorksFixture.CreateContext();
+ }
+
+ public override Task PredicateAcrossOptionalNavigation()
+ {
+ return base.PredicateAcrossOptionalNavigation();
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/QueryCompilationSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/QueryCompilationSqliteTests.cs
new file mode 100644
index 00000000000..a7854f4dc19
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/QueryCompilationSqliteTests.cs
@@ -0,0 +1,21 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class QueryCompilationSqliteTests : QueryCompilationTests
+ {
+ public override IServiceCollection AddProviderServices(IServiceCollection services)
+ {
+ return services.AddEntityFrameworkSqlite();
+ }
+
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Compilation");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/RawSqlQuerySqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/RawSqlQuerySqliteTests.cs
new file mode 100644
index 00000000000..7d8d62af5c5
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/RawSqlQuerySqliteTests.cs
@@ -0,0 +1,25 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class RawSqlQuerySqliteTests : RawSqlQueryTests
+ {
+ protected override string StoredProcedureCreationScript
+ => @"";
+
+ // TODO: Define stored procedure creation script
+ public override Task StoredProcedure()
+ {
+ return base.StoredProcedure();
+ }
+
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_RawSql");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/SimpleQuerySqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/SimpleQuerySqliteTests.cs
new file mode 100644
index 00000000000..bc0d351d05f
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/Query/SimpleQuerySqliteTests.cs
@@ -0,0 +1,15 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.Query
+{
+ public class SimpleQuerySqliteTests : SimpleQueryTests
+ {
+ protected override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_Query_Simple");
+ }
+ }
+}
diff --git a/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/UpdatePipeline/SimpleUpdatePipelineSqliteTests.cs b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/UpdatePipeline/SimpleUpdatePipelineSqliteTests.cs
new file mode 100644
index 00000000000..84e45cc8496
--- /dev/null
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/UpdatePipeline/SimpleUpdatePipelineSqliteTests.cs
@@ -0,0 +1,44 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders;
+
+#pragma warning disable CA1034 // Nested types should not be visible
+
+namespace Microsoft.EntityFrameworkCore.Benchmarks.UpdatePipeline
+{
+ public class SimpleUpdatePipelineSqliteTests : SimpleUpdatePipelineTests
+ {
+ public class Insert : InsertBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Update : UpdateBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Delete : DeleteBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+
+ public class Mixed : MixedBase
+ {
+ public override OrdersFixtureBase CreateFixture()
+ {
+ return new OrdersFixture("Perf_UpdatePipeline_Simple");
+ }
+ }
+ }
+}
diff --git a/benchmarks/EFCore.Benchmarks.EFCore2/config.json b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/config.json
similarity index 86%
rename from benchmarks/EFCore.Benchmarks.EFCore2/config.json
rename to benchmarks/test/EFCore.Benchmarks.Sqlite.V2/config.json
index fbd34ef04ac..eb986eec7f9 100644
--- a/benchmarks/EFCore.Benchmarks.EFCore2/config.json
+++ b/benchmarks/test/EFCore.Benchmarks.Sqlite.V2/config.json
@@ -5,6 +5,6 @@
"local": "Server=(localdb)\\mssqllocaldb;Database=Benchmarks;Trusted_Connection=True;"
},
"benchmarkDatabase": "Server=(localdb)\\mssqllocaldb;Trusted_Connection=True;MultipleActiveResultSets=true;",
- "productVersion": "EF Core 2.0.0"
+ "productVersion": "EF Core Sqlite 2.0.1"
}
}
\ No newline at end of file