Guest User

Untitled

a guest
Feb 23rd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public class GetDatasourceDependencies : BaseProcessor
  2. {
  3. public override void Process(GetDependenciesArgs context)
  4. {
  5. Func<ItemUri, bool> func = null;
  6. Assert.IsNotNull(context.IndexedItem, "indexed item");
  7. Assert.IsNotNull(context.Dependencies, "dependencies");
  8. Item item = (Item)(context.IndexedItem as SitecoreIndexableItem);
  9.  
  10. if (item != null)
  11. {
  12. if (func == null)
  13. {
  14. func = uri => (bool)((uri != null) && ((bool)(uri != item.Uri)));
  15. }
  16. System.Collections.Generic.IEnumerable<ItemUri> source = Enumerable.Where<ItemUri>(from l in Globals.LinkDatabase.GetReferrers(item, FieldIDs.LayoutField) select l.GetSourceItem().Uri, func).Distinct<ItemUri>();
  17. context.Dependencies.AddRange(source.Select(x => (SitecoreItemUniqueId)x));
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment