Get Started
dotnet add package Shane32.EfCoreHelpers --version 1.0.0
| Product | Versions |
|---|---|
| .NET |
README
Shane32.EfCoreHelpers
This library contains a set of helper classes and methods to facilitate testing of code based on Entity Framework Core.
Sample use with SQLite EF Core database:
public class TestDbContext : AppDbContext
{
private readonly StringBuilder _logBuilder = new();
public TestDbContext(SqliteConnection connection) : base(new DbContextOptionsBuilder<AppDbContext>().UseSqlite(connection).Options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.LogToStringBuilder(_logBuilder, enableSensitiveDataLogging: true);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.PrepForSqlite();
}
public void ResetDbTrace(bool resetChangeTracker = true)
{
if (resetChangeTracker)
ChangeTracker.Clear();
_logBuilder.Clear();
}
public string DbTrace => _logBuilder.ToString();
}
Credits
Glory to Jehovah, Lord of Lords and King of Kings, creator of Heaven and Earth, who through his Son Jesus Christ, has reedemed me to become a child of God. -Shane32
Downloads by Version
Not enough data for chart
Depended On By
Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.