Projection FieldIndexPartHandler welding FieldIndexPart to all new content items.

Topics: Troubleshooting
Nov 5, 2012 at 2:04 PM

Not sure if this is a bug or not. Just noticed when creating any new content item via code when projections module is enabled that the new content item always gets the FieldIndexPart welded to it. Shouldn't this part only be welded if the content type has any parts that have fields added?

I think the problem may be in the Projections/Handlers/FieldIndexPartHandler.cs class

 protected override void Activating(ActivatingContentContext context) {


            // weld the FieldIndexPart dynamically, if a field has been assigned to one of its parts
            var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(context.ContentType);
            if (contentTypeDefinition == null)
            if (contentTypeDefinition.Parts.Any(p => p.PartDefinition.Fields.Any())) {

In that code it looks to me like the first call to context.Builder.Weld<FieldIndexPart>() really should be there. Any reason why it is?

Nov 5, 2012 at 11:32 PM

I agree, shouldn't be there. Some debugging code that maybe I forgot to remove ...

Nov 8, 2012 at 12:07 PM

I've created an issue for this, resolved it and generated a pull request.