public static Exception CreateDynamicException([NotNull] this IDynamicExceptionFactory factory, string message, Exception innerException = null, [CallerMemberName] string memberName = null)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            return(factory.CreateDynamicException($"{memberName}{nameof(Exception)}", message, innerException));
        }
        public static Exception CreateDynamicException([NotNull] this IDynamicExceptionFactory factory, [NotNull] IDynamicExceptionTemplate template)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (template == null)
            {
                throw new ArgumentNullException(nameof(template));
            }

            return(factory.CreateDynamicException(template.Name(), template.Message, template.InnerException));
        }
 public static Exception CreateDynamicException(this IDynamicExceptionFactory factory, string name, string message)
 {
     return(factory.CreateDynamicException(name, message, null));
 }