using System; using Core.Common.Base.Storage; using Core.Common.Utils; using Core.Common.Utils.Builders; namespace Application.Ringtoets.Storage { /// /// Base class to interact with file based database storage. /// public abstract class StorageToDatabaseFile { protected string FilePath; protected string ConnectionString; /// /// Validates the . /// /// Path to storage database file. /// is invalid. protected virtual void Connect(string filePath) { FileUtils.ValidateFilePath(filePath); FilePath = filePath; } /// /// Throws a configured instance of . /// /// The critical error message. /// Optional: exception that caused this exception to be thrown. /// Returns a new protected UpdateStorageException CreateUpdateStorageException(string errorMessage, Exception innerException = null) { var message = new FileWriterErrorMessageBuilder(FilePath).Build(errorMessage); return new UpdateStorageException(message, innerException); } } }