我有一个Int64字段,我想在我的EF动态Linq查询中进行转换。 这是因为我想使用包含函数来检查Int64是否包含一定数量的数字。 所以我用的是SqlFunctions.StringConvert像SqlFunctions.StringConvert和Dynamic linq
SqlFunctions.StringConvert(MyField).Contains("2012")
动态库提出了一个ParseException:“StringConvert”不存在任何可用的方法是在类型“SqlFunctions”。
我在动态库而改变这个数组所以SqlFunctions将被定义:
static readonly Type[] predefinedTypes = {
typeof(Object),
...
typeof(Math),
typeof(Convert),
typeof(EntityFunctions),
typeof(SqlFunctions)
};
奇怪的是:我还添加了EntityFunctions,而且做工精细,为例:
EntityFunctions.TruncateTime(LastCommentDate) = @0
UPDATE :Int64不支持的SqlFunctions:
public static string StringConvert(decimal? number);
public static string StringConvert(double? number);
public static string StringConvert(decimal? number, int? length);
public static string StringConvert(double? number, int? length);
public static string StringConvert(decimal? number, int? length, int? decimalArg);
public static string StringConvert(double? number, int? length, int? decimalArg);
动态LINQ是否识别'SqlFunctions'? – hakuna1811 2017-10-04 06:51:38