/// <summary>
 /// Constructs a new instance
 /// </summary>
 /// <param name="options">The <see cref="FilesOptions"/></param>
 /// <param name="attribute">The <see cref="FileTriggerAttribute"/></param>
 /// <param name="executor">The function executor.</param>
 /// <param name="logger">The <see cref="ILogger"/>.</param>
 public FileProcessorFactoryContext(FilesOptions options, FileTriggerAttribute attribute, ITriggeredFunctionExecutor executor, ILogger logger)
 {
     Options   = options ?? throw new ArgumentNullException(nameof(options));
     Attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));
     Executor  = executor ?? throw new ArgumentNullException(nameof(executor));
     Logger    = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #2
0
        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        /// <param name="context">The <see cref="FileProcessorFactoryContext"/> to use.</param>
        public FileProcessor(FileProcessorFactoryContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _options   = context.Options;
            _attribute = context.Attribute;
            _executor  = context.Executor;
            _logger    = context.Logger;

            string attributePath = _attribute.GetRootPath();

            _filePath = Path.Combine(_options.RootPath, attributePath);

            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
            };

            _serializer = JsonSerializer.Create(settings);
        }