public AuthorizationMenuTagHelper(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _sysPermissionService = _serviceProvider.GetService <Service.SysPermissionService>(); _actionContextAccessor = _serviceProvider.GetService <Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor>(); //_adminWorkContextProvider = _serviceProvider.GetService<Core.WorkContext.Provider.IAdminWorkContextProvider>(); //_httpContextAccessor = _serviceProvider.GetService<Microsoft.AspNetCore.Http.IHttpContextAccessor>(); }
// [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeName("data-lol")] // public string Fsck { get; set; } public RadiosTagHelper( Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor actionContextAccessor ) { this.ActionContextAccessor = actionContextAccessor; // this.ActionContextAccessor.ActionContext.ModelState; // ViewContext.HttpContext // ViewContext.ModelState }
// services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); // services.AddSingleton<IActionContextAccessor, ActionContextAccessor>(); public MyImageTagHelper( Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment, Microsoft.Extensions.Caching.Memory.IMemoryCache cache, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor, Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor actionContextAccessor, // For base constructor System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory ) : base(urlHelperFactory, htmlEncoder) { this.HostingEnvironment = hostingEnvironment; this.Cache = cache; this.HttpContext = httpContextAccessor.HttpContext; this.ActionContext = actionContextAccessor.ActionContext; }