public Task <int> UpdateAsync <TEntity>(string whereClause, object param) where TEntity : ITableDto { var query = queryFactory.GetUpdateQuery <TEntity>(whereClause); return(uk.DbConnection.ExecuteAsync(query, param, uk.DbTransaction)); }
public Task <int> UpdateAsync <TEntity>(string whereClause, object param, IEnumerable <string> fieldsToSet = null) where TEntity : ITableDto { var query = queryFactory.GetUpdateQuery <TEntity>(whereClause, fieldsToSet); logger.LogDebug("UpdateAsync query:{query} whereClause:{whereClause} param:{@param}", query, whereClause, param); return(uk.DbConnection.ExecuteAsync(query, param, uk.DbTransaction)); }
public void Test_table_config_builder() { var tablesFactory = new TableQueryFactory(Dialect.SQLite); tablesFactory.ConfigureTable <ProcessHistoryModel>("ProcessHistory", cfgTbl => { ProcessHistoryModel dto = cfgTbl.Table; cfgTbl.AddColumn(nameof(dto.Id), "ProcessHistoryId", false, true); cfgTbl.AddColumn(nameof(dto.StartProcessDateTime)); cfgTbl.AddColumn(nameof(dto.FinishProcessDateTime)); cfgTbl.AddColumn(nameof(dto.ProductSpecificationCode)); }); tablesFactory.ConfigureTable <InterruptionHistoryModel>("InterruptionHistory", cfgTbl => { InterruptionHistoryModel dto = cfgTbl.Table; cfgTbl.AddColumn(nameof(dto.Id), null, true, true); cfgTbl.AddColumn(nameof(dto.ProcessHistoryId)); cfgTbl.AddColumn(nameof(dto.StartDateTime)); cfgTbl.AddColumn(nameof(dto.EndDateTime)); }); tablesFactory.ConfigureTable <ProductSpecificationModel>("ProductSpecification", cfgTbl => { cfgTbl.AddColumn(c => c.Id, null, false, false); cfgTbl.AddColumn(c => c.Code); cfgTbl.AddColumn(c => c.StandarDuration); cfgTbl.AddColumn(c => c.CreatedAt, c => { c.IgnoreInsert = true; c.IgnoreUpdate = true; }); }); var res = tablesFactory.GetPagedListQuery <ProcessHistoryModel>(); res = tablesFactory.GetSingleQuery <ProcessHistoryModel>(); res = tablesFactory.GetDeleteQuery <ProcessHistoryModel>(); res = tablesFactory.GetUpdateQuery <ProcessHistoryModel>(); res = tablesFactory.GetUpdateQuery <ProductSpecificationModel>(); bool isIdentity; var res2 = tablesFactory.GetInsertQuery <ProcessHistoryModel>(); Console.WriteLine(res); }