EF Dynamic Linq クエリで変換したい Int64 フィールドがあります。これは、Contains 関数を使用して、Int64 に特定の一連の数値が含まれているかどうかを確認したいためです。だから私は SqlFunctions.StringConvert のように使用します
SqlFunctions.StringConvert(MyField).Contains("2012")
ダイナミック ライブラリが ParseException を発生させます: タイプ 'SqlFunctions' に該当するメソッド 'StringConvert' が存在しません。
SqlFunctions が定義されるように、動的ライブラリでこの配列を変更しました。
static readonly Type[] predefinedTypes = {
typeof(Object),
...
typeof(Math),
typeof(Convert),
typeof(EntityFunctions),
typeof(SqlFunctions)
};
奇妙なこと: EntityFunctions も追加しましたが、それは正常に動作します。例:
EntityFunctions.TruncateTime(LastCommentDate) = @0
更新: 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);