persistence/Persistence.IntegrationTests/EFCoreExtensions.cs

14 lines
329 B
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
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();
}
}