Exemple #1
0
        protected override void InternalProcessRecord()
        {
            try
            {
                ShouldProcessReason reason;
                bool whatIf = false;
                if (!base.ShouldProcess(null, null, null, out reason))
                {
                    if (reason == ShouldProcessReason.WhatIf)
                    {
                        whatIf         = true;
                        Logger.Verbose = true;
                    }
                }
                Logger.Write("Start Time: {0}", DateTime.Now.ToString());

                ImportTerms import = new ImportTerms(_xml, whatIf);

                switch (ParameterSetName)
                {
                case "TaxonomySession":
                    import.Import(TaxonomySession.Read());
                    break;

                case "TermStore":
                    import.Import(ParentTermStore.Read());
                    break;

                case "Group":
                    import.Import(ParentGroup.Read());
                    break;

                case "TermSet":
                    import.Import(ParentTermSet.Read());
                    break;

                case "Term":
                    import.Import(ParentTerm.Read());
                    break;
                }
            }
            finally
            {
                Logger.Write("Finish Time: {0}", DateTime.Now.ToString());
            }
        }
        protected override void ProcessRecord()
        {
            if (!base.ShouldProcess("Import"))
            {
                return;
            }

            var ctx = base.Context;

            Validate();
            try
            {
                WriteVerbose(string.Format("Start Time: {0}", DateTime.Now.ToString()));

                ImportTermsHelper import = new ImportTermsHelper(this, ctx, _xml);

                switch (ParameterSetName)
                {
                case "Tenant":
                    import.Import();
                    break;

                case "TermStore":
                    import.Import(ParentTermStore.Read());
                    break;

                case "Group":
                    import.Import(ParentGroup.Read());
                    break;

                case "TermSet":
                    import.Import(ParentTermSet.Read());
                    break;

                case "Term":
                    import.Import(ParentTerm.Read());
                    break;
                }
            }
            finally
            {
                WriteVerbose(string.Format("Finish Time: {0}", DateTime.Now.ToString()));
            }
        }