コード例 #1
0
        public static void Seed(ProposeContext context)
        {
            context.Tenants.AddOrUpdate(x => x.Name, new Tenant()
            {
                Name = "Default"
            });

            context.SaveChanges();
        }
コード例 #2
0
        public static void Seed(ProposeContext context)
        {
            var systemRole = context.Roles.First(x => x.Name == Roles.SYSTEM);
            var roles      = new List <Role>();
            var tenant     = context.Tenants.Single(x => x.Name == "Default");

            roles.Add(systemRole);
            context.Users.AddOrUpdate(x => x.Username, new User()
            {
                Username = "******",
                Password = new EncryptionService().TransformPassword("system"),
                Roles    = roles,
                TenantId = tenant.Id
            });

            context.SaveChanges();
        }
コード例 #3
0
        public static void Seed(ProposeContext context)
        {
            context.Roles.AddOrUpdate(x => x.Name, new Role()
            {
                Name = Roles.SYSTEM
            });

            context.Roles.AddOrUpdate(x => x.Name, new Role()
            {
                Name = Roles.PRODUCT
            });

            context.Roles.AddOrUpdate(x => x.Name, new Role()
            {
                Name = Roles.DEVELOPMENT
            });

            context.SaveChanges();
        }