Пример #1
0
        public MethodInvocationLoggingConfiguration(MethodCallExpression methodCallExpression)
        {
            MethodInfo = methodCallExpression.Method;
            var args = methodCallExpression.Arguments.ToList();

            for (int i = 0; i < args.Count; i++)
            {
                using (ArgumentOptionsFluentContext context = new ArgumentOptionsFluentContext())
                {
                    Expression.Lambda(args[i]).Compile().DynamicInvoke();

                    var paramName = context.ArgumentInternalName ?? MethodInfo.GetParameters()[i].Name;

                    if (_paramNameToIndexMapping.ContainsKey(paramName))
                    {
                        throw new DuplicateParameterNameException(paramName);
                    }

                    _paramNameToIndexMapping.Add(paramName, i);
                }
            }
        }
 public void Dispose()
 {
     _current = null;
 }
 public ArgumentOptionsFluentContext()
 {
     _current = this;
 }