当前位置: 首页>>代码示例>>C#>>正文


C# WorkContext.Resolve方法代码示例

本文整理汇总了C#中WorkContext.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# WorkContext.Resolve方法的具体用法?C# WorkContext.Resolve怎么用?C# WorkContext.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorkContext的用法示例。


在下文中一共展示了WorkContext.Resolve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetAuthenticatedUserForRequest

		public bool SetAuthenticatedUserForRequest(HttpRequestMessage request, WorkContext workContext)
		{
			var membershipService = workContext.Resolve<IMembershipService>();
			var authenticationService = workContext.Resolve<IAuthenticationService>();

			var credentials = this.GetCredentials(request.Headers.Authorization);
			var user = this.GetUserForCredentials(credentials, membershipService);
			return this.SetAuthenticatedUserForRequest(user, authenticationService);
		}
开发者ID:Xceno,项目名称:Xceno.CustomUsers,代码行数:9,代码来源:BasicAuthenticationService.cs

示例2: GetNavigationHierarchy

        /// <summary>
        /// Get navigation list using full path
        /// </summary>
        /// <returns>Navigation list</returns>
        public static IEnumerable<Navigation> GetNavigationHierarchy(string fullPath, WorkContext workContext)
        {
            var navigations = new List<Navigation>();
            int indexStart = fullPath.IndexOf("/Publication/") + 1;
            string[] navigationParts = fullPath.Substring(indexStart, (fullPath.Length - indexStart)).Split('/');
            string currentPath = fullPath.Substring(0, indexStart - 1);
            string partName;
            int index = 0;
            while( index < (navigationParts.Count() - 1)){
                switch (navigationParts[index])
                {
                    case("Publication"):
                        partName = "Publications";
                        break;
                    case ("Issue"):
                        partName = "Issues";
                        break;
                    case ("Article"):
                        partName = "Articles";
                        break;
                    case ("Category"):
                        partName = "Categories";
                        break;
                    default:
                        partName = "";
                        break;
                }

                var orchardServices = workContext.Resolve<IOrchardServices>();
                var name = "";
                if (index < (navigationParts.Count() - 2))
                {
                    var navigationValue = GetNavigationValue(navigationParts[index + 1]);
                    if (navigationValue > 0) {
                        name = GetNavigationName(partName, navigationValue, orchardServices);
                    }
                }

                currentPath = currentPath + "\\" + navigationParts[index];
                index++;
                if (partName != "")
                {
                    navigations.Add(new Navigation { Name = partName, Path = currentPath });
                }
                if(name != "") {
                    navigations.Add(new Navigation { Name = name, Path = "" });
                }
            }

            return navigations;
        }
开发者ID:rgardler,项目名称:dpp,代码行数:55,代码来源:BreadCrumbs.cs

示例3: PageHeadService

 public PageHeadService(WorkContext workContext)
 {
     _wca = workContext.Resolve<IWorkContextAccessor>();
     _cacheManager = new DefaultCacheManager(this.GetType(), new DefaultCacheHolder(new DefaultCacheContextAccessor()));
     _signals = workContext.Resolve<ISignals>();
 }
开发者ID:davegardner,项目名称:Cascade.Head,代码行数:6,代码来源:PageTitleService.cs

示例4: Resolve

 public static Localizer Resolve(WorkContext workContext, string scope)
 {
     return workContext == null ? NullLocalizer.Instance : Resolve(workContext.Resolve<ILifetimeScope>(), scope);
 }
开发者ID:qhme,项目名称:OrchardLite,代码行数:4,代码来源:LocalizationUtilities.cs

示例5: SiteRelativeUrl

        public static string SiteRelativeUrl(this UrlHelper urlHelper, string path, WorkContext workContext)
        {
            var shellSettings = workContext.Resolve<ShellSettings>();

            return urlHelper.Content(string.Format("~/{0}/{1}",shellSettings.RequestUrlPrefix,path.TrimStart('/','~')));
        }
开发者ID:akhurst,项目名称:ricealumni,代码行数:6,代码来源:RiceUrlHelperExtensions.cs


注:本文中的WorkContext.Resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。