Exemplo n.º 1
0
 private static void IsValidInsert(IdentityAndNotMappedTest inserted, IdentityAndNotMappedTest toBeInserted)
 {
     inserted.IdKey.Should().BePositive();
     inserted.Ignored.Should().NotBe(toBeInserted.Ignored);
     inserted.Name.Should().Be(toBeInserted.Name);
     inserted.TestSublass.Should().BeNull();
 }
Exemplo n.º 2
0
        public async Task InsertSingleAsync()
        {
            var item = new IdentityAndNotMappedTest {
                Name = Guid.NewGuid().ToString(), Ignored = 2
            };

            using (var connection = this.GetConnection())
            {
                connection.Open();
                var inserted = (await connection.BulkInsertAndSelectAsync(new List <IdentityAndNotMappedTest> {
                    item
                })).First();
                IsValidInsert(inserted, item);
            }
        }
Exemplo n.º 3
0
        public void InsertSingleTransaction()
        {
            var item = new IdentityAndNotMappedTest {
                Name = Guid.NewGuid().ToString(), Ignored = 2
            };

            using (var connection = this.GetConnection())
            {
                connection.Open();
                using (var transaction = connection.BeginTransaction())
                {
                    var inserted = connection.BulkInsertAndSelect(new List <IdentityAndNotMappedTest> {
                        item
                    }, transaction).First();
                    IsValidInsert(inserted, item);
                }
            }
        }