public DeleteController(Operations.Delete delete) { if (delete == null) { throw new ArgumentNullException(nameof(delete)); } Delete = delete; }
/// <summary> /// Initializes a new instance of the <see cref="OKHOSTING.ORM.UI.DeleteController"/> class. /// </summary> /// <summary xml:lang="es"> /// Inicializa una nueva instancia de la clase OKHOSTING.ORM.UI.DeleteController, con el objeto especificado. /// </summary> public DeleteController(object instance) { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } Delete = new Operations.Delete(); Delete.DataType = instance.GetType(); Delete.Where.Add(new Filters.PrimaryKeyFilter(instance)); }
public DeleteController(IEnumerable<object> instances) { if (instances == null || !instances.Any()) { throw new ArgumentNullException(nameof(instances)); } Delete = new Operations.Delete(); Delete.DataType = instances.First().GetType(); Filters.OrFilter or = new Filters.OrFilter(); foreach (object instance in instances) { or.InnerFilters.Add(new Filters.PrimaryKeyFilter(instance)); } Delete.Where.Add(or); }