public static int GenerateGraph(RelationalModelRepository repo, EntityPivot parent, int depth, int maxDepth, int branchSize) { if (depth == maxDepth) return 0; var runningTotalCreated = 0; var children = new List<Relation>(); for (var i = 0; i < branchSize; i++) { var child = new EntityPivot(parent) { Id = Guid.NewGuid() }; var relation = new ContentOneToManyRelation(parent, child); children.Add(relation); children.AddRange(from permissionEntity in GetPermissionEntities(child) let metadata = new RelationMetadata(PermissionRelationType.Default) { {"allow", "read"}, {"deny", "write"} } select new PermissionRelation(metadata, child, permissionEntity)); runningTotalCreated++; runningTotalCreated += GenerateGraph(repo, child, depth + 1, maxDepth, branchSize); } parent.AddAssociates(children); return runningTotalCreated; }
public static int GenerateGraph(RelationalModelRepository repo, EntityPivot parent, int depth, int maxDepth, int branchSize) { if (depth == maxDepth) { return(0); } var runningTotalCreated = 0; var children = new List <Relation>(); for (var i = 0; i < branchSize; i++) { var child = new EntityPivot(parent) { Id = Guid.NewGuid() }; var relation = new ContentOneToManyRelation(parent, child); children.Add(relation); children.AddRange(from permissionEntity in GetPermissionEntities(child) let metadata = new RelationMetadata(PermissionRelationType.Default) { { "allow", "read" }, { "deny", "write" } } select new PermissionRelation(metadata, child, permissionEntity)); runningTotalCreated++; runningTotalCreated += GenerateGraph(repo, child, depth + 1, maxDepth, branchSize); } parent.AddAssociates(children); return(runningTotalCreated); }
public static void Init(TestContext context) { _modelRepository = new RelationalModelRepository(); _pivotRoot = new EntityPivot(_modelRepository) { Id = Guid.Empty }; var timer = new Stopwatch(); timer.Start(); var generateGraph = GraphBuilder.HiveGraphBuilder.GenerateGraph(_modelRepository, _pivotRoot, 0, 10, 15); Console.WriteLine("{0} EntityPivots created in {1}ms", generateGraph, timer.ElapsedMilliseconds); }
public static void Init(TestContext context) { _modelRepository = new RelationalModelRepository(); _pivotRoot = new EntityPivot(_modelRepository) { Id = Guid.Empty }; var timer = new Stopwatch(); timer.Start(); var generateGraph = GraphBuilder.HiveGraphBuilder.GenerateGraph(_modelRepository, _pivotRoot, 0, 10, 15); Console.WriteLine("{0} EntityPivots created in {1}ms", generateGraph, timer.ElapsedMilliseconds); }