public virtual async Task Crud_Update()
 {
     using (var tempTable = await DataTestHelpers.CreateAutoIncrementTable(DataProvider))
         using (var queryResult = await DataProvider.ExecuteReaderAsync(
                    new CompositeQueryExpression(
                        QueryExpression.Insert(
                            tempTable.TableName,
                            new[] { "Data" },
                            new object[] { 1 }
                            ),
                        QueryExpression.Update(
                            QueryExpression.Table(tempTable.TableName),
                            QueryExpression.Compare(QueryExpression.Column("Id"), ComparisonOperator.AreEqual, QueryExpression.Value(1)),
                            QueryExpression.Assign(QueryExpression.Column("Data"), QueryExpression.Value(5))
                            ),
                        QueryExpression.Select(
                            new[] { QueryExpression.Column("Data") },
                            from: QueryExpression.Table(tempTable.TableName),
                            where : QueryExpression.Compare(QueryExpression.Column("Id"), ComparisonOperator.AreEqual, QueryExpression.Value(1))
                            )
                        )))
         {
             Assert.IsTrue(queryResult.HasRows);
             Assert.IsTrue(await queryResult.ReadAsync());
             Assert.AreEqual(5, queryResult.GetInt32(0));
         }
 }
Exemplo n.º 2
0
 private IEnumerable <AssignColumnExpression> GetAssignColumnExpressions()
 {
     foreach (var fieldAssignment in _fieldAssignments)
     {
         yield return(QueryExpression.Assign(fieldAssignment.Column.ColumnName, fieldAssignment.ValueExpression));
     }
 }