persistence/Persistence.IntegrationTests/EFCoreExtensions.cs

15 lines
363 B
C#

using Microsoft.EntityFrameworkCore;
using Persistence.Database.Model;
namespace Persistence.IntegrationTests;
public static class EFCoreExtensions
{
public static void CleanupDbSet<T>(this DbContext dbContext)
where T : class
{
var dbset = dbContext.Set<T>();
dbset.RemoveRange(dbset);
dbContext.SaveChanges();
}
}