コード例 #1
0
        public DogTest()
        {
            var          context = new BlogContext(dbContextOptions);
            InicializeDB db      = new InicializeDB();

            db.Seed(context);
            repository = new Repository <Dog, int>(context);
        }
コード例 #2
0
        public static async Task Main(string[] args)
        {
            var init = BuildWebHost(args);

            using (var scope = init.Services.CreateScope())
            {
                var s            = scope.ServiceProvider;
                var c            = s.GetRequiredService <StoreContext>();
                var userManager  = s.GetRequiredService <UserManager <User> >();
                var rolesManager = s.GetRequiredService <RoleManager <IdentityRole> >();
                await InicializeDB.InitializeAsync(userManager, rolesManager, c);
            }

            init.Run();
        }