public FakeSqlDatabaseContext(IConnectionStringProvider connectionStringProvider, IDatabaseConnectionProvider databaseConnectionProvider, IDatabaseTransactionProvider databaseTransactionProvider, IStatementBuildProvider sqlStatementBuildProvider, IDataModelPopulateProvider dataModelPopulateProvider) : base(connectionStringProvider, databaseConnectionProvider, databaseTransactionProvider, sqlStatementBuildProvider, dataModelPopulateProvider) { }
/// <summary> /// Sql Database Context /// </summary> /// <param name="connectionStringProvider">Connection String Provider</param> /// <param name="databaseConnectionProvider">Database Connection Provider</param> /// <param name="databaseTransactionProvider">Database Transaction Provider</param> /// <param name="sqlStatementBuildProvider">SQL Statement Build Provider</param> /// <param name="dataModelPopulateProvider">Data Model Populate Provider</param> public SqlDatabaseContext(IConnectionStringProvider connectionStringProvider, IDatabaseConnectionProvider databaseConnectionProvider, IDatabaseTransactionProvider databaseTransactionProvider, IStatementBuildProvider sqlStatementBuildProvider, IDataModelPopulateProvider dataModelPopulateProvider) : base(connectionStringProvider, databaseConnectionProvider, databaseTransactionProvider) { _sqlStatementBuildProvider = sqlStatementBuildProvider ?? throw new ArgumentNullException(nameof(sqlStatementBuildProvider)); _dataModelPopulateProvider = dataModelPopulateProvider ?? throw new ArgumentNullException(nameof(dataModelPopulateProvider)); }
/// <inheritdoc /> public IDatabaseContextBuilder WithDataModelPopulateProvider(IDataModelPopulateProvider dataModelPopulateProvider) { if (dataModelPopulateProvider == null) { throw new ArgumentNullException(nameof(dataModelPopulateProvider)); } DataModelPopulateProvider = dataModelPopulateProvider; return(this); }
private IDatabaseContext CreateDatabaseContext(IConnectionStringProvider connectionStringProvider = null, IDatabaseConnectionProvider databaseConnectionProvider = null, IDatabaseTransactionProvider databaseTransactionProvider = null, IStatementBuildProvider sqlStatementBuildProvider = null, IDataModelPopulateProvider dataModelPopulateProvider = null, bool useFalseContext = false) { connectionStringProvider ??= Substitute.For <IConnectionStringProvider>(); databaseConnectionProvider ??= Substitute.For <IDatabaseConnectionProvider>(); databaseTransactionProvider ??= Substitute.For <IDatabaseTransactionProvider>(); sqlStatementBuildProvider ??= Substitute.For <IStatementBuildProvider>(); dataModelPopulateProvider ??= new SqlDataModelPopulateProvider(); return(useFalseContext ? new FakeSqlDatabaseContext(connectionStringProvider, databaseConnectionProvider, databaseTransactionProvider, sqlStatementBuildProvider, dataModelPopulateProvider) : new SqlDatabaseContext(connectionStringProvider, databaseConnectionProvider, databaseTransactionProvider, sqlStatementBuildProvider, dataModelPopulateProvider)); }