public RazorViewToStringRenderer(IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public HtmlEngineFactory(IHttpContextAccessor httpContextAccessor, ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IApplicationEnvironment hostingEnvironment) { _httpContextAccessor = httpContextAccessor; _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _hostingEnvironment = hostingEnvironment; }
/// <summary> /// Initializes a new instance of the <see cref="BlogController" /> class. /// </summary> /// <param name="blogRepository">The blog repository.</param> /// <param name="tempDataProvider">The temporary data provider</param> /// <param name="webCache">Web cache to clear when modifying posts</param> /// <param name="comments">Disqus comments service</param> public BlogController(IBlogRepository blogRepository, ITempDataProvider tempDataProvider, IWebCache webCache, IDisqusComments comments) { _blogRepository = blogRepository; _webCache = webCache; _comments = comments; // TODO: This shouldn't be required to be passed in the constructor - Can set it as a property. TempDataProvider = tempDataProvider; }
/// <summary> /// 加载数据 /// </summary> /// <param name="controllerContext"></param> /// <param name="tempDataProvider"></param> public void Load(ControllerContext controllerContext, ITempDataProvider tempDataProvider) { IDictionary <string, object> dictionary = tempDataProvider.LoadTempData(controllerContext); this._data = ((dictionary != null) ? new Dictionary <string, object>(dictionary, StringComparer.OrdinalIgnoreCase) : new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase)); this._initialKeys = new HashSet <string>(this._data.Keys, StringComparer.OrdinalIgnoreCase); this._retainedKeys.Clear(); }
public ViewRenderService(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider, IHttpContextAccessor accessor) { this.razorViewEngine = razorViewEngine; this.tempDataProvider = tempDataProvider; this.serviceProvider = serviceProvider; this.context = accessor.HttpContext; }
public ProviderAccountHandler(IHostingEnvironment hostingEnvironment, IProviderVacancyClient client, IRecruitVacancyClient vacancyClient, IBlockedOrganisationQuery blockedOrganisationsRepo, ITempDataProvider tempDataProvider) { _hostingEnvironment = hostingEnvironment; _client = client; _vacancyClient = vacancyClient; _blockedOrganisationsRepo = blockedOrganisationsRepo; _tempDataProvider = tempDataProvider; }
public NccRazorViewRenderService(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider, IHttpContextAccessor httpContextAccessor, ILoggerFactory loggerFactory) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; _httpContextAccessor = httpContextAccessor; _logger = loggerFactory.CreateLogger <NccRazorViewRenderService>(); }
public TemplateService(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { this.razorViewEngine = razorViewEngine; this.tempDataProvider = tempDataProvider; this.serviceProvider = serviceProvider; }
public ViewRenderService(string rootPath, IRazorViewEngine viewEngine, IHttpContextAccessor httpContextAccessor, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { this.rootPath = rootPath; this.viewEngine = viewEngine; this.httpContextAccessor = httpContextAccessor; this.tempDataProvider = tempDataProvider ?? this; this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); }
public RenderViewAsString(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public ViewRender(IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public ViewRenderService(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
/// <summary> /// Initializes a new RazorContentRenderer. /// </summary> /// <param name="razorViewEngine">The razor view engine used to locate the view.</param> /// <param name="tempDataProvider">Tempdata provider used in the view context of the view.</param> /// <param name="serviceProvider">The service provider used to create an http context.</param> public RazorContentRenderer(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public RazorViewRenderer( IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider ) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; }
public static async Task <string> RenderView(string path, ViewDataDictionary viewDataDictionary) { if (ServiceProvider == null) { throw new InvalidOperationException($"In order to use the facade, {nameof(UseMailTemplates)} must be called in Startup.Configure method. "); } path = path ?? throw new ArgumentNullException(nameof(path)); viewDataDictionary = viewDataDictionary ?? throw new ArgumentNullException(nameof(viewDataDictionary)); path = path.EndsWith(".cshtml") ? path : $"{path}.cshtml"; path = path.Trim('/'); using (IServiceScope scope = ServiceProvider.CreateScope()) { MailOptions options = scope.ServiceProvider.GetRequiredService <IOptions <MailOptions> >().Value; ICompositeViewEngine viewEngine = scope.ServiceProvider.GetRequiredService <ICompositeViewEngine>(); ITempDataProvider tempDataProvider = scope.ServiceProvider.GetRequiredService <ITempDataProvider>(); IHttpContextAccessor httpContextAccessor = scope.ServiceProvider.GetRequiredService <IHttpContextAccessor>(); HttpContext httpContext = httpContextAccessor.HttpContext; if (httpContext == null) { httpContext = new DefaultHttpContext { RequestServices = scope.ServiceProvider }; } ActionContext actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor()); viewDataDictionary.Model = null; using (StringWriter sw = new StringWriter()) { ViewEngineResult viewResult = viewEngine.GetView($"{options.ViewTemplateBasePath}/{path}", $"{options.ViewTemplateBasePath}/{path}", true); if (viewResult?.View == null) { throw new Exception($"View {options.ViewTemplateBasePath}/{path} not found."); } ViewContext viewContext = new ViewContext(actionContext, viewResult.View, viewDataDictionary, new TempDataDictionary(httpContext, tempDataProvider), sw, new HtmlHelperOptions()); await viewResult.View.RenderAsync(viewContext); sw.Flush(); if (viewContext.ViewData != viewDataDictionary) { var keys = viewContext.ViewData.Keys.ToArray(); foreach (var key in keys) { viewDataDictionary[key] = viewContext.ViewData[key]; } } return(sw.ToString()); } } }
public ViewRenderer( ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IHttpContextAccessor contextAccesor) { this.viewEngine = viewEngine; this.tempDataProvider = tempDataProvider; this.contextAccesor = contextAccesor; }
public TemplateService( IRazorViewEngine engine, IServiceProvider serviceProvider, ITempDataProvider tempDataProvider) { this._razorViewEngine = engine; this._serviceProvider = serviceProvider; this._tempDataProvider = tempDataProvider; }
public void Load(ControllerContext controllerContext, ITempDataProvider tempDataProvider) { IDictionary <string, object> providerDictionary = tempDataProvider.LoadTempData(controllerContext); _data = (providerDictionary != null) ? new Dictionary <string, object>(providerDictionary, StringComparer.OrdinalIgnoreCase) : new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); _initialKeys = new HashSet <string>(_data.Keys); _modifiedKeys.Clear(); }
/// <summary> /// CTOR /// </summary> /// <param name="logger"></param> /// <param name="accessor"></param> /// <param name="razorViewEngine"></param> /// <param name="tempDataProvider"></param> public ViewRenderService(ILogger <ViewRenderService> logger, IHttpContextAccessor accessor, IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _logger = logger; _accessor = accessor; _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public RazorViewStringRenderer( IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IViewRendererActionContextFactory viewRendererFactory) { this.viewEngine = viewEngine; this.tempDataProvider = tempDataProvider; this.viewRendererFactory = viewRendererFactory; }
public ViewComponentManager(IViewComponentSelector viewComponentSelector, IViewComponentHelper viewComponentHelper, IActionContextAccessor actionContextAccessor, IViewAccountant viewAccountant, ITempDataProvider tempDataProvider, ILocalFileProvider localFileProvider) { _viewComponentSelector = viewComponentSelector; _viewComponentHelper = viewComponentHelper; _actionContextAccessor = actionContextAccessor; _viewAccountant = viewAccountant; _tempDataProvider = tempDataProvider; _localFileProvider = localFileProvider; }
public RazorPartialToStringRenderer( IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
/// <summary> /// Initialices the service instances /// </summary> /// <param name="viewEngine">The razor engine to be used by render the views</param> /// <param name="httpContextAccessor"><see cref="IHttpContextAccessor"/> instance use of /// access to the current HTTP context</param> /// <param name="tempDataProvider">The <see cref="ITempDataProvider"/> used to Load /// and Save data</param> /// <param name="serviceProvider">Instance of <see cref="IServiceProvider" /> used of access /// to the configured services into the startup class</param> /// <param name="metadataProvider"><see cref="IModelMetadataProvider"/> instance used to /// create <see cref="ModelExplorer"/> instances</param> /// <param name="actionContextAccessor"><see cref="IActionContextAccessor"/> instance used /// to located the required views</param> /// <param name="environmet"><see cref="IHostingEnvironment"/> instance used to located /// the web root path</param> public ViewRenderService( IRazorViewEngine viewEngine, IHttpContextAccessor httpContextAccessor, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider, IModelMetadataProvider metadataProvider, IActionContextAccessor actionContextAccessor, #if NETCOREAPP2_1 IHostingEnvironment environmet
public TemplateHelper( IRazorViewEngine engine, IServiceProvider serviceProvider, ITempDataProvider tempDataProvider) { _razorViewEngine = engine; _serviceProvider = serviceProvider; _tempDataProvider = tempDataProvider; }
public EmailTemplateService( IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public CPS8xCodeGeneratorService( IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { this.razorViewEngine = razorViewEngine; this.tempDataProvider = tempDataProvider; this.serviceProvider = serviceProvider; }
public ViewRenderService(IRazorViewEngine razorViewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider, IHttpContextAccessor accessor) { _razorViewEngine = razorViewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; httpContext = accessor.HttpContext; }
public RazorViewToStringRenderer( IOptions <MvcViewOptions> options, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _options = options; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
/// <summary> /// Creates a new <see cref="TempDataDictionaryFactory"/>. /// </summary> /// <param name="provider">The <see cref="ITempDataProvider"/>.</param> public TempDataDictionaryFactory(ITempDataProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } _provider = provider; }
/// <summary> /// DI constructor to supply all necessary services for razor engine to work /// </summary> /// <param name="viewEngine">view engine itself</param> /// <param name="tempDataProvider">temporary cross-request data storage provider</param> /// <param name="serviceProvider">service provider for other services as requested by the view</param> public RenderProjectFileCommand( IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _tempDataProvider = tempDataProvider; _viewEngine = viewEngine; }
public RazorViewRenderer( ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, ILogger logger) { _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _logger = logger; }
public RazorViewToStringRenderer( IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { this.viewEngine = viewEngine; this.tempDataProvider = tempDataProvider; this.serviceProvider = serviceProvider; }
public RazorViewToString( IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider) { _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public RazorViewToStringRenderer( IRazorViewEngine viewEngine, ITempDataProvider tempDataProvider, IServiceProvider serviceProvider, IHttpContextAccessor contextAccessor, LinkGenerator linkGenerator) { _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _serviceProvider = serviceProvider; }
public InvoicesController(IProjectInvoicesManager invoiceManager, UserManager<AppUser> userManager, ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IHttpContextAccessor httpContextAccessor, IApplicationEnvironment hostingEnvironment, DatabaseContext dbContext) { _invoiceManager = invoiceManager; _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _httpContextAccessor = httpContextAccessor; _hostingEnvironment = hostingEnvironment; _dbContext = dbContext; _userManager = userManager; }
public ProjectInvoicesManager(DatabaseContext dbContext, ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IHttpContextAccessor httpContextAccessor, IApplicationEnvironment hostingEnvironment, IProjectWorkflowDefinitionFactory workflowDefinition, IProjectHistoryManager historyManager, IProjectAlertsManager alertsManager) { _dbContext = dbContext; _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _httpContextAccessor = httpContextAccessor; _hostingEnvironment = hostingEnvironment; _workflowDefinition = workflowDefinition; _historyManager = historyManager; _alertsManager = alertsManager; }
public WindsorControllerFactory(IKernel kernel) { this.kernel = kernel; dataProvider = new SessionlessTempDataProvider(); }
/// <summary> /// Initializes a new instance of the <see cref="TempDataControllerFactory"/> class. /// </summary> /// <param name="controllerFactory"> /// The controller factory. /// </param> /// <param name="tempDataProvider"> /// The temp Data Provider. /// </param> public TempDataControllerFactory(IControllerFactory controllerFactory, ITempDataProvider tempDataProvider) { this.controllerFactory = controllerFactory; this.tempDataProvider = tempDataProvider; }