Example #1
0
        public XSLTransformContentMiddleWare(
            MiddlewareDelegate <CFTFileContext> next,
            ILogger <XSLTransformContentMiddleWare> logger,
            XSLTransformContentOptions options)
            : base(next, logger)
        {
            try
            {
                options.ValidationParams();
            }
            catch (Exception e)
            {
                throw new CFTConfigurationException("Ошибка при конфигурации модуля XSLT преобразования.", e);
            }

            _transform = new XslCompiledTransform();
            try
            {
                _transform.Load(options.XSLTPath);
            }
            catch (Exception e)
            {
                throw new CFTConfigurationException("Что-то пошло не так во время загрузки XSLT файла.", e);
            }
            _options = options;
        }
Example #2
0
        public static IMiddlewareBuilder <CFTFileContext> UseTransformXSLT(
            this IMiddlewareBuilder <CFTFileContext> app,
            Action <XSLTransformContentOptions> configOption)
        {
            var options = new XSLTransformContentOptions();

            configOption(options);
            app.UseMiddleware <XSLTransformContentMiddleWare, CFTFileContext>(options);
            return(app);
        }