I'm working with Tridion 2009. When I publish a component I expect that it will be publish the dynamic components template related. But, it is also publishing the components where is used. I have a component that takes 20 minutes to publish because it is being used in several components. To solve this problem, I have implemented a custom resolver to try to publish just the component that I wish... I get it! :) but the component still takes 20 minutes to publish...
How can I render & publish just the component that I want?
I add my code maybe it will help:
public class GetElementsToPublish : IResolver
{
public const string SCHEMA_SEO = "164";
public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext context, Tridion.Collections.ISet<ResolvedItem> resolvedItems) {
if (item is Component)
{
Component component = (Component)item;
switch (component.Schema.Id.ItemId.ToString())
{
case (SCHEMA_SEO):
//instruction.IncludeComponentLinks = false;
SeoResolver.**GetComponentsToPublishBySEO**(resolvedItems, item);
break;
}
}
}
}
public class SeoResolver
{
//No me interesa que publique nada del "where is used"
public static Tridion.Collections.ISet<ResolvedItem> GetComponentsToPublishBySEO(Tridion.Collections.ISet<ResolvedItem> resolvedItems, IdentifiableObject item)
{
List<ResolvedItem> addItems = new List<ResolvedItem>();
foreach (ResolvedItem itemR in resolvedItems)
{
if (itemR.Item.Id.ItemId.Equals(item.Id.ItemId))
{
addItems.Add(itemR);
}
}
foreach (ResolvedItem addItem in addItems)
{
resolvedItems.Remove(addItem);
}
return resolvedItems;
}
}
After the component has been published, I can see just the component that I want has been successfully published. But, when I check the "see items to publish" the related components are still there... :( Thank you!