MccSoft.IntegreSql.EF
0.8.1
See the version list below for details.
dotnet add package MccSoft.IntegreSql.EF --version 0.8.1
NuGet\Install-Package MccSoft.IntegreSql.EF -Version 0.8.1
<PackageReference Include="MccSoft.IntegreSql.EF" Version="0.8.1" />
paket add MccSoft.IntegreSql.EF --version 0.8.1
#r "nuget: MccSoft.IntegreSql.EF, 0.8.1"
// Install MccSoft.IntegreSql.EF as a Cake Addin #addin nuget:?package=MccSoft.IntegreSql.EF&version=0.8.1 // Install MccSoft.IntegreSql.EF as a Cake Tool #tool nuget:?package=MccSoft.IntegreSql.EF&version=0.8.1
IntegreSql.EF
Provides an infrastructure to easily write FAST integration and unit tests using REAL databases in ASP.Net Core. Powered by the greatest IntegreSQL.
Intro
I assume, you are using EFCore and PostgreSQL in your project. If you don't, you don't need the library, so stop reading now 😃
There are few approaches for 'mocking' the database in autotests.
- Use Repository pattern and just mock the repository layer in tests. According to my personal experience this is quite outdated and noone actually does this anymore 😃
- The proven approach now is to use EFCore with different database providers.
- InMemory Database Provider. Fast, maintained by EF, but is not nearly similar to PostgreSQL, as it's even non-relational. There are A LOT of differences compared to real DB, so going this route is not recommended and discouraged even by Microsoft:
While in-memory can work for simple, constrained query scenarios, it is highly limited and we discourage its use.
- Using Sqlite with filesystem DB or in-memory mode. Works ok, if you don't use any of PostgreSQL specifics (like jsonb or specific functions). Easy to set up and fast. I could recommend it (and this library supports it 😃), considering the mentioned limitations.
- Using real PostgreSQL instance. Gives the best confidence that your code works and has all features of PostgreSQL 😃 Unfortunately, it comes at a cost of being quite slow (database creation takes seconds and so does data seeding).
- InMemory Database Provider. Fast, maintained by EF, but is not nearly similar to PostgreSQL, as it's even non-relational. There are A LOT of differences compared to real DB, so going this route is not recommended and discouraged even by Microsoft:
IntegreSQL.EF allows you to use real PostgreSQL instances, and keep the timing under 100ms per test (again, thanks to the IntegreSQL project).
How to use it
Check out example IntegrationTest (i.e using in-memory TestServer and doing API calls)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Microsoft.EntityFrameworkCore.Sqlite (>= 6.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
- Npgsql (>= 6.0.3)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 6.0.3)
- System.Text.Json (>= 6.0.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 |
---|---|---|
0.11.2 | 2,642 | 9/20/2024 |
0.11.1 | 278 | 9/17/2024 |
0.10.3 | 5,295 | 3/8/2024 |
0.10.2 | 131 | 3/6/2024 |
0.10.1 | 135 | 3/6/2024 |
0.9.1 | 139 | 3/5/2024 |
0.8.16 | 11,530 | 2/2/2023 |
0.8.15 | 1,568 | 12/21/2022 |
0.8.14 | 1,923 | 11/16/2022 |
0.8.12 | 634 | 10/25/2022 |
0.8.11 | 376 | 10/25/2022 |
0.8.10 | 2,060 | 8/21/2022 |
0.8.9 | 2,498 | 5/24/2022 |
0.8.8 | 787 | 5/23/2022 |
0.8.7 | 835 | 5/18/2022 |
0.8.6 | 485 | 5/14/2022 |
0.8.5 | 445 | 5/14/2022 |
0.8.4 | 415 | 5/14/2022 |
0.8.3 | 447 | 5/13/2022 |
0.8.2 | 434 | 5/12/2022 |
0.8.1 | 414 | 5/12/2022 |