コード例 #1
0
ファイル: MemberVisitor.cs プロジェクト: gmcclelland90/FAP
        /// <summary>
        /// Convert common operation for an Member
        /// </summary>
        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));
        }
コード例 #2
0
        /// <summary>
        /// This is cheating, the most ideal way of converting expression trees is to convert
        /// the LINQ syntax first to a custom tree and parse that, and covert the standalone
        /// boolean member expressions to binary expressions. Because of a LINQ defect
        /// the
        /// </summary>
        private string HandleNotNodeType(UnaryExpression expression)
        {
            MemberExpression member = expression.Operand as MemberExpression;

            if (member != null)
            {
                PropertyInfo property = member.Member as PropertyInfo;
                if (property != null && property.PropertyType == typeof(Boolean))
                {
                    return(WmiQueryUtility.ConvertBinaryBooleanToSQL(member.Member, false));
                }
            }
            return(Context.Visit(expression.Operand));
        }
コード例 #3
0
ファイル: BinaryVisitor.cs プロジェクト: gmcclelland90/FAP
        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 += String.Format("'{0}'", Context.Visit(expression.Right));
            }
            else
            {
                where += Context.Visit(expression.Right);
            }

            return(where);
        }
コード例 #4
0
ファイル: WmiQueryUtility.cs プロジェクト: gmcclelland90/FAP
 /// <summary>
 /// Converts an binary where boolean expression to an SQL syntax
 /// </summary>
 public static string ConvertBinaryBooleanToSQL(MemberInfo memberInfo, bool value)
 {
     return(string.Format("{0} = {1}", WmiQueryUtility.ConvertMemberToSql(memberInfo), value));
 }