static void Method_ToString(DbMethodCallExpression exp, SqlGenerator generator) { if (exp.Method.Name != "ToString" && exp.Arguments.Count != 0) { throw UtilExceptions.NotSupportedMethod(exp.Method); } if (exp.Object.Type == UtilConstants.TypeOfString) { exp.Object.Accept(generator); return; } if (!NumericTypes.ContainsKey(exp.Object.Type.GetUnderlyingType())) { throw UtilExceptions.NotSupportedMethod(exp.Method); } DbConvertExpression c = DbExpression.Convert(exp.Object, UtilConstants.TypeOfString); c.Accept(generator); }