Changing how the versioned compliment to the CommonPart is welded to the content type in question so as to not have potentially odd problems with an ActivatingFilter applied CommonPart

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-29 10:24:28 -08:00
parent a1c8765fa0
commit 3827c90f41

View File

@@ -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);