/// <summary> /// Does a logical negation of the operator. /// </summary> /// <returns>The resulting operator.</returns> public IOperator LogicallyNegate() { if (Operator == ExpressionType.Not) { return(InternalOperator); } InternalOperator = InternalOperator.LogicallyNegate(); return(this); }
/// <summary> /// Optimizes the operator based on the mapping source. /// </summary> /// <param name="mappingSource">The mapping source.</param> /// <returns></returns> public IOperator Optimize(IMappingSource mappingSource) { InternalOperator = InternalOperator.Optimize(mappingSource); if (InternalOperator is null) { return(null !); } return(Operator == ExpressionType.Not ? InternalOperator.LogicallyNegate() : (this)); }
/// <summary> /// Optimizes the operator based on the mapping source. /// </summary> /// <param name="mappingSource">The mapping source.</param> public IOperator Optimize(IMappingSource mappingSource) { if (InternalOperator is null) { return(this); } var IsValid = mappingSource.GetChildMappings(ObjectType).Any(); InternalOperator = IsValid ? InternalOperator.Optimize(mappingSource) : null; if (InternalOperator?.TypeCode != typeof(bool)) { InternalOperator = null; } return(this); }
/// <summary> /// Copies this instance. /// </summary> /// <returns>A copy of this instance.</returns> public IOperator Copy() => new UnaryOperator(InternalOperator.Copy(), Operator, TypeCode);
/// <summary> /// Sets the column names. /// </summary> /// <param name="mappingSource">The mapping source.</param> /// <param name="mapping">The mapping.</param> public void SetColumnNames(IMappingSource mappingSource, IMapping mapping) => InternalOperator?.SetColumnNames(mappingSource, mapping);
/// <summary> /// Gets the parameters associated with the operator. /// </summary> /// <returns>A list of parameters associated with the operator.</returns> public List <IParameter> GetParameters() => InternalOperator.GetParameters();
/// <summary> /// Does a logical negation of the operator. /// </summary> /// <returns>The resulting operator.</returns> public IOperator LogicallyNegate() { InternalOperator = InternalOperator?.LogicallyNegate(); return(this); }
/// <summary> /// Gets the parameters associated with the operator. /// </summary> /// <returns>A list of parameters associated with the operator.</returns> public List <IParameter> GetParameters() => InternalOperator is null ? new List <IParameter>() : InternalOperator.GetParameters();
/// <summary> /// Copies this instance. /// </summary> /// <returns>A copy of this instance.</returns> public IOperator Copy() => new WhereClause <TObject>(InternalOperator?.Copy());