Exemplo n.º 1
0
        public Task DeleteAsync <TEntity>(TEntity entity)
            where TEntity : ITableDto
        {
            var query = queryFactory.GetDeleteQuery <TEntity>();

            return(uk.DbConnection.ExecuteAsync(query, entity, uk.DbTransaction));
        }
Exemplo n.º 2
0
        public Task DeleteAsync <TEntity>(TEntity entity)
            where TEntity : ITableDto
        {
            var query = queryFactory.GetDeleteQuery <TEntity>();

            logger.LogDebug("DeleteAsync query:{query} entity:{@entity}", query, entity);
            return(uk.DbConnection.ExecuteAsync(query, entity, uk.DbTransaction));
        }
        public Task DeleteAsync <TEntity>(TEntity entity)
            where TEntity : class
        {
            var query = queryFactory.GetDeleteQuery <TEntity>();

            logger.LogDebug("DeleteAsync query:{query} entity:{@entity}", query, entity);
            return(Conn.ExecuteAsync(query, entity, Tran));
        }
Exemplo n.º 4
0
        public Task DeleteAsync(Guid id)
        {
            // var sql = $"DELETE " +
            //     $"FROM {ProcessHistoryDto.TableName} " +
            //     $"WHERE {nameof(ProcessHistoryDto.Id)} = @ProcessHistoryId";

            var sql = tableQuery.GetDeleteQuery <ProcessHistoryDto>();

            DbConnection.Execute(sql, new { Id = id }, DbTransaction);

            return(Task.CompletedTask);
        }
Exemplo n.º 5
0
        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);
        }