Esempio n. 1
0
        public async Task InsertSingleAsync()
        {
            var item = new ColumnIsDifferent {
                Name = Guid.NewGuid().ToString(), LongCol = 1000, IntCol = 1
            };

            using (var connection = this.GetConnection())
            {
                connection.Open();
                var inserted = (await connection.BulkInsertAndSelectAsync(new List <ColumnIsDifferent> {
                    item
                })).First();
                IsValidInsert(inserted, item);
            }
        }
Esempio n. 2
0
        public void InsertSingleTransaction()
        {
            var item = new ColumnIsDifferent {
                Name = Guid.NewGuid().ToString(), LongCol = 1000, IntCol = 1
            };

            using (var connection = this.GetConnection())
            {
                connection.Open();
                using (var transaction = connection.BeginTransaction())
                {
                    var inserted = connection.BulkInsertAndSelect(new List <ColumnIsDifferent> {
                        item
                    }, transaction).First();
                    IsValidInsert(inserted, item);
                }
            }
        }
Esempio n. 3
0
 private static void IsValidInsert(ColumnIsDifferent inserted, ColumnIsDifferent toBeInserted)
 {
     inserted.IdKey.Should().BePositive();
     inserted.Name.Should().Be(toBeInserted.Name);
 }