mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -35,6 +35,7 @@ using Orchard.Users.Services;
|
||||
using Orchard.Users.ViewModels;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Core.Settings.Services;
|
||||
using Orchard.Environment.Configuration;
|
||||
|
||||
namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
[TestFixture]
|
||||
@@ -68,6 +69,7 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<Signals>().As<ISignals>();
|
||||
builder.RegisterInstance(new ShellSettings { Name = "Alpha", RequestUrlHost = "wiki.example.com", RequestUrlPrefix = "~/foo" });
|
||||
|
||||
_authorizer = new Mock<IAuthorizer>();
|
||||
builder.RegisterInstance(_authorizer.Object);
|
||||
|
@@ -35,8 +35,6 @@ namespace Orchard.Core.Common.Handlers {
|
||||
Filters.Add(StorageFilter.For(commonRepository));
|
||||
Filters.Add(StorageFilter.For(commonVersionRepository));
|
||||
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(ContentTypeWithACommonPart));
|
||||
|
||||
OnInitializing<CommonPart>(PropertySetHandlers);
|
||||
OnInitializing<CommonPart>(AssignCreatingOwner);
|
||||
OnInitializing<CommonPart>(AssignCreatingDates);
|
||||
@@ -61,6 +59,11 @@ namespace Orchard.Core.Common.Handlers {
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void Activating(ActivatingContentContext context) {
|
||||
if (ContentTypeWithACommonPart(context.ContentType))
|
||||
context.Builder.Weld<ContentPart<CommonPartVersionRecord>>();
|
||||
}
|
||||
|
||||
bool ContentTypeWithACommonPart(string typeName) {
|
||||
//Note: What about content type handlers which activate "CommonPart" in code?
|
||||
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(typeName);
|
||||
|
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
public interface IFoo{}
|
||||
public static class ContainerExtensions {
|
||||
/// <summary>
|
||||
/// This method performed by Erik Weisz.
|
||||
@@ -12,7 +13,7 @@ namespace Orchard.Mvc.Html {
|
||||
var workContext = html.ViewContext.RequestContext.GetWorkContext();
|
||||
|
||||
if (workContext == null)
|
||||
return default(TService);
|
||||
throw new ApplicationException(string.Format(@"The WorkContext cannot be found for the request. Unable to resolve '{0}'.", typeof(TService)));
|
||||
|
||||
return workContext.Resolve<TService>();
|
||||
}
|
||||
|
Reference in New Issue
Block a user