Exemple #1
0
 public void InsertGetUpdateDeleteWithExplicitKeyNamedId()
 {
     using (var connection = GetOpenConnection())
     {
         const int id = 42;
         var       o2 = new ObjectZ {
             Id = id, Name = "Foo"
         };
         connection.Insert(o2);
         var list2 = connection.Query <ObjectZ>("select * from ObjectZ").ToList();
         Assert.Single(list2);
         o2 = connection.Get <ObjectZ>(id);
         Assert.Equal(o2.Id, id);
     }
 }
 public void InsertGetUpdateDeleteWithExplicitKeyNamedId()
 {
     using (var connection = GetOpenConnection())
     {
         const int id = 42;
         var       o2 = new ObjectZ {
             Id = id, Name = "Foo"
         };
         connection.Insert(o2);
         var list2 = connection.Query <ObjectZ>("select * from ObjectZ").ToList();
         list2.Count.IsEqualTo(1);
         o2 = connection.Get <ObjectZ>(id);
         o2.Id.IsEqualTo(id);
         //o2.Name = "Bar";
         //connection.Update(o2);
         //o2 = connection.Get<ObjectY>(id);
         //o2.Name.IsEqualTo("Bar");
         //connection.Delete(o2);
         //o2 = connection.Get<ObjectY>(id);
         //o2.IsNull();
     }
 }
Exemple #3
0
 public void InsertGetUpdateDeleteWithExplicitKeyNamedId()
 {
     using (var connection = GetOpenConnection())
     {
         const int id = 42;
         var o2 = new ObjectZ { Id = id, Name = "Foo" };
         connection.Insert(o2);
         var list2 = connection.Query<ObjectZ>("select * from ObjectZ").ToList();
         list2.Count.IsEqualTo(1);
         o2 = connection.Get<ObjectZ>(id);
         o2.Id.IsEqualTo(id);
         //o2.Name = "Bar";
         //connection.Update(o2);
         //o2 = connection.Get<ObjectY>(id);
         //o2.Name.IsEqualTo("Bar");
         //connection.Delete(o2);
         //o2 = connection.Get<ObjectY>(id);
         //o2.IsNull();
     }
 }