Пример #1
0
        public string OnCommand(List <string> args)
        {
            LogInfo("Starting...");

            if (args != null && args.Any())
            {
                string coreConnString = ConfigurationManager.AppSettings["CoreDB_ConnectionString"];

                switch (args[0].ToLower())
                {
                case "createdbs":
                    TestDb.DeployDacpac("scNET_Core", coreConnString, "scNET_Core.dacpac", true);
                    break;

                case "deletedbs":
                    TestDb.DropTestDB("scNET_Core", coreConnString);
                    break;

                case "deletecoredb":
                    TestDb.DropTestDB("scNET_Core", coreConnString);
                    break;

                case "createandinitdbs":
                    TestDb.DeployDacpac("scNET_Core", coreConnString, "scNET_Core.dacpac", true);
                    InitializeCoreTestDb.Initialize(string.Format(coreConnString, "scNET_Core"));
                    break;

                case "createandinitcoredb":
                    TestDb.DeployDacpac("scNET_Core", coreConnString, "scNET_Core.dacpac", true);
                    InitializeCoreTestDb.Initialize(string.Format(coreConnString, "scNET_Core"));
                    break;

                case "initdbs":
                case "control_130":
                    InitializeCoreTestDb.Initialize(string.Format(coreConnString, "scNET_Core"));
                    break;

                case "deleteandinit":
                case "control_129":
                    DateTime start = DateTime.UtcNow;
                    TestDb.DropTestDB("scNET_Core", coreConnString);
                    TestDb.DeployDacpac("scNET_Core", coreConnString, "scNET_Core.dacpac", true);
                    LogInfo("Initializing scNET_Core Database Please Wait.....");
                    InitializeCoreTestDb.Initialize(string.Format(coreConnString, "scNET_Core"));
                    LogInfo("DONE completed in: " + (DateTime.UtcNow - start).TotalSeconds + " seconds");
                    break;

                case "exit":
                case "control_128":
                    bQuit = true;
                    break;

                default:
                    LogInfo("Syntax Error");
                    break;
                }

                LogInfo(args[0].ToLower() + " Complete");
            }

            return("OK");
        }