public CreateData(int entryCount) { //string connectionString = ConnectionStringHelper.GetSqlCeConnectionString(@"C:\Users\Christian\workspace\KinectMiniApps\Generate DB Data\bin\Debug\Database1.sdf"); using (var con = new Model1Container()) { _context = con; FlushDbData(); CreateCountryEntries(); SaveToDb(); for (int i = 0; i < entryCount; i++) { CreateTravelOffer(i); } SaveToDb(); } }
private void FlushDbData() { using (var context = new Model1Container()) { if (context.Database.Exists()) { //context.Database.ExecuteSqlCommand("alter database " + context.Database.Connection.Database + " set SINGLE_USER WITH ROLLBACK IMMEDIATE"); context.Database.Delete(); } context.Database.CreateIfNotExists(); } }