public void update_table_poco() { var rez = _db.Update <Post>(new { Title = "alt title", TopicId = 3, Id = 2 }); Assert.Equal(1, rez); var p = _db.Get <Post>(2); Assert.Equal("alt title", p.Title); Assert.Equal(3, p.TopicId); }
public void get_entity_by_criteria() { var post = new Post() { Title = "title12" }; var id = _db.Insert(post).InsertedId <int>(); var ent = _db.Get <Post>(p => p.Id == id); Assert.Equal("title12", ent.Title); ent = _db.Get <Post>(p => p.Id == 280); Assert.Null(ent); }
public override void FetchSingleEntity(BenchmarksContainer bc) { bc.Add(id => { _db.Get <sfPosts>(5); }, "SqlFu Get"); bc.Add(id => { _db.QuerySingle <sfPosts>("select * from sfPosts where id=@0", 5); }, "SqlFu FirstOrDefault"); }
private void GenerateSql() { for (var i = 0; i < 1; i++) { //var builder = new ExpressionSqlBuilder<Pool>(db.GetProvider().BuilderHelper); //builder // .WriteSelect() // .WriteSelectAllColumns() // .WriteFrom() // .Where(d=>d.Id==i); // Console.WriteLine(builder.ToString()); _db.Get <Pool>(d => d.Id == i); } }