public IExecuteSql Where <T>(T anonymousCriteria, Expression <Func <T, bool> > criteria = null) where T : class { anonymousCriteria.MustNotBeNull(); if (criteria != null) { _builder.Where(criteria); return(this); } foreach (var cv in anonymousCriteria.ValuesToDictionary()) { _builder.WriteEqualityCriteria(cv.Key, cv.Value); } return(this); }
public void set_title_where_id() { _builder.Set(p => p.Title, "Fred").Set("IsActive", false); _builder.Where(p => p.Id == 12); Assert.Equal("update [Posts] set [Title]=@0, [IsActive]=@1 where ([Id] = 12)", _builder.GetSql()); }