Exemplo n.º 1
0
        public void SeedCountries(NetatmoDbContext context)
        {
            var countries = GetAllCountries().GetAwaiter().GetResult();

            context.Countries.AddRange(countries);
            context.SaveChanges();
        }
Exemplo n.º 2
0
        public void SeedEverything(NetatmoDbContext context)
        {
            context.Database.EnsureCreated();
            if (context.Countries.Any())
            {
                return; // Db has been seeded
            }

            SeedUsers(context);
            SeedCountries(context);
        }
Exemplo n.º 3
0
        public void SeedUsers(NetatmoDbContext context)
        {
            var users = new[]
            {
                new User
                {
                    Id           = 1,
                    Uid          = "auth0|5c3369d9b171c101904570ca",
                    AccessToken  = "56102b6fc6aa42f174e5d484|a2a52b7b24acfacf1718f69bbf226620",
                    ExpiresAt    = DateTimeOffset.FromUnixTimeMilliseconds(1550239201963).Date,
                    RefreshToken = "56102b6fc6aa42f174e5d484|73d5b91c1cb4b021fddf91634be0a598"
                }
            };

            context.Users.AddRange(users);
            context.SaveChanges();
        }
Exemplo n.º 4
0
        public static void Initialize(NetatmoDbContext context)
        {
            var initializer = new NetatmoInitializer();

            initializer.SeedEverything(context);
        }