コード例 #1
0
        // Update the attribute name.
        private static void UpdateAttribute(Guid modelId, Guid entityId, Guid attributeId, string newAttributeName)
        {
            try
            {
                // Create the request object for updating attribute information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata            = new Metadata();
                updateRequest.Metadata.Attributes = new System.Collections.ObjectModel.Collection <MetadataAttribute> {
                };
                // Set model id, entity id, attribute id, and new attribute name.
                MetadataAttribute anAttribute = new MetadataAttribute {
                    Identifier = new MemberTypeContextIdentifier {
                        Name = newAttributeName, Id = attributeId, ModelId = new Identifier {
                            Id = modelId
                        }, EntityId = new Identifier {
                            Id = entityId
                        }, MemberType = MDSTestService.MemberType.Leaf
                    }
                };
                updateRequest.Metadata.Attributes.Add(anAttribute);

                // Update the attribute information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #2
0
        // Update the entity name.
        private static void UpdateEntity(Guid modelId, Guid entityId, string newEntityName)
        {
            try
            {
                // Create the request object for updating entity information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata          = new Metadata();
                updateRequest.Metadata.Entities = new System.Collections.ObjectModel.Collection <Entity> {
                };
                Entity anEntity = new Entity();

                // Set model id, entity id, and the new entity name.
                anEntity.Identifier = new ModelContextIdentifier {
                    Id = entityId, Name = newEntityName, ModelId = new Identifier {
                        Id = modelId
                    }
                };
                updateRequest.Metadata.Entities.Add(anEntity);

                // Update the entity information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #3
0
        // Update the model name.
        private static void UpdateModel(Guid modelId, string newModelName)
        {
            try
            {
                // Create the request object for updating model information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata        = new Metadata();
                updateRequest.Metadata.Models = new System.Collections.ObjectModel.Collection <Model> {
                };
                Model aModel = new Model();
                aModel.Identifier = new Identifier {
                    Id = modelId, Name = newModelName
                };
                updateRequest.Metadata.Models.Add(aModel);

                // Update the model information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: NadirTP/tpGit
        private static void SetApprovalRequired(string modelName, string entityName, bool approvalRequired)
        {
            var updateRequest = new MetadataUpdateRequest
            {
                Metadata = new Metadata
                {
                    Entities = new Collection <Entity>
                    {
                        new Entity
                        {
                            Identifier = new ModelContextIdentifier
                            {
                                Name    = entityName,
                                ModelId = new Identifier {
                                    Name = modelName
                                }
                            },
                            RequireApproval = approvalRequired
                        }
                    }
                }
            };

            MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

            HandleOperationErrors(updateResponse.OperationResult);
        }
コード例 #5
0
        public BasicResponse <MetadataInfo> UpdateMetadata(MetadataUpdateRequest metadatarequest)
        {
            var _metadata = ObjectConverter.Copy <MetadataInfo, MetadataModel>(metadatarequest.MetadataInfo);

            _Repository.UpdateMetadata(_metadata);
            var metadataresponse = new BasicResponse <MetadataInfo>();

            metadataresponse.Data = ObjectConverter.Copy <MetadataModel, MetadataInfo>(_metadata);
            return(metadataresponse);
        }
コード例 #6
0
        // Update the model name.
        private static void UpdateModel(Guid modelId, string newModelName)
        {
            try
            {
                // Create the request object for updating model information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata = new Metadata();
                updateRequest.Metadata.Models = new System.Collections.ObjectModel.Collection<Model> { };
                Model aModel = new Model();
                aModel.Identifier = new Identifier { Id = modelId, Name = newModelName };
                updateRequest.Metadata.Models.Add(aModel);

                // Update the model information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #7
0
        // Update the entity name.
        private static void UpdateEntity(Guid modelId, Guid entityId, string newEntityName)
        {
            try
            {
                // Create the request object for updating entity information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata = new Metadata();
                updateRequest.Metadata.Entities = new System.Collections.ObjectModel.Collection<Entity> { };
                Entity anEntity = new Entity();

                // Set model id, entity id, and the new entity name.
                anEntity.Identifier = new ModelContextIdentifier { Id = entityId, Name = newEntityName, ModelId = new Identifier { Id = modelId } };
                updateRequest.Metadata.Entities.Add(anEntity);

                // Update the entity information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #8
0
        // Update the attribute group name and add an attribute to it.
        private static void UpdateAttributeGroup(Guid modelId, Guid entityId, Guid attributeGroupId, string newAttributeGroupName, Guid attributeId)
        {
            try
            {
                // Create the request object for updating attribute group information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata = new Metadata();
                updateRequest.Metadata.AttributeGroups = new System.Collections.ObjectModel.Collection<AttributeGroup> { };
                // Set model id, entity id, attribute group id, and new attribute group name.
                AttributeGroup anAttributeGroup = new AttributeGroup { Identifier = new MemberTypeContextIdentifier { Name = newAttributeGroupName, Id = attributeGroupId, ModelId = new Identifier { Id = modelId }, EntityId = new Identifier { Id = entityId }, MemberType = MDSTestService.MemberType.Leaf } };
                // Add the attribute object with the attribute id.
                anAttributeGroup.Attributes = new System.Collections.ObjectModel.Collection<MetadataAttribute> { };
                MetadataAttribute anAttribute = new MetadataAttribute { Identifier = new MemberTypeContextIdentifier { Id = attributeId } };
                anAttributeGroup.Attributes.Add(anAttribute);
                updateRequest.Metadata.AttributeGroups.Add(anAttributeGroup);

                // Update the attribute group information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #9
0
        private static void SetApprovalRequired(string modelName, string entityName, bool approvalRequired)
        {
            var updateRequest = new MetadataUpdateRequest
            {
                Metadata = new Metadata
                {
                    Entities = new Collection<Entity>
                    {
                        new Entity
                        {
                            Identifier = new ModelContextIdentifier
                            {
                                Name = entityName,
                                ModelId = new Identifier {Name = modelName}
                            },
                            RequireApproval = approvalRequired
                        }
                    }
                }
            };

               MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);
               HandleOperationErrors(updateResponse.OperationResult);
        }