IOrderedQueryable<ParameterByClass> queryable = this.db.ParameterByClass.Where<ParameterByClass>(Expression.Lambda<Func<ParameterByClass, bool>>(Expression.AndAlso(Expression.AndAlso(Expression.AndAlso(Expression.Equal(Expression.Property(expression = Expression.Parameter(typeof(ParameterByClass), "c"), (MethodInfo)methodof(ParameterByClass.get_smallclassID)), Expression.Field(Expression.Constant(this, typeof(compare)), fieldof(compare.classid))), Expression.OrElse(Expression.Equal(Expression.Property(expression, (MethodInfo)methodof(ParameterByClass.get_zhuanye)), Expression.Constant(0, typeof(int))), Expression.Equal(Expression.Property(expression, (MethodInfo)methodof(ParameterByClass.get_zhuanye)), Expression.Constant(3, typeof(int))))), Expression.NotEqual(Expression.Property(expression, (MethodInfo)methodof(ParameterByClass.get_zhuanye)), Expression.Constant(2, typeof(int)))), Expression.Equal(Expression.Property(expression, (MethodInfo)methodof(ParameterByClass.get_pclassName)), Expression.Property(Expression.Call(Expression.Constant(ee), (MethodInfo)methodof(XContainer.Element), new Expression[] { Expression.Convert(Expression.Constant("pcName", typeof(string)), typeof(XName), (MethodInfo)methodof(XName.op_Implicit)) }), (MethodInfo)methodof(XElement.get_Value)), false, (MethodInfo)methodof(string.op_Equality))), new ParameterExpression[] { expression }))
这是一段反编译后得出的代码,不能正常运行,求高手指点。
正确的应该为:
- C# code
IOrderedQueryable<ParameterByClass> queryable = from c in this.db.ParameterByClass where //这里的条件语句怎么写?
------解决方案--------------------------------------------------------
把你的代码贴出来;
where后面写法与Lamda表达式写法差不多