public static string GetKey(string controller, string action, Dictionary <string, object> actionArgs, params string[] cacheKeyArgs) { string ext = null; // If there are no actionArgs, then continue if (actionArgs.NotNulle()) { // --STEP #1: // For complex types, ICacheKey is the bomb, doesn't even require // CacheArgs atrribute to be set, making things really easy. It does however // mean we have to iterate through actionArgs looking for any that are of type ICacheKey ICacheKey ck = actionArgs.Select(d => d.Value as ICacheKey).FirstOrDefault(v => v != null); if (ck != null) { ext = ck.CacheKey(); } else if (cacheKeyArgs.NotNulle()) { // --STEP #2: // None of the args are actionArs; we only get here if there ARE cacheKey // values that were inputted (in the attr). for (int i = 0; i < cacheKeyArgs.Length; i++) { string arg = cacheKeyArgs[i]; string v = GetValueStatic(actionArgs.Value(arg)); if (v.NotNulle()) { ext += (ext == null ? null : "&") + arg + '=' + v; } } } } return(GetKey(controller, action, ext)); }