public DataAccessLayer(Options.ConnectionOptions options) { string connectionString = $"Data Source={options.DataSource}; Initial Catalog={options.InitialCatalog}; Integrated Security={options.IntegratedSecurity}"; using (TransactionScope scope = new TransactionScope()) { connection = new SqlConnection(connectionString); connection.Open(); scope.Complete(); } }
public DataAccessLayer(Options.ConnectionOptions options, IParser parser) { string connectionString = $"Data Source={options.DataSource}; Database={options.Database}; User={options.User}; Password={options.Password}; Integrated Security=False; MultipleActiveResultSets=True"; this.parser = parser; using (TransactionScope scope = new TransactionScope()) { connection = new SqlConnection(connectionString); connection.Open(); scope.Complete(); } }
public DataAccessLayer(Options.ConnectionOptions options) { string connectionStr = $"Data Source={options.DataSource};" + $" Database={options.DataBase}; " + $"Integrated Security={options.IntegratedSecurity};" + $"Pooling={options.Pooling}"; using (TransactionScope scope = new TransactionScope()) { connection = new SqlConnection(connectionStr); connection.Open(); scope.Complete(); log.AddToLog("SqlConnection: OK\n"); } }