Using MDSEntityCCRUDOperation Add Entity - how can i get the code generates in MDS

Oct 18, 2012 at 7:09 PM

Hi David

I am using your MDSEntityCRUDOperations.cs and after adding the entity i would like to know how can i get the code which is generated automatically in the entity assuming i have code auto generated specified in MDS.

Thanks

Sachin

Coordinator
Oct 18, 2012 at 10:28 PM

Good catch.  That API needs an update for the Autogenerated code functionality.

Checked it in and AddMember now looks like this:

 

    public string AddMember(string code, IDictionary<string, object> values)
    {
      return AddMember(CreateMemberFromAttributes(code, values));
    }
    protected string AddMember(Member member)
    {

      var members = new EntityMembers() { Members = new List<Member>(1) };
      members.ModelId = new Identifier() { Id = ModelId };
      members.VersionId = new Identifier() { Id = VersionId };
      members.EntityId = new Identifier() { Name = EntityName };

      members.Members.Add(member);
      OperationResult rc;
      var ids = client.EntityMembersCreate(new International(), members,true,out rc);
      if (rc.Errors.Count > 0)
      {
        throw new InvalidOperationException(rc.Errors[0].Description);
      }

      return ids[0].Code;     
    }

David

Oct 22, 2012 at 2:20 PM

Hi David

Thanks for replying back, it took me some time while waiting for you but i figured that. Its good that you took some time as i did it myself and after you replied i am confirmed what i did was right.

Thanks again !!!

Sachin