/// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sqlSettings">MsSql settings.</param>
 /// <param name="resourceReaderHelper">The <see cref="IResourceReaderHelper"/> instance.</param>
 /// <param name="loggerFactory">The <see cref="ICommonLoggerFactory"/> instance.</param>
 /// <exception cref="ArgumentNullException"><paramref name="sqlSettings"/> is <see langword="null" />.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="resourceReaderHelper"/> is <see langword="null" />.</exception>
 public SqlServerInstaller(MsSqlSettings sqlSettings, IResourceReaderHelper resourceReaderHelper, ICommonLoggerFactory loggerFactory) : base(loggerFactory)
 {
     if (sqlSettings == null)
     {
         throw new ArgumentNullException("sqlSettings");
     }
     if (resourceReaderHelper == null)
     {
         throw new ArgumentNullException("resourceReaderHelper");
     }
     this.sqlSettings          = sqlSettings;
     this.resourceReaderHelper = resourceReaderHelper;
 }
Exemple #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="sqlSettings">MsSql settings including connection string and different timeouts.</param>
        /// <param name="sqlServerInstaller">The <see cref="ISqlServerInstaller"/> instance.</param>
        /// <param name="loggerFactory">The <see cref="ICommonLoggerFactory"/> instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="sqlSettings"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="sqlServerInstaller"/> is <see langword="null" />.</exception>
        public SqlConnectionFactory(MsSqlSettings sqlSettings, ISqlServerInstaller sqlServerInstaller, ICommonLoggerFactory loggerFactory)
            : base(loggerFactory)
        {
            if (sqlSettings == null)
            {
                throw new ArgumentNullException("sqlSettings");
            }
            if (sqlServerInstaller == null)
            {
                throw new ArgumentNullException("sqlServerInstaller");
            }

            this.sqlSettings = sqlSettings;

            using (IDbConnection connection = CreateDatabaseAndConnection())
            {
                sqlServerInstaller.Install(connection);
            }
        }