Wolfgang.DbContextBuilder-Core-EF6 0.3.3

dotnet add package Wolfgang.DbContextBuilder-Core-EF6 --version 0.3.3
                    
NuGet\Install-Package Wolfgang.DbContextBuilder-Core-EF6 -Version 0.3.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wolfgang.DbContextBuilder-Core-EF6" Version="0.3.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wolfgang.DbContextBuilder-Core-EF6" Version="0.3.3" />
                    
Directory.Packages.props
<PackageReference Include="Wolfgang.DbContextBuilder-Core-EF6" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Wolfgang.DbContextBuilder-Core-EF6 --version 0.3.3
                    
#r "nuget: Wolfgang.DbContextBuilder-Core-EF6, 0.3.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Wolfgang.DbContextBuilder-Core-EF6@0.3.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Wolfgang.DbContextBuilder-Core-EF6&version=0.3.3
                    
Install as a Cake Addin
#tool nuget:?package=Wolfgang.DbContextBuilder-Core-EF6&version=0.3.3
                    
Install as a Cake Tool

DbContextBuilder

Uses the Builder pattern to create Entity Framework Core and classic DbContext instances using an in-memory database for testing purposes. With DbContextBuilder, you can easily set up a DbContext with predefined data, making it ideal for unit tests and integration tests without having to rely on an actual database whose data can be changed or deleted over time

Features

  • Create DbContext instances with an in-memory database. By default, DbContextBuilder uses the Sqlite in-memory database provider. However, you can use other databases by passing in your own DbConnection.

  • Add your own data to the DbContext using the SeedWith<T> method

  • Easily add random data using the SeedWithRandom<T> method. This method will create random data in your database to simulate real-world scenarios where a database will have more than just the data you seed with.

Installation

You can install the DbContextBuilder package via NuGet. Run the following command in the Package Manager Console:

Install-Package Wolfgang.DbContextBuilder

Usage

Here's a simple example of how to use DbContextBuilder to create a DbContext with seeded data:

// Create a DbContext with seeded random data and your test data
var context = new DbContextBuilder<YourDbContext>()
	// Seed with 10 random entities
	.SeedWithRandom<YourEntity>(10)		
	
	// Seed with specific data
	.SeedWith
	(
		new YourEntity
		{
			Id = 1,
			Name = "Test Entity"
		}
	)							
	
	// Seed with 5 random entities	
	.SeedWithRandom<YourEntity>(5)		
	
	// Build the DbContext instance
	.Build();							

// Use the context in your tests
var sut = new YourService(context);

Product 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.3.3 469 12/10/2025
0.3.2 212 10/30/2025
0.3.1 204 10/29/2025
0.3.0 212 10/29/2025