本文整理汇总了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);
}
示例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;
}
示例3: PageHeadService
public PageHeadService(WorkContext workContext)
{
_wca = workContext.Resolve<IWorkContextAccessor>();
_cacheManager = new DefaultCacheManager(this.GetType(), new DefaultCacheHolder(new DefaultCacheContextAccessor()));
_signals = workContext.Resolve<ISignals>();
}
示例4: Resolve
public static Localizer Resolve(WorkContext workContext, string scope)
{
return workContext == null ? NullLocalizer.Instance : Resolve(workContext.Resolve<ILifetimeScope>(), scope);
}
示例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('/','~')));
}