public async Task UpdateData(int tableId, Row updatingRow)
        {
            var tableMeta = _dbContext.TableInfos.Where(x => x.Id == tableId)
                            .Include(x => x.FieldInfos).First();

            if (tableMeta == null)
            {
                throw new TableNotFoundException(tableId);
            }

            var table = _mapper.Map <Table>(tableMeta);

            var updateQuery = _commandDirector.BuildUpdateCommand(table, updatingRow);

            await _dbContext.ExcecuteSqlQueryAsync(updateQuery);
        }
예제 #2
0
        public void TestCreateUpdateCommandWithCondition()
        {
            var sqlQuery = _crudCommandDirector.BuildUpdateCommand(_table, _table.Rows.FirstOrDefault());

            Assert.Equal("UPDATE data.Car SET gid = '0', Brand = 'Audi', Cost = '1000' WHERE gid = '0'", sqlQuery);
        }