コード例 #1
0
        protected override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            bool?hasNotes = null;

            switch (this.ParameterSetName)
            {
            case NewEntityParameterSet:
            case NewActivityParameterSet:
                if (IsActivity)
                {
                    hasNotes = true;
                }

                EntityMetadata          internalEntity    = BuildEntity();
                StringAttributeMetadata internalAttribute = BuildAttribute();

                Guid objectId1 = _repository.AddEntity(internalEntity, internalAttribute, hasNotes, null);
                if (PassThru)
                {
                    WriteObject(_repository.GetEntity(objectId1));
                }

                break;

            case NewEntityByInputObjectParameterSet:
                if (InputObject.IsActivity.GetValueOrDefault())
                {
                    hasNotes = true;
                }

                Guid objectId2 = _repository.AddEntity(InputObject, PrimaryAttribute, hasNotes, null);
                if (PassThru)
                {
                    WriteObject(_repository.GetEntity(objectId2));
                }

                break;

            default:
                break;
            }
        }