Пример #1
0
 public EmailSender(
     ILogger <EmailSender> logger,
     IRazorLightEngine engine)
 {
     _logger = logger;
     _engine = engine;
 }
Пример #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ViewRenderService()
 {
     _engine = new RazorLightEngineBuilder()
               .UseEmbeddedResourcesProject(typeof(Program))
               .UseMemoryCachingProvider()
               .Build();
 }
Пример #3
0
 public EmailSender(IOptions <AuthMessageSenderOptions> authOptions, IBackgroundJobClient jobClient, ILogger <EmailSender> logger, IRazorLightEngine engine)
 {
     this.authOptions = authOptions.Value;
     this.logger      = logger;
     this.jobClient   = jobClient;
     this.engine      = engine;
 }
Пример #4
0
 public AccountController(
     AuthDbContext context,
     UserManager <AppUser> userManager,
     SignInManager <AppUser> signInManager,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IAuthenticationSchemeProvider schemeProvider,
     IHttpContextAccessor accessor,
     IConfiguration configuration,
     IAmazonSimpleEmailService mailer,
     IRazorLightEngine templateEngine,
     IEventService events)
 {
     _context        = context;
     _userManager    = userManager;
     _signInManager  = signInManager;
     _interaction    = interaction;
     _clientStore    = clientStore;
     _schemeProvider = schemeProvider;
     _events         = events;
     _configuration  = configuration;
     _accessor       = accessor;
     _mailer         = mailer;
     _templateEngine = templateEngine;
 }
Пример #5
0
        public TemplateRenderer(
            ITemplatePage razorPage,
            IRazorLightEngine razorEngine,
            HtmlEncoder htmlEncoder)
        {
            if (razorPage == null)
            {
                throw new ArgumentNullException(nameof(razorPage));
            }

            if (razorEngine == null)
            {
                throw new ArgumentNullException(nameof(razorEngine));
            }

            if (razorPage == null)
            {
                throw new ArgumentNullException(nameof(razorPage));
            }

            _engine      = razorEngine;
            _htmlEncoder = htmlEncoder;

            RazorPage = razorPage;
        }
 public HttpHandler(CloudTableClient tableClient, string taskHubName, IRazorLightEngine razorLightEngine, Dfhv confg)
 {
     _tableClient      = tableClient;
     _taskHubName      = taskHubName;
     _razorLightEngine = razorLightEngine;
     _confg            = confg;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailController" /> class.
 /// </summary>
 public EmailController(IUserInfo userinfo, IEmailSender emailSender, IOptions <AppSettings> settings,
                        IRazorLightEngine razorEngine) : base(userinfo)
 {
     _emailSender = emailSender;
     _razorEngine = razorEngine;
     _mySettings  = settings.Value;
 }
Пример #8
0
 public CEClassController(IAdRepository repo, UserManager <AppUser> userManager, ILogger <CEClassController> logger, IEmailSender emailSender, IRazorLightEngine engine)
 {
     _repo        = repo;
     _userManager = userManager;
     _logger      = logger;
     _emailSender = emailSender;
     _engine      = engine;
 }
        public ViewToStringRenderer()
        {
            var outputDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            var viewsPath       = Path.Combine(outputDirectory, @"PdfGenerator\Views");
            var viewsLocation   = new Uri(viewsPath).LocalPath;

            _engine = EngineFactory.CreatePhysical(viewsLocation);
        }
Пример #10
0
 public MailSender(IOptions <MailSettings> options)
 {
     _settings     = options.Value;
     _renderEngine = new RazorLightEngineBuilder()
                     .UseFilesystemProject($@"{ Directory.GetCurrentDirectory()}\MailTemplates")
                     .UseMemoryCachingProvider()
                     .Build();
 }
Пример #11
0
 public LogDashboardContext(HttpContext httpContext, LogDashboardRoute route, IRazorLightEngine engine, LogDashboardOptions options)
 {
     StaticOptions = options;
     Route         = route ?? throw new ArgumentNullException(nameof(route));
     HttpContext   = httpContext ?? throw new ArgumentNullException(nameof(httpContext));
     Engine        = engine ?? throw new ArgumentNullException(nameof(engine));
     Options       = options;
 }
 /// <summary>	Specialised constructor for use only by derived class. </summary>
 /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
 /// <param name="viewPath">	Full pathname of the view file. </param>
 public RazorLightTemplatingService(string viewPath)
 {
     if (string.IsNullOrWhiteSpace(viewPath))
     {
         throw new ArgumentNullException(nameof(viewPath));
     }
     Engine = new EngineFactory().ForFileSystem(viewPath);
 }
 public OpenHouseSubmissionController(IAdRepository repo, UserManager <AppUser> userManager, ILogger <OpenHouseSubmissionController> logger, IEmailSender emailSender, IRazorLightEngine engine)
 {
     _repo        = repo;
     _userManager = userManager;
     _logger      = logger;
     _emailSender = emailSender;
     _engine      = engine;
 }
Пример #14
0
        public ViewRenderService(ITemplateSettings templateSettings)
        {
            if (templateSettings == null)
            {
                throw new ArgumentNullException(nameof(templateSettings));
            }

            _engine = new EngineFactory().ForFileSystem(templateSettings.TemplatesFolderPath);
        }
Пример #15
0
 public RazorLightService(IComponentSettings componentSettings, IWebHostEnvironment host)
 {
     _componentSettings = componentSettings;
     _componentSettings.SetUrl(host.ContentRootPath);
     Engine = new RazorLightEngineBuilder()
              .UseFileSystemProject(componentSettings.BaseComponentFullDir)
              .UseMemoryCachingProvider()
              .Build();
     //Engine = engine;
 }
Пример #16
0
        public string getTemplate <T>(TempalteType template, T model)
        {
            IRazorLightEngine engine = EngineFactory.CreateEmbedded(typeof(T));

            string templatePath = string.Format(viewPathTemplate, template);

            string result = engine.Parse(templatePath, model);

            return(result);
        }
Пример #17
0
        public ViewRenderService(ITemplateSettings templateSettings)
        {
            if (templateSettings == null)
            {
                throw new ArgumentNullException(nameof(templateSettings));
            }

            // TODO:
            _engine = EngineFactory.CreatePhysical(templateSettings.TemplatesFolderPath);
        }
Пример #18
0
 public PasswordResetProcessor(IServiceContainer serviceContainer)
     : base(serviceContainer)
 {
     this.userProvider        = serviceContainer.GetService <IUserProvider>();
     this.userService         = serviceContainer.GetService <IBaseService <User> >();
     this.mailQueueService    = serviceContainer.GetService <IMailQueueService>();
     this.razorLightEngine    = serviceContainer.GetService <IRazorLightEngine>();
     this.reloader            = serviceContainer.GetServices <IReloader <PasswordResetViewModel> >().First();
     this.translationManager  = serviceContainer.GetService <ITranslationManager>();
     this.httpContextAccessor = serviceContainer.GetService <IHttpContextAccessor>();
 }
Пример #19
0
 public TemplateRenderer(
     ITemplatePage razorPage,
     IRazorLightEngine razorEngine,
     HtmlEncoder htmlEncoder,
     IViewBufferScope bufferScope)
 {
     RazorPage    = razorPage ?? throw new ArgumentNullException(nameof(razorPage));
     _engine      = razorEngine ?? throw new ArgumentNullException(nameof(razorEngine));
     _bufferScope = bufferScope ?? throw new ArgumentNullException(nameof(bufferScope));
     _htmlEncoder = htmlEncoder ?? throw new ArgumentNullException(nameof(htmlEncoder));
 }
Пример #20
0
        public SiteGenerator(IImageProvider imageProvider)
        {
            _imageProvider = imageProvider;

            _razor = new RazorLightEngineBuilder()
                     .UseFilesystemProject(Path.Combine(Environment.CurrentDirectory, "Views"))
                     .UseMemoryCachingProvider()
                     .Build();

            _assetsProvider = new PhysicalFileProvider(Path.Combine(Environment.CurrentDirectory, "Assets"));
        }
Пример #21
0
 public ResumeExporter(
     IJsReportMVCService reportService,
     IRazorLightEngine engine,
     IResumeExportModelBuilder modelBuilder,
     string viewPath)
 {
     _reportMVCService = reportService;
     _engine           = engine;
     _modelBuilder     = modelBuilder;
     _viewPath         = viewPath;
 }
Пример #22
0
 public ServiceConfigManager(IOptionsMonitor <AppConfig> config, ILogger <ServiceConfigManager> logger,
                             IDbConnection db, ICryptoService cryptoService,
                             IRazorLightEngine razorLightEngine, IIdentityProvider identityProvider)
 {
     _appConfig     = config.CurrentValue;
     _logger        = logger;
     _db            = db;
     _cryptoService = cryptoService;
     _engine        = razorLightEngine;
     _identity      = identityProvider;
 }
Пример #23
0
        public string Generate(string template, object model)
        {
            if (_engine == null)
            {
                _engine = EngineFactory.CreatePhysical(Configuration.GetProjectDirectory());
                Assert.IsNotNull(_engine);

                _engine.Configuration.Namespaces.AddRange(Configuration.GetArray(Constants.Configuration.GenerateCode.Imports));
            }

            return(_engine.ParseString(template, model));
        }
Пример #24
0
        public Task <bool> Initialize()
        {
            engine = new RazorLightEngineBuilder()
                     .UseEmbeddedResourcesProject(this.GetType())
                     .UseMemoryCachingProvider()
                     .Build();

            //await engine.CompileRenderAsync< DataTable>((key,Content,new DataTable());
            //var found = engine.TemplateCache.RetrieveTemplate(key);
            //return found.Success;
            return(Task.FromResult(true));
        }
Пример #25
0
 public ObservationsManager(DataContext dataContext, FileManager fileManager,
                            SpeciesManager speciesManager, UsersManager usersManager, IServiceProvider serviceProvider, IUserNotify userNotify, IConfiguration configuration, IRazorLightEngine razorLightEngine)
     : base(dataContext)
 {
     this.FileManager     = fileManager;
     this.SpeciesManager  = speciesManager;
     this.UsersManager    = usersManager;
     this.ServiceProvider = serviceProvider;
     this.UserNotify      = userNotify;
     this.Configuration   = configuration;
     this.RazorEngine     = razorLightEngine;
 }
Пример #26
0
 public DebugController(IOptionsSnapshot <AppConfig> appConfig, ILogger <DebugController> logger,
                        IDbConnection db, IServiceManager serviceManager,
                        IServiceConfigManager serviceConfigManager, IStatistician statistician,
                        IIdentityProvider identityProvider, IRazorLightEngine engine,
                        IProcessRunner processRunner)
     : base(appConfig, logger, db)
 {
     _engine               = engine;
     _identity             = identityProvider;
     _serviceConfigManager = serviceConfigManager;
     _processRunner        = processRunner;
 }
Пример #27
0
        public RazorMailService(
            GlobalSettings globalSettings,
            IMailDeliveryService mailDeliveryService)
        {
            _globalSettings      = globalSettings;
            _mailDeliveryService = mailDeliveryService;


            var factory = new EngineFactory();

            _engine = factory.Create(new CustomEmbeddedRazorProject());
        }
        public async Task <bool> Initialize()
        {
            engine = new RazorLightEngineBuilder()
                     .UseMemoryCachingProvider()
                     .Build();

            await engine.CompileRenderAsync <DataTable>(key, Content, new DataTable());

            var found = engine.TemplateCache.RetrieveTemplate(key);

            return(found.Success);
            //return true;
        }
Пример #29
0
        public Dfhv(IOptions <Option> options, IRazorLightEngine razorLightEngine, INameResolver nameResolver, IConnectionStringResolver connectionStringResolver)
        {
            _razorLightEngine         = razorLightEngine;
            _nameResolver             = nameResolver;
            _connectionStringResolver = connectionStringResolver;
            _option = options.Value;
            var connectionName = _option.AzureStorageConnectionStringName ?? ConnectionStringNames.Storage;
            var resolvedStorageConnectionString = _connectionStringResolver.Resolve(connectionName);
            var account = CloudStorageAccount.Parse(resolvedStorageConnectionString);

            _tableClient = account.CreateCloudTableClient();
            _blobClient  = account.CreateCloudBlobClient();
            _handler     = new HttpHandler(_tableClient, _option.HubName, _razorLightEngine, this);
        }
Пример #30
0
        public RazorViewMailService(
            GlobalSettings globalSettings,
            IMailDeliveryService mailDeliveryService)
        {
            _globalSettings      = globalSettings;
            _mailDeliveryService = mailDeliveryService;

            var manager     = new CustomEmbeddedResourceTemplateManager("Bit.Core.MailTemplates");
            var core        = new EngineCore(manager, EngineConfiguration.Default);
            var pageFactory = new DefaultPageFactory(core.KeyCompile);
            var lookup      = new DefaultPageLookup(pageFactory);

            _engine = new RazorLightEngine(core, lookup);
        }