Пример #1
0
 protected override void OnModelCreating(ModelBuilder builder)
 {
     User.OnModelCreating(this, builder);
     TodoItem.OnModelCreating(this, builder);
     FileRef.OnModelCreating(this, builder);
     StatusSet.OnModelCreating(this, builder);
     ProjectOwner.OnModelCreating(this, builder);
 }
Пример #2
0
        /// <summary>
        /// [Dev] Seed the Status table with statuses
        /// </summary>
        public void DevSeedStatuses()
        {
            var newStatusSet = new StatusSet("Test Status Set");

            newStatusSet.Add("TODO", "FF0000");
            newStatusSet.Add("In Progress", "FFFF00");
            newStatusSet.Add("Complete", "00FF00");

            StatusSets.Add(newStatusSet);
            SaveChanges();

            foreach (var ss in StatusSets)
            {
                EnsureDeepLoaded(Entry(ss));
                System.Console.WriteLine("---" + ss.ToString());
            }
        }
Пример #3
0
        /// <summary>
        /// [Dev] Seed the Todo table with an item.
        /// </summary>
        public void DevSeedTodoItem()
        {
            while (TodoItems.Any())
            {
                TodoItems.Remove(TodoItems.First());
            }
            TodoItem newItem = new TodoItem();

            newItem.Name = "Do The Thing";
            Project proj = Projects.First();

            newItem.Project = proj;
            StatusSet statusSet = proj.ValidStatuses;

            newItem.Status = statusSet.Statuses[0];
            ChangeTracker.TrackGraph(newItem, node => node.Entry.State = node.Entry.IsKeySet ? EntityState.Unchanged : EntityState.Added);
            SaveChanges();


            /*
             * var newFile = new FileRef("test/file.jpg");
             *
             * var user = Users.FirstOrDefault();
             * var statusSet = StatusSets.FirstOrDefault();
             *
             * var project = Projects.FirstOrDefault();
             * if (project == null) {
             *  System.Console.WriteLine(" !!! Tried to create Todo without project");
             *  return;
             * }
             * EnsureDeepLoaded(Entry(project));
             * EnsureDeepLoaded(Entry(project.ValidStatuses));
             * var initItem = new TodoItem(project, project.ValidStatuses.Statuses[0]);
             * initItem.Name = "Init Item";
             * initItem.Project = Projects.FirstOrDefault();
             * initItem.Files.Add(newFile);
             * initItem.Tags = "mojo;josie;kibby";
             * if (user != null) initItem.Assignee = user;
             * else System.Console.WriteLine("NULL USER");
             * TodoItems.Add(initItem);
             * SaveChanges();*/
        }