private DbExpression RootTranslate(TranslationContext context, Expression exp) { switch (exp.NodeType) { case ExpressionType.Call: var call = (MethodCallExpression)exp; var method = call.Method; if (method.IsGenericMethod) { method = method.GetGenericMethodDefinition(); } if (UnitTypeMethods.ContainsKey(method)) { return(UnitTypeTranslate(context, exp)); } else if (UnitItemTypeMethods.ContainsKey(method)) { return(UnitItemTypeMethods[method](context, call, method)); } else if (ValueTypeMethods.ContainsKey(method)) { return(ValueTypeMethods[method](context, call, method)); } break; case ExpressionType.Constant: return(UnitTypeTranslate(context, exp)); default: return(ExpressionTranslate(context, exp)); } throw new TranslateException(exp, Res.NotSupportedParseExpression); }