Example #1
0
        protected override void Seed(TaskList.Db.AuthContext context)
        {
            DbSampleData data = new DbSampleData();

            data.Init(context);
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.
        }
        protected void initializeApplication()
        {
            _factory.CreateClient(); // It'll initialize the server
            using (var scope = _factory.Server.Host.Services.CreateScope())
            {
                var db = scope.ServiceProvider.GetRequiredService <BlogContext>();

                DbSampleData.Initialize(db,
                                        scope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >(),
                                        scope.ServiceProvider.GetRequiredService <UserManager <User> >(),
                                        scope.ServiceProvider.GetRequiredService <SignInManager <User> >());
            }
        }