public static IList <T> Persist <T>(this IListBuilder <T> listBuilder)
        {
            var list = listBuilder.Build();

            var persistenceService = listBuilder.BuilderSettings.GetPersistenceService();

            persistenceService.Create(list);
            return(list);
        }
Ejemplo n.º 2
0
        public static IList <T> BuildHierarchy <T>(this IListBuilder <T> listBuilder, IHierarchySpec <T> hierarchySpec)
        {
            var list = listBuilder.Build();

            var hierarchy = new HierarchyGenerator <T>(list, hierarchySpec.AddMethod, hierarchySpec.NumberOfRoots, hierarchySpec.Depth,
                                                       hierarchySpec.MinimumChildren, hierarchySpec.MaximumChildren,
                                                       new RandomGenerator(), hierarchySpec.NamingMethod, null).Generate();

            return(hierarchy);
        }
Ejemplo n.º 3
0
        public static IList <T> PersistHierarchy <T>(this IListBuilder <T> listBuilder, IHierarchySpec <T> hierarchySpec)
        {
            // 1. Create
            var list = listBuilder.Build();

            // 2. Reorganise
            var hierarchy = new HierarchyGenerator <T>(list, hierarchySpec.AddMethod, hierarchySpec.NumberOfRoots, hierarchySpec.Depth,
                                                       hierarchySpec.MinimumChildren, hierarchySpec.MaximumChildren,
                                                       new RandomGenerator(), hierarchySpec.NamingMethod, listBuilder.BuilderSetup.GetPersistenceService()).Generate();

            return(hierarchy);
        }
Ejemplo n.º 4
0
 public static List <T> BuildList <T>(this IListBuilder <T> builder) where T : ModelBase, new()
 {
     return(builder.Build().ToList());
 }
 public static ObservableCollection <T> BuildObservable <T>(this IListBuilder <T> buildable)
 {
     return(new ObservableCollection <T>(buildable.Build()));
 }