private string GetCacheKey(CacheAttribute cacheAttribute, IMethodInvocation input)
        {
            if (input.Inputs == null || input.Inputs.Count == 0)
            {
                return(cacheAttribute.CacheKey);
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0}", cacheAttribute.CacheKey);

            var parameters = input.MethodBase.GetParameters();
            int index      = -1;

            foreach (ParameterInfo parameterInfo in parameters)
            {
                index++;

                var keyAttrs = Attribute.GetCustomAttribute(parameterInfo, typeof(CacheKeyAttribute));
                if (keyAttrs == null)
                {
                    continue;
                }

                if (parameterInfo.ParameterType.IsPrimitive || parameterInfo.ParameterType == typeof(Type))
                {
                    sb.AppendFormat(";{0}={1}", parameterInfo.Name, input.Arguments[index]);
                }
                else
                {
                    PropertyInfo[] propertyInfos =
                        parameterInfo.ParameterType.GetProperties(BindingFlags.Public | BindingFlags.Instance |
                                                                  BindingFlags.GetProperty);

                    if (propertyInfos.Length == 0)
                    {
                        sb.AppendFormat(";{0}={1}", parameterInfo.Name, input.Arguments[index]);
                    }
                    else if (propertyInfos.Length > 0)
                    {
                        foreach (PropertyInfo property in propertyInfos)
                        {
                            if (property.GetCustomAttributes(typeof(CacheKeyAttribute), false).Length > 0)
                            {
                                sb.AppendFormat(";{0}={1}", property.Name, property.GetValue(input.Arguments[index], null));
                            }
                        }
                    }
                }
            }
            return(sb.ToString());
        }
        private string GetCacheKey(CacheAttribute cacheAttribute, IMethodInvocation input)
        {
            if (input.Inputs == null || input.Inputs.Count == 0) return cacheAttribute.CacheKey;

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("{0}", cacheAttribute.CacheKey);

            var parameters = input.MethodBase.GetParameters();
            int index = -1;
            foreach (ParameterInfo parameterInfo in parameters)
            {
                index++;

                var keyAttrs = Attribute.GetCustomAttribute(parameterInfo, typeof(CacheKeyAttribute));
                if (keyAttrs == null) continue;

                if (parameterInfo.ParameterType.IsPrimitive || parameterInfo.ParameterType == typeof(Type))
                {
                    sb.AppendFormat(";{0}={1}", parameterInfo.Name, input.Arguments[index]);
                }
                else
                {
                    PropertyInfo[] propertyInfos =
                        parameterInfo.ParameterType.GetProperties(BindingFlags.Public | BindingFlags.Instance |
                                                          BindingFlags.GetProperty);

                    if (propertyInfos.Length == 0)
                    {
                        sb.AppendFormat(";{0}={1}", parameterInfo.Name, input.Arguments[index]);
                    }
                    else if (propertyInfos.Length > 0)
                    {
                        foreach (PropertyInfo property in propertyInfos)
                        {
                            if (property.GetCustomAttributes(typeof(CacheKeyAttribute), false).Length > 0)
                            {
                                sb.AppendFormat(";{0}={1}", property.Name, property.GetValue(input.Arguments[index], null));
                            }
                        }
                    }
                }
            }
            return sb.ToString();
        }