using System;
using System.Data.Entity.Infrastructure;
using Application.Ringtoets.Storage.Builders;
using Application.Ringtoets.Storage.Exceptions;
namespace Application.Ringtoets.Storage
{
///
/// Base class to interact with file based database storage.
///
public abstract class StorageToFile
{
private readonly string filePath;
protected string ConnectionString;
///
/// Creates a new instance of .
///
///
protected StorageToFile(string databaseFilePath)
{
filePath = databaseFilePath;
}
///
/// Throws a configured instance of .
///
/// The critical error message.
/// Optional: exception that caused this exception to be thrown.
/// Returns a new
protected UpdateDatabaseException CreateUpdateDatabaseException(string errorMessage, Exception innerException = null)
{
var message = new FileWriterErrorMessageBuilder(filePath).Build(errorMessage);
return new UpdateDatabaseException(message, innerException);
}
}
}