Ejemplo n.º 1
0
        /// <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));
        }
Ejemplo n.º 2
0
        /// <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);
        }