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 RefreshThroughSqlDependency()
 {
     HostingEnvironment.RegisterObject(this);
     _uptimeHub = GlobalHost.ConnectionManager.GetHubContext <RefreshDataHub>();
     context    = new RefreshDataContext();
     context.Database.Connection.StateChange += ConnectionChanged;
     context.Database.Initialize(true);
     InitSqlDependency();
 }