protected void Seed(T context) { EntityInitializer initializer = InitializerFactory.GetEntityInitializerFor <T>(); initializer.Seed(context); context.SaveChanges(); }
public static void SetEntityInitializer <T>(EntityInitializer entityInitializer) where T : DbContext { if (_entityInitializers.ContainsKey(typeof(T))) { _entityInitializers.Remove(typeof(T)); } _entityInitializers.Add(typeof(T), entityInitializer); }