EfCore.TestSupportSchema
1.0.0-preview001
See the version list below for details.
dotnet add package EfCore.TestSupportSchema --version 1.0.0-preview001
NuGet\Install-Package EfCore.TestSupportSchema -Version 1.0.0-preview001
<PackageReference Include="EfCore.TestSupportSchema" Version="1.0.0-preview001" />
paket add EfCore.TestSupportSchema --version 1.0.0-preview001
#r "nuget: EfCore.TestSupportSchema, 1.0.0-preview001"
// Install EfCore.TestSupportSchema as a Cake Addin #addin nuget:?package=EfCore.TestSupportSchema&version=1.0.0-preview001&prerelease // Install EfCore.TestSupportSchema as a Cake Tool #tool nuget:?package=EfCore.TestSupportSchema&version=1.0.0-preview001&prerelease
TestSupportSchema
This is a TEMPERARY project (it will move into EfCore.TestSupport when EF Core 5 is released) to contain the code that wipes the database schema and replaces it with a database that matches the current EF Core classes/configuration.
Why is this useful?
When you are writing your unit tests you are likely to use the command context.Database.EnsureCreated()
to set up the database you use for unit testing. That works for Sqlite in-memory databases, but it you are using a real database, then you need to call below to make sure that the database schema is up to date
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
The problem is the EnsureDeleted/EnsureCreated calls take a LONG time. This feature has the same effect (e.g. correct schema, empty of data) but is MUCH quicker e.g. for a very small database the timings are:
What | First use | Second use |
---|---|---|
EnsureDeleted/EnsureCreated | 10 secs. | 10 secs. |
EnsureClean | 300 ms | 30 ms |
Respawn (see note below) | 170 ms | 35 ms |
NOTE: Respawn is a NuGet library that removes all the rows in all the tables in a database. Useful if you have already called EnsureClean
on the database and just want to remove the rows.*
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.EntityFrameworkCore (>= 3.1.4)
- Microsoft.EntityFrameworkCore.Design (>= 3.1.4)
- Microsoft.EntityFrameworkCore.Relational (>= 3.1.4)
- Microsoft.EntityFrameworkCore.SqlServer (>= 3.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
5.0.0-preview001 | 586 | 9/21/2020 | |
1.0.0-preview003 | 353 | 5/19/2020 | |
1.0.0-preview002 | 300 | 5/18/2020 | |
1.0.0-preview001 | 310 | 5/18/2020 |
Preview version for testing. This feature will be added to EfCore.TestSupport when that library is updated to EF Core 5.