Example #1
0
        public UnitOfWorkFactory(IConnectionStringProvider connectionStringProvider)
        {
            if (connectionStringProvider == null)
                throw new ArgumentNullException(nameof(connectionStringProvider));

            _connectionStringProvider = connectionStringProvider;
        }
        internal DefaultStorageAccountProvider(IServiceProvider services, IConnectionStringProvider ambientConnectionStringProvider, 
            IStorageAccountParser storageAccountParser, IStorageCredentialsValidator storageCredentialsValidator)
        {
            if (services == null)
            {
                throw new ArgumentNullException("services");
            }

            if (ambientConnectionStringProvider == null)
            {
                throw new ArgumentNullException("ambientConnectionStringProvider");
            }

            if (storageAccountParser == null)
            {
                throw new ArgumentNullException("storageAccountParser");
            }

            if (storageCredentialsValidator == null)
            {
                throw new ArgumentNullException("storageCredentialsValidator");
            }

            _services = services;
            _ambientConnectionStringProvider = ambientConnectionStringProvider;
            _storageCredentialsValidator = storageCredentialsValidator;
            _storageAccountParser = storageAccountParser;
        }
 public SqlServerMessageSender(IConnectionStringProvider connectionStringProvider, IConnectionStore connectionStore, ICallbackAddressStore callbackAddressStore, ConnectionFactory sqlConnectionFactory)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.connectionStore = connectionStore;
     this.callbackAddressStore = callbackAddressStore;
     this.sqlConnectionFactory = sqlConnectionFactory;
 }
 public ApplicationDatabase(
     IConnectionStringProvider connectionStringProvider,
     IIndex<string, IDatabaseProvider> providerLookup)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.providerLookup = providerLookup;
 }
 public void SetUp()
 {
     connectionString = Substitute.For<IConnectionStringProvider>();
     connectionString.Schema = "dbo";
     applicationDatabase = Substitute.For<IApplicationDatabase>();
     detector = new DatabaseUpgradeDetector(connectionString, extensions, applicationDatabase);
 }
Example #6
0
 public IPersistenceConfigurer GetDatabaseConfiguration(IConnectionStringProvider connectionStringProvider)
 {
     return MsSqlConfiguration.MsSql2008.ConnectionString(connectionStringProvider.ConnectionString)
         .Driver<ProfiledSqlClientDriver>()
         .ShowSql()
         .DefaultSchema(connectionStringProvider.Schema);
 }
Example #7
0
 /// <inheritdoc/>
 public AppContext( IModelConfiguration the_model_configuration 
                , IConnectionStringProvider connection_string_provider )
     : base(the_model_configuration
                , connection_string_provider)
 {
     InitialiseDatabase();
 }
Example #8
0
        public DataAccessFactory(IConnectionStringProvider connectionStringProvider)
        {
            if (connectionStringProvider == null)
                throw new ArgumentNullException(nameof(connectionStringProvider));

            _connectionStringProvider = connectionStringProvider;
        }
 public SqlServerMigrationExecutor(IClock clock, IApplicationContext appContext,
     IConnectionStringProvider connectionStringProvider, IDBMigrationTablesManager migrationTablesManager, IScriptsGenerator scriptsGenerator)
 {
     this.clock = clock;
     this.appContext = appContext;
     this.connectionStringProvider = connectionStringProvider;
     this.migrationTablesManager = migrationTablesManager;
     this.scriptsGenerator = scriptsGenerator;
 }
Example #10
0
        public ScheduleDatabase(IConnectionStringProvider provider)
        {
            if (provider == null)
                throw new ArgumentNullException(nameof(provider));

            _connectionStringProvider = provider;

            //ensure sql provider available
            var x = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
        }
 public DatabaseUpgradeDetector(
     IConnectionStringProvider connectionStringProvider, 
     IEnumerable<ScriptedExtension> extensions, 
     IApplicationDatabase database,
     IIndex<string, IDatabaseProvider> currentProviderLookup)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.extensions = extensions;
     this.database = database;
     this.currentProviderLookup = currentProviderLookup;
 }
 public void SetUp()
 {
     connectionString = Substitute.For<IConnectionStringProvider>();
     connectionString.Schema = "dbo";
     connectionString.DatabaseProvider = "sql";
     applicationDatabase = Substitute.For<IApplicationDatabase>();
     databaseProviderLookup = Substitute.For<IIndex<string, IDatabaseProvider>>();
     databaseProvider = Substitute.For<IDatabaseProvider>();
     databaseProviderLookup[Arg.Any<string>()].Returns(databaseProvider);
     detector = new DatabaseUpgradeDetector(connectionString, extensions, applicationDatabase, databaseProviderLookup);
 }
        public DatabaseFactory(IConnectionStringProvider connectionStringProvider, IMappingProvider mappingProvider)
        {
            DatabaseFactoryConfigOptions options = new DatabaseFactoryConfigOptions();

            var connectionString = connectionStringProvider.GetConnectionString();
            var mappings = mappingProvider.GetMappings();

            options.Database = () => new LoggingDatabase(connectionString);
            options.PocoDataFactory = FluentMappingConfiguration.Configure(mappings);

            databaseFactory = new NPoco.DatabaseFactory(options);
        }
 public StoredProcedureExtractor(
     IConnectionStringProvider connectionStringProvider,
     IDatabaseToCodeNameConverter nameConverter,
     ITypeConverter typeConverter,
     ITypeNameBuilder typeNameBuilder,
     ISchemaElementCollectionBuilder schemaElementCollectionBuilder)
 {
     _connectionStringProvider = connectionStringProvider;
     _nameConverter = nameConverter;
     _typeConverter = typeConverter;
     _typeNameBuilder = typeNameBuilder;
     _schemaElementCollectionBuilder = schemaElementCollectionBuilder;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlCommandCacheDependencyEnlister"/> class.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="isStoredProcedure">if set to <c>true</c> [is stored procedure].</param>
        /// <param name="connectionName">Name of the connection.</param>
        /// <param name="connectionStringProvider">The <see cref="IConnectionStringProvider"/> to use 
        ///		to retrieve the connection string to connect to the underlying data store and enlist in query notifications</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="command"/> or 
        ///		<paramref name="connectionStringProvider"/> is null or empty.</exception>
        public SqlCommandCacheDependencyEnlister(string command, bool isStoredProcedure, string connectionName,
            IConnectionStringProvider connectionStringProvider)
        {
            //validate the parameters
            if (String.IsNullOrEmpty(command))
            {
                throw new ArgumentNullException("command");
            }

            if (connectionStringProvider == null)
            {
                throw new ArgumentNullException("connectionStringProvider");
            }

            this.command = command;
            this.isStoredProcedure = isStoredProcedure;
            this.connectionName = connectionName;

            connectionString = String.IsNullOrEmpty(this.connectionName) ? connectionStringProvider.GetConnectionString() : connectionStringProvider.GetConnectionString(this.connectionName);
        }
 public BuildThreadProfiles(IConnectionStringProvider mssqlconnectionStringProvider, IConnectionStringProvider mongoconnectionStringProvider)
 {
     _mssqlconnectionStringProvider = mssqlconnectionStringProvider;
     _mongoconnectionStringProvider = mongoconnectionStringProvider;
 }
Example #17
0
 public GetAggregateNameByIdQuery(IConnectionStringProvider connectionStringProvider)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.sqlHelper = new SqlHelper <GetAggregateNameByIdQuery>();
 }
Example #18
0
 public ConnectionProvider(IConnectionStringProvider connectionStringProvider)
 {
     _connectionStringProvider = connectionStringProvider;
 }
 public PersonRepository(IConnectionStringProvider connectionStringProvider)
     : base(connectionStringProvider)
 {
 }
 public $ServiceName$SqlProvider(IConnectionStringProvider connectionStringProvider)
     : base(connectionStringProvider)
 public OracleDatabaseEngine(IConnectionStringProvider provider)
 {
     _provider = provider;
 }
Example #22
0
 public ProfileRepository(IConnectionStringProvider connectionStringProvider)
 {
     _connectionStringProvider = connectionStringProvider ?? throw new ArgumentNullException(nameof(connectionStringProvider));
 }
 public AssistenceInfoRepository(IConnectionStringProvider provider)
 {
     connection = new SqlConnectionWrapper(provider.Value);
 }
 protected DatabaseStatusCheckBase(IConnectionStringProvider connectionStringProvider)
 {
     _connectionStringProvider = connectionStringProvider;
 }
 public ConnectionFactory(IConnectionStringProvider connectionStringProvider)
 {
     _connectionStringProvider = connectionStringProvider;
 }
Example #26
0
 public DemoPsqlContext(
     IConnectionStringProvider <DemoPsqlContext> connectionStringProvider,
     ITypeDiscoveryProvider <DemoPsqlContext> typeProvider)
     : base(connectionStringProvider.GetConnectionString, typeProvider.Discover)
 {
 }
 public DatabaseUpgradeDetector(IConnectionStringProvider connectionStringProvider, IEnumerable<ScriptedExtension> extensions, IApplicationDatabase database)
 {
     this.connectionStringProvider = connectionStringProvider;
     this.extensions = extensions;
     this.database = database;
 }
 public RepositoryBase(IConnectionStringProvider connectionStringProvider)
 {
     _connectionStringProvider = connectionStringProvider;
 }
 public MSSQLDatabaseEngine(IConnectionStringProvider provider)
 {
     _connectionString = provider.GetConnectionString();
 }
 public RoomQueries(IConnectionStringProvider connectionString)
 {
     _connectionString = connectionString.ConnectionString;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="connectionStringProvider"></param>
 public ImportNewUsers(IConnectionStringProvider connectionStringProvider)
 {
     _connectionStringProvider = connectionStringProvider;
 }
Example #32
0
 public IPersistenceConfigurer GetDatabaseConfiguration(IConnectionStringProvider connectionStringProvider)
 {
     return MsSqlCeConfiguration.Standard.ConnectionString(connectionStringProvider.ConnectionString)
         .Dialect<FunnelWebMsSqlCe40Dialect>().Driver<FunnelWebSqlServerCeDriver>()
         .ShowSql();
 }
Example #33
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DynamicModel" /> class.
		/// </summary>
		/// <param name="connectionStringName">Name of the connection string to load from the config file.</param>
		/// <param name="tableName">Name of the table to read the meta data for. Can be left empty, in which case the name of this type is used.</param>
		/// <param name="primaryKeyField">The primary key field. Can be left empty, in which case 'ID' is used.</param>
		/// <param name="descriptorField">The descriptor field, if the table is a lookup table. Descriptor field is the field containing the textual representation of the value
		/// in primaryKeyField.</param>
		/// <param name="primaryKeyFieldSequence">The primary key sequence to use. Specify the empty string if the PK isn't sequenced/identity. Is initialized by default with
		/// the name specified in the constant DynamicModel.DefaultSequenceName.</param>
		/// <param name="connectionStringProvider">The connection string provider to use. By default this is empty and the default provider is used which will read values from 
		/// the application's config file.</param>
		public DynamicModel(string connectionStringName, string tableName = "", string primaryKeyField = "", string descriptorField = "",
							string primaryKeyFieldSequence = DynamicModel._defaultSequenceName,
							IConnectionStringProvider connectionStringProvider = null)
		{
			this.TableName = string.IsNullOrWhiteSpace(tableName) ? this.GetType().Name : tableName;
			ProcessTableName();
			this.PrimaryKeyField = string.IsNullOrWhiteSpace(primaryKeyField) ? "ID" : primaryKeyField;
			_primaryKeyFieldSequence = primaryKeyFieldSequence == "" ? ConfigurationManager.AppSettings["default_seq"] : primaryKeyFieldSequence;
			this.DescriptorField = descriptorField;
			this.Errors = new List<string>();

			if(connectionStringProvider == null)
			{
				connectionStringProvider = new ConfigurationBasedConnectionStringProvider();
			}
			var _providerName = connectionStringProvider.GetProviderName(connectionStringName);
			if(string.IsNullOrWhiteSpace(_providerName))
			{
				_providerName = this.DbProviderFactoryName;
			}
			_factory = DbProviderFactories.GetFactory(_providerName);
			_connectionString = connectionStringProvider.GetConnectionString(connectionStringName);
		}
 private static DefaultStorageAccountProvider CreateProductUnderTest(IServiceProvider services,
     IConnectionStringProvider ambientConnectionStringProvider, IStorageAccountParser storageAccountParser)
 {
     return CreateProductUnderTest(services, ambientConnectionStringProvider, storageAccountParser, CreateDummyValidator());
 }
Example #35
0
 /// <summary>
 ///     Constructor accepts the configuration used to map the entities to a database schema
 /// and a provider that supplies the connection string
 /// </summary>
 /// <param name="the_model_configuration">
 ///     Configuration that is applied to a <see cref="DbModelBuilder"/>.  This builds the is the 
 /// map between entity framework the underlying database schema.
 /// </param>
 /// <param name="connection_string_provider">
 ///     Provider that is used to get the connection string for the context
 /// </param>
 public CompositeContext( IModelConfiguration the_model_configuration 
                , IConnectionStringProvider connection_string_provider )
     : base(connection_string_provider.connection_string)
 {
     model_configuration = Guard.IsNotNull( the_model_configuration, "the_model_configuration" );
 }
 private static DefaultStorageAccountProvider CreateProductUnderTest(IServiceProvider services,
     IConnectionStringProvider ambientConnectionStringProvider, IStorageAccountParser storageAccountParser,
     IStorageCredentialsValidator storageCredentialsValidator)
 {
     return new DefaultStorageAccountProvider(services, ambientConnectionStringProvider, storageAccountParser, storageCredentialsValidator);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlCommandCacheDependencyEnlister"/> class.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="isStoredProcedure">if set to <c>true</c> [is stored procedure].</param>
 /// <param name="connectionStringProvider">The <see cref="IConnectionStringProvider"/> to use 
 ///		to retrieve the connection string to connect to the underlying data store and enlist in query notifications</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="command"/> or 
 ///		<paramref name="connectionStringProvider"/> is null or empty.</exception>
 public SqlCommandCacheDependencyEnlister(string command, bool isStoredProcedure,
     IConnectionStringProvider connectionStringProvider)
     : this(command, isStoredProcedure, null, null, connectionStringProvider)
 {
 }
 public Configurator(IConnectionStringProvider connectionStringProvider, IConnectionStringValidator connectionStringValidator)
 {
     _ConnectionStringProvider  = connectionStringProvider ?? new EumInstallClient();
     _ConnectionStringValidator = connectionStringValidator ?? new ConnectionStringValidator();
 }