コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: DataAccessLayer.cs プロジェクト: KirillJab/Labs
        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();
            }
        }
コード例 #3
0
ファイル: DataAccessLayer.cs プロジェクト: Kim368/ISP
        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");
            }
        }