예제 #1
0
        public void FullInstallTest()
        {
            // Change context connection string to test
            ContextManager.Instance.ConnectionString = Jhu.Graywulf.Test.AppSettings.RegistryTestConnectionString;

            var dbi = new DBInstaller();

            dbi.DropDatabase(true);

            dbi.CreateDatabase();

            dbi.CreateSchema();

            using (var context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.AutoCommit))
            {
                // Create a cluster
                var ci      = new ClusterInstaller(context);
                var cluster = ci.Install();

                // Create a federation
                var fi         = new FederationInstaller(cluster);
                var federation = fi.Install();
            }

            //dbi.DropDatabase(true);
        }
예제 #2
0
        public override void Run()
        {
            base.Run();

            Console.Write("Creating cluster... ");

            using (Context context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.ManualCommit))
            {
                try
                {
                    var i = new ClusterInstaller(context);

                    i.Install(true, clusterName, adminUsername, adminEmail, adminPassword);

                    context.CommitTransaction();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Importing xml file failed.");
                    Console.WriteLine(ex.Message);

                    context.RollbackTransaction();
                }
            }

            Console.WriteLine("done.");
        }