示例#1
0
        protected override void OnApplicationStarted()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            Database.SetInitializer<EmpDBContext>(null);

            EmpDBContext db = new EmpDBContext();
            db.Database.CreateIfNotExists();
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     dbContext = new EmpDBContext(@"Data Source=.\SQLEXPRESS; Integrated Security=SSPI; Initial Catalog=TestDB; AttachDbFilename=C:\Users\Usha\documents\visual studio 2010\Projects\HTMLControlsTest\HTMLControlsTest\App_Data\TestDB.mdf;");
     dbContext.Database.CreateIfNotExists();
 }