Пример #1
0
        public GraphLinkManager(string context)
        {
            _graph = new SitecoreGraph();

            var computedLinkItems = new List<IComputedLinkItem>();

            computedLinkItems.Add(new AncestorComputedLinkItem("team", "ground"));
            computedLinkItems.Add(new DescendantComputedLinkItem("staff", "team"));

            _computedLinkManager = new SitecoreComputedLinkManager(computedLinkItems);

            List<BaseRelationship> relationships = new List<BaseRelationship>();

            relationships.Add(new SitecoreTemplateRelationship() { SubjectTemplateName = "league", Name = "league_to_team", ObjectTemplateName = "team" });
            relationships.Add(new SitecoreTemplateRelationship() { SubjectTemplateName = "team", Name = "team_to_player", ObjectTemplateName = "player" });
            relationships.Add(new SitecoreTemplateRelationship() { SubjectTemplateName = "newsstory", Name = "news_to_item", ObjectTemplateName = "*" });
            relationships.Add(new SitecoreTemplateRelationship() { SubjectTemplateName = "ground", Name = "home_of_team", ObjectTemplateName = "team" });
            relationships.Add(new SitecoreTemplateRelationship() { SubjectTemplateName = "team", Name = "team_staff", ObjectTemplateName = "staff" });
            
            IRelationshipProvider relationshipProvider = new RelationshipProvider(relationships);

            _relationshipManager = new RelationshipManager(relationshipProvider);

            Context = context;
        }
Пример #2
0
        public SitecoreGraphTest()
        {
            //Use an IoC container and register as a Singleton
            var url = "http://192.168.99.100:32769/db/data";
            var user = "******";
            var password = "******";

            var client = new GraphClient(new Uri(url), user, password);

            _graph = new SitecoreGraph();
        }