OnSeed() private method

private OnSeed ( DbContext context ) : void
context DbContext
return void
Exemplo n.º 1
0
        internal override void SeedDatabase()
        {
            Debug.Assert(!_calledByCreateDatabase);

            using (var context = _usersContextInfo.CreateInstance())
            {
                _configuration.OnSeed(context);

                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        internal override void SeedDatabase()
        {
            // Context may not be constructable when Migrations is being called by DbContext CreateDatabase
            // and the config cannot have Seed data anyway, so avoid creating the context to seed.
            if (!_calledByCreateDatabase)
            {
                using (var context = _usersContextInfo.CreateInstance())
                {
                    _configuration.OnSeed(context);

                    context.SaveChanges();
                }
            }
        }