27 lines
809 B
C#
27 lines
809 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using NDB.Infrastructure.DatabaseMigration.DbContexts;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NDB.Infrastructure.DatabaseMigration.Repositories
|
|
{
|
|
internal class MigrationRepository : IMigrationRepository
|
|
{
|
|
private readonly MigrationDbContext _dbContext;
|
|
|
|
public MigrationRepository(MigrationDbContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
public async Task ExecuteSqlRaw(string commandText)
|
|
{
|
|
using (var command = _dbContext.Database.GetDbConnection().CreateCommand())
|
|
{
|
|
command.CommandText = commandText;
|
|
await _dbContext.Database.OpenConnectionAsync();
|
|
await command.ExecuteNonQueryAsync();
|
|
}
|
|
}
|
|
}
|
|
}
|