public static MvcHtmlString GenerateCanonicalUrls(this HtmlHelper html, string part = "") { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); html.AppendCanonicalUrlParts(part); return(MvcHtmlString.Create(pageHeadBuilder.GenerateCanonicalUrls())); }
public static MvcHtmlString GenerateMetaKeywords(this HtmlHelper html, string part = "") { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); html.AppendMetaKeywordParts(part); return(MvcHtmlString.Create(html.Encode(pageHeadBuilder.GenerateMetaKeywords()))); }
/// <summary> /// 重写拦截层 /// </summary> /// <param name="actionContext"></param> public override void OnAuthorization(HttpActionContext actionContext) { IUnityContainer unityContainer = new IocHelper("AuthorizationApi").GetUnityContainer(); IAuthorizationApplication authorizationApplication = unityContainer.Resolve <IAuthorizationApplication>(); bool flag = authorizationApplication.DoAuthorization(actionContext); var resultModel = authorizationApplication.TokenResult; if (flag) { IsAuthorized(actionContext); return; } ResponseBaseViewModel <string> responseView = new ResponseBaseViewModel <string>(); responseView.Flag = new ResponseCodeViewModel() { Code = (int)resultModel.Code, Message = "", MojoryToken = resultModel.Token }; actionContext.Response = new HttpResponseMessage { Content = new StringContent(Json.Encode(responseView), Encoding.UTF8, "application/json") }; }
protected virtual void LoadFrom(string physicalPath, Func <IList <string>, bool> funcHasRole = null) { var webHelper = IocHelper.Resolve <IWebHelper>(); string filePath = webHelper.MapPath(physicalPath); var context = IocHelper.Resolve <HttpContextBase>(); string content = File.ReadAllText(filePath); if (!string.IsNullOrEmpty(content)) { using (var sr = new StringReader(content)) { using (var xr = XmlReader.Create(sr, new XmlReaderSettings { CloseInput = true, IgnoreWhitespace = true, IgnoreComments = true, IgnoreProcessingInstructions = true })) { var doc = new XmlDocument(); doc.Load(xr); if ((doc.DocumentElement != null) && doc.HasChildNodes) { XmlNode xmlRootNode = doc.DocumentElement.FirstChild; Iterate(RootNode, xmlRootNode, funcHasRole); } } } } }
protected void SetEntityCreation(IEntityCreation entity) { //The IAppSession should be registered for web and service app on the startup var appSession = IocHelper.Resolve <IAppSession>(); entity.CreationDate = DateTime.Now; entity.CreationUserId = appSession.CurrentUserId; }
public AbpNHibernateInterceptor() { _abpSession = new Lazy <IAbpSession>( () => IocManager.Instance.IocContainer.Kernel.HasComponent(typeof(IAbpSession)) ? IocHelper.Resolve <IAbpSession>() : NullAbpSession.Instance ); }
public static MvcHtmlString GenerateTitle(this HtmlHelper html, bool addDefaultTitle, string part = "") { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); if (!string.IsNullOrEmpty(part)) { pageHeadBuilder.AddTitleParts(part); } return(MvcHtmlString.Create(html.Encode(pageHeadBuilder.GenerateTitle(addDefaultTitle)))); }
public virtual string GenerateTitle(bool addDefaultTitle) { var specificTitle = string.Join(PageTitleSeparator, _titleParts.AsEnumerable().Reverse().ToArray()); if (addDefaultTitle && string.IsNullOrWhiteSpace(specificTitle)) { return(IocHelper.Resolve <IResourceService>().GetResourceString("home")); } return(specificTitle); }
static void Main(string[] args) { IocHelper.Register <ClassA, IClassA>(); //IocHelper.Register(new ClassB()); IocHelper.RegisterAssembly(Assembly.GetExecutingAssembly()); IClassA ca = IocHelper.Resolve <IClassA>(); ClassB cb = IocHelper.Resolve <ClassB>(); }
public ConfigReaderTest() { Arguments prms = new Arguments(); prms.Add("applicationName", "SERVICE - A"); prms.Add("refreshTimerIntervalInMs", 10000); prms.Add("connectionString", "Deneme"); _configurationReader = IocHelper.Resolve <IConfigurationReader>(prms); }
internal TDbContext GetOrCreateDbContext <TDbContext>() where TDbContext : DbContext { DbContext dbContext; if (!_activeDbContexts.TryGetValue(typeof(TDbContext), out dbContext)) { _activeDbContexts[typeof(TDbContext)] = dbContext = IocHelper.Resolve <TDbContext>(); } return((TDbContext)dbContext); }
public static IAttachmentHandler GetAttachmentHandler() { if (IocHelper.IsRegistered(typeof(IAttachmentHandler))) { var hander = IocHelper.Resolve <IAttachmentHandler>(); return(hander); } else { return(new DefaultAttachmentHandler()); } }
public virtual ActionResult Social() { var socialSetting = IocHelper.Resolve <SocialSetting>(); var model = new SocialModel() { FacebookLink = socialSetting.FacebookLink, GooglePlusLink = socialSetting.GooglePlusLink, TwitterLink = socialSetting.TwitterLink, YoutubeLink = socialSetting.YoutubeLink }; return(PartialView(model)); }
protected void Application_Start() { log4net.Config.XmlConfigurator.Configure(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DtoMapper.Map(); InitializeIocContainer.Initialize(); var permissionManager = IocHelper.Resolve <IPermissionManager>(); permissionManager.Initialize(); }
static void Main(string[] args) { Arguments prms = new Arguments(); prms.Add("applicationName", "SERVICE - A"); prms.Add("refreshTimerIntervalInMs", 10000); prms.Add("connectionString", "Deneme"); IConfigurationReader configurationReader = IocHelper.Resolve <IConfigurationReader>(prms); var val = configurationReader.GetValue <int>("MaxItemCount"); Console.ReadKey(); }
public IActionResult Config() { Arguments prms = new Arguments(); prms.Add("applicationName", "SERVICE - A"); prms.Add("refreshTimerIntervalInMs", 10000); prms.Add("connectionString", "Deneme"); IConfigurationReader configurationReader = IocHelper.Resolve <IConfigurationReader>(prms); ConfigModel model = new ConfigModel(); model.Configs = IocHelper.Resolve <IConfigProvider>().GetByApplication("SERVICE - A"); return(View(model)); }
public ResponseBaseViewModel <string> MojoryLoginOut() { string token = this.GetToken(); IUnityContainer unityContainer = new IocHelper("MojoryLoginOutApi").GetUnityContainer(); ICustomerLoginOutApplication customerLoginOutApplication = unityContainer.Resolve <ICustomerLoginOutApplication>(); customerLoginOutApplication.MojoryLoginOut(token); ResponseBaseViewModel <string> v = new ResponseBaseViewModel <string> { Flag = new ResponseCodeViewModel() { Code = 0, Message = "success", MojoryToken = "" } }; return(v); }
public override void OnAuthorization(HttpActionContext actionContext) { base.OnAuthorization(actionContext); if (Permissions != null) { if (_permissionCheckerManager == null) { _permissionCheckerManager = IocHelper.Resolve <IPermissionCheckerManager>(); } foreach (var permission in Permissions) { if (!_permissionCheckerManager.IsGranted(permission)) { throw new UnAuthorizationException("You don't have sufficient rights for this permission. PermissionName : " + permission); } } } }
static LogHelper() { Logger = IocHelper.Resolve <ILogger>(); }
public static void AddHeadCustomParts(this HtmlHelper html, string part) { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); pageHeadBuilder.AddHeadCustomParts(part); }
/// <summary> /// Initializes the system. /// </summary> public virtual void Initialize() { IocManager.Instance.IocContainer.Install(FromAssembly.This()); _applicationManager = IocHelper.Resolve <AbpApplicationManager>(); _applicationManager.Initialize(); }
public static MvcHtmlString GenerateHeadCustom(this HtmlHelper html) { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); return(MvcHtmlString.Create(pageHeadBuilder.GenerateHeadCustom())); }
static SettingHelper() { SettingManager = IocHelper.Resolve <ISettingManager>(); }
public static void AppendMetaKeywordParts(this HtmlHelper html, string part) { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); pageHeadBuilder.AppendMetaKeywordParts(part); }
public static void AddMetaDescriptionParts(this HtmlHelper html, string part) { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); pageHeadBuilder.AddMetaDescriptionParts(part); }
public static void AppendCanonicalUrlParts(this HtmlHelper html, string part) { var pageHeadBuilder = IocHelper.Resolve <IPageHeadBuilder>(); pageHeadBuilder.AppendCanonicalUrlParts(part); }
public BaseApiController() { _appSession = IocHelper.Resolve <IAppSession>(); }
/// <summary> /// Registers a localization source. /// </summary> /// <typeparam name="T">Type of the localization source.</typeparam> public static void RegisterSource <T>() where T : ILocalizationSource { LocalizationSourceManager.RegisterSource(IocHelper.Resolve <T>()); }
static LocalizationHelper() { LocalizationSourceManager = IocHelper.Resolve <ILocalizationSourceManager>(); }
static LogHelper() { Logger = IocManager.Instance.IocContainer.Kernel.HasComponent(typeof(ILogger)) ? IocHelper.Resolve <ILogger>() : NullLogger.Instance; }