Exemplo n.º 1
0
        public static void Initialize(ProjectAPIContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            // Look for any Products
            if (context.Projects.Any())
            {
                return;   // DB has been seeded
            }

            List <Project> pros = new List <Project>
            {
                new Project {
                    Id = 1, Name = "DBDEXAM", DepartmentNumber = 1
                },
                new Project {
                    Id = 2, Name = "SYSEXAM", DepartmentNumber = 1
                },
                new Project {
                    Id = 3, Name = "CA1", DepartmentNumber = 2
                },
                new Project {
                    Id = 4, Name = "CA2", DepartmentNumber = 2
                }
            };

            context.Projects.AddRange(pros);
            context.SaveChanges();
        }
 public SqlProjectAPIRepo(ProjectAPIContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public ProjectRepository(ProjectAPIContext context)
 {
     db = context;
     db.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
 }