コード例 #1
0
        private static void Seed(SwashbuckleODataContext context)
        {
            var clientOne = new Client { Id = 1, Name = "ClientOne" };
            context.Clients.Add(clientOne);
            context.Clients.Add(new Client { Id = 2, Name = "ClientTwo" });

            context.Projects.Add(new Project { ProjectId = 1, ProjectName = "ProjectOne", Client = clientOne });
            context.Projects.Add(new Project { ProjectId = 2, ProjectName = "ProjectTwo", Client = clientOne });

            var customerOne = new Customer { Id = 1, Name = "CustomerOne" };
            context.Customers.Add(customerOne);
            context.Customers.Add(new Customer { Id = 2, Name = "CustomerTwo" });

            context.Orders.Add(new Order { OrderId = SequentialGuidGenerator.Generate(SequentialGuidType.SequentialAtEnd), OrderName = "OrderOne", Customer = customerOne, UnitPrice = 4.0 });
            context.Orders.Add(new Order { OrderId = SequentialGuidGenerator.Generate(SequentialGuidType.SequentialAtEnd), OrderName = "OrderTwo", Customer = customerOne, UnitPrice = 3.5 });
        }