Exemple #1
0
        protected override void Seed(SignalTest.Context.RefreshDataContext context)
        {
            var totalInDb = context.DummyInformations.Count();

            if (totalInDb < 10000000)
            {
                var ctx = new RefreshDataContext();
                ctx.Configuration.AutoDetectChangesEnabled = false;
                ctx.Configuration.ValidateOnSaveEnabled    = false;
                for (int i = 0; i < 10000000 - totalInDb; i++)
                {
                    ctx.DummyInformations.Add(new DummyInformation {
                        Information = i
                    });
                    if (i % 100000 == 0)
                    {
                        ctx.SaveChanges();
                        ctx.Dispose();
                        ctx = new RefreshDataContext();
                        ctx.Configuration.AutoDetectChangesEnabled = false;
                        ctx.Configuration.ValidateOnSaveEnabled    = false;
                    }
                }

                ctx.SaveChanges();
            }
        }
Exemple #2
0
 public void Stop(bool immediate)
 {
     SqlDependency.Stop(context.Database.Connection.ConnectionString);
     context.Dispose();
     HostingEnvironment.UnregisterObject(this);
 }