public void Dispose()
 {
     try
     {
         // Ensure LocalDb databases are deleted after use so that LocalDb doesn't throw if
         // the temp location in which they are stored is later cleaned.
         using (var context = new EFCustomerRepository(_databaseName))
         {
             context.Database.Delete();
         }
     }
     finally
     {
         AppDomain.CurrentDomain.SetData("DataDirectory", _previousDataDirectory);
     }
 }
        public override void Publish(string dbconnection, string data, bool sample, string strategy = SqlDbConfiguration.SqlAzureExecutionStrategy)
		{
			base.Publish(dbconnection, data, sample, strategy);
			string connection = dbconnection;
			SafeWriteDebug("ConnectionString: " + connection);

			using (var db = new EFCustomerRepository(connection))
			{
				if (sample)
				{
					SafeWriteVerbose("Running sample scripts");
					new SqlCustomerDatabaseInitializer().InitializeDatabase(db);
				}
				else
				{
					SafeWriteVerbose("Running minimum scripts");
					new SetupMigrateDatabaseToLatestVersion<EFCustomerRepository, Configuration>().InitializeDatabase(db);
				}
			}
		}
		private ICustomerRepository GetRepository()
		{
			//var retVal = new DSCustomerClient(service.ServiceUri, new CustomerEntityFactory());
            var retVal = new EFCustomerRepository("VirtoCommerce", new CustomerEntityFactory());
			return retVal;
		}
        private ICustomerRepository GetRepository()
        {
			EnsureDatabaseInitialized(() => new EFCustomerRepository(_databaseName), () => Database.SetInitializer(new SetupMigrateDatabaseToLatestVersion<EFCustomerRepository, Configuration>()));
            var retVal = new EFCustomerRepository(_databaseName);
            return retVal;
        }