public string ConvertCommonOperations(MemberExpression expression)
        {
            PropertyInfo property = expression.Member as PropertyInfo;

            if (property != null && property.PropertyType == typeof(bool))
            {
                return(WmiQueryUtility.ConvertBinaryBooleanToSQL(expression.Member, true));
            }

            return(WmiQueryUtility.ConvertMemberToSql(expression.Member));
        }
Exemplo n.º 2
0
        public override string Visit(BinaryExpression expression)
        {
            string where = null;

            where += Context.Visit(expression.Left);
            where += WmiQueryUtility.ConvertBinaryTypeToSql(expression.NodeType);

            if (expression.Right.Type == typeof(String))
            {
                where += $"'{Context.Visit(expression.Right)}'";
            }
            else
            {
                where += Context.Visit(expression.Right);
            }

            return(where);
        }
 public static string ConvertBinaryBooleanToSQL(MemberInfo memberInfo, bool value)
 => $"{WmiQueryUtility.ConvertMemberToSql(memberInfo)} = {value}";