private void FillScripts(EFSecurityRepository context)
        {
			RunCommand(context, "FillRequiredCaseProperties.sql", "Security");
			RunCommand(context, "FillTestAccounts.sql", "Security");

			context.Accounts.First(a => a.AccountId == "1").StoreId = "SampleStore";
        }
        public override void Publish(string dbconnection, string data, bool sample, bool reduced, string strategy = SqlDbConfiguration.SqlAzureExecutionStrategy)
		{
			base.Publish(dbconnection, data, sample, reduced, strategy);
			string connection = dbconnection;
			SafeWriteDebug("ConnectionString: " + connection);

            try
            {
                using (var db = new EFSecurityRepository(connection))
                {
                    if (sample)
                    {
                        SafeWriteVerbose("Running sample scripts");
                        new SqlSecuritySampleDatabaseInitializer().InitializeDatabase(db);
                    }
                    else
                    {
                        SafeWriteVerbose("Running minimum scripts");
                        new SqlSecurityDatabaseInitializer().InitializeDatabase(db);
                    }
                }
            }
            catch (Exception ex)
            {
                SafeThrowError(ex);
            }
		}
Ejemplo n.º 3
0
		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 EFSecurityRepository(_databaseName))
				{
					context.Database.Delete();
				}
			}
			finally
			{
				AppDomain.CurrentDomain.SetData("DataDirectory", _previousDataDirectory);
			}
		}
 protected override void Seed(EFSecurityRepository context)
 {
     base.Seed(context);
     FillScripts(context);
 }
Ejemplo n.º 5
0
        private ISecurityRepository GetRepository()
		{
			EnsureDatabaseInitialized(() => new EFSecurityRepository(_databaseName), () => Database.SetInitializer(new SetupMigrateDatabaseToLatestVersion<EFSecurityRepository, Configuration>()));
			var retVal = new EFSecurityRepository(_databaseName);
			return retVal;
		}