コード例 #1
0
        private static void SeedUsers(AuthServerContext context)
        {
            var users = new List <User>
            {
                new User
                {
                    FirstName = "pierwszy",
                    LastName  = "pierwszy",
                    Login     = "******",
                    Password  = "******",
                    Status    = 0
                },
                new User {
                    FirstName = "drugi", LastName = "drugi", Login = "******", Password = "******", Status = 0
                },
                new User
                {
                    FirstName = "trzeci",
                    LastName  = "trzeci",
                    Login     = "******",
                    Password  = "******",
                    Status    = 0
                },
                new User
                {
                    FirstName = "czwarty",
                    LastName  = "czwarty",
                    Login     = "******",
                    Password  = "******",
                    Status    = 0
                }
            };

            context.Set <User>().AddRange(users);
            context.SaveChanges();
        }
コード例 #2
0
        public static void Seed(AuthServerContext context)
        {
            SeedUsers(context);

            SeedProjects(context);
        }
コード例 #3
0
        private static void SeedProjects(AuthServerContext context)
        {
            var data = new List <Project>
            {
                new Project
                {
                    Information = new ClientInformation {
                        ContactData = "contactData1"
                    },
                    Name         = "name1",
                    ProjectUsers =
                        new List <ProjectUser>
                    {
                        new ProjectUser {
                            UserId = 1
                        },
                        new ProjectUser {
                            UserId = 2
                        },
                        new ProjectUser {
                            UserId = 3
                        }
                    }
                },
                new Project
                {
                    Information = new ClientInformation {
                        ContactData = "contactData2"
                    },
                    Name         = "name2",
                    ProjectUsers =
                        new List <ProjectUser> {
                        new ProjectUser {
                            UserId = 2
                        }, new ProjectUser {
                            UserId = 4
                        }
                    }
                },
                new Project
                {
                    Information = new ClientInformation {
                        ContactData = "contactData3"
                    },
                    Name = "name3"
                },
                new Project
                {
                    Information = new ClientInformation {
                        ContactData = "contactData4"
                    },
                    Name = "name4"
                }
            };

            var data1 = new List <Project>
            {
                new Project
                {
                    Name        = "ManagementAppProject",
                    ProjectGuid = new Guid("AC1A551CB011EDB100D1E55BEEF511CE")
                }
            };

            context.Set <Project>().AddRange(data);
            context.Set <Project>().AddRange(data1);
            context.SaveChanges();
        }