Пример #1
0
        /// <summary>
        /// Creates a command which will delete an entity by usings it's primary key.
        /// </summary>
        public static CommandDefinition MakeDeleteCommand <TEntity>(
            object entity,
            IDbTransaction transaction,
            IDialect dialect,
            int?commandTimeout,
            MicroCRUDConfig config,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.NotNull(entity, nameof(entity));
            dialect = dialect ?? config.Dialect;

            var tableSchema = TableSchemaFactory.GetTableSchema(typeof(TEntity), dialect, config.SchemaFactory);
            var sql         = dialect.MakeDeleteByPrimaryKeyStatement(tableSchema);

            return(MakeCommandDefinition(sql, entity, transaction, commandTimeout, cancellationToken));
        }