// 1 -> 2 -> 4 -> 6 -> 7 // -> 5 // -> 3 -> 7 // -> 3 -> 7 protected void CreateGraph(IDomainModel domain, Action settings = null) { var graph = domain.Resolve <IHyperGraph>(); var ids = new Identity[8]; var mid = domain.Store.GetSchemaEntity <XExtendsBaseClass>(); using (var session = domain.Store.BeginSession()) { for (int i = 1; i <= 7; i++) { ids[i] = Id(i); graph.CreateEntity(ids[i], mid); } var cx = 8; var rid = domain.Store.GetSchemaRelationship <XReferencesX>(); graph.CreateRelationship(Id(cx++), rid, ids[1], ids[2]); graph.CreateRelationship(Id(cx++), rid, ids[1], ids[3]); graph.CreateRelationship(Id(cx++), rid, ids[2], ids[4]); graph.CreateRelationship(Id(cx++), rid, ids[2], ids[5]); graph.CreateRelationship(Id(cx++), rid, ids[2], ids[3]); graph.CreateRelationship(Id(cx++), rid, ids[4], ids[6]); graph.CreateRelationship(Id(cx++), rid, ids[6], ids[7]); graph.CreateRelationship(Id(cx++), rid, ids[3], ids[7]); session.AcceptChanges(); } }
protected void Configure(IDomainModel domainModel) { DebugContract.Requires(domainModel); if (_domainModel != null) { return; } _trace = domainModel.Resolve <IHyperstoreTrace>(false) ?? new EmptyHyperstoreTrace(); _domainModel = domainModel; var kv = _services.Resolve <IKeyValueStore>() ?? new Hyperstore.Modeling.MemoryStore.TransactionalMemoryStore(domainModel); _storage = kv; if (kv is IDomainService) { ((IDomainService)kv).SetDomain(domainModel); } _indexManager = new Hyperstore.Modeling.HyperGraph.Index.MemoryIndexManager(this); // TODO lier avec TransactionalMemoryStore _loader = _services.Resolve <IGraphAdapter>(); if (_loader is IDomainService) { ((IDomainService)_loader).SetDomain(domainModel); } _lazyLoader = _loader as ISupportsLazyLoading; }