/// <summary> /// Clearing data from database /// </summary> private static void ClearDatabase() { LogHelper.SubmitLog("Cleaning database", LogType.Comment); DataAccessRepository.ClearData(); LogHelper.SubmitLog("All data cleaned from database", LogType.Info); LogHelper.SubmitLog("...........................................", LogType.Comment); }
/// <summary> /// Saves (inserts or updates) entity in DB. /// </summary> /// <param name="entity">Entity</param> public void Save(object entity) { if (entity == null) { throw new ArgumentNullException("entity"); } ExecuteInUnitOfWork(() => DataAccessRepository.Save(entity)); }
/// <summary> /// Gets entity by its identifier. /// Makes direct request to DB when it's called. Return null if entity doesn't exist. /// </summary> /// <typeparam name="T">Type of entity</typeparam> /// <param name="id">Identifier of entity</param> /// <returns>Entity of T type</returns> public T Get <T>(object id) { if (id == null) { throw new ArgumentNullException("id"); } return(ExecuteInUnitOfWork(() => DataAccessRepository.Get <T>(id))); }
public IntegrationTests() { connectionFactory = new ConfiguredSqlConnectionFactory("dev"); var infoRepo = new SchemaDataAccess(connectionFactory); var config = new RepositoryConfiguration { Table = new Identifier("dbo", "REGION") }; repo = new DataAccessRepository <Region>(config, connectionFactory, infoRepo); }
public DataAccessServices() { this._dataAccessRepository = new DataAccessRepository(); }