Updating undeclared attributes

Jan 7, 2013 at 2:27 PM
Edited Jan 8, 2013 at 6:23 AM

Hi,

First of all I'd like to say that I greatly appreciate the Resouce Management Client. It makes my life a whole lot easier. 

I would like to ask about your opinions on a small modification I've done in one of your methods. 

First let me explain:

I have an interest in keeping my identity objects dynamic, so my code does not have to be updated every time the FIM schema updates, which is why I am primarily using the RmResource object to handle my identities. this gives some challenges when updating null attributes in FIM, as the Resource Management framework needs to know the attribute to update it (if null). The reason for my need is that I am providing my business with an easy(simplified) service for reading/updating users, where I use my own simple object types.

To solve this I've replaced the line (in the static method RmResourceChanges.GetDifference(...)): 

 

changedAttributes.Add(new RmAttributeChange(sourceItem.Key, null, RmAttributeChangeOperation.Replace));

with:

changedAttributes.Add(new RmAttributeChange(sourceItem.Key, sourceItem.Value.Value, RmAttributeChangeOperation.Replace));

//Or the fancy way:

if (sourceValue.Value == null)
{
      changedAttributes.Add(new RmAttributeChange(sourceItem.Key, null, RmAttributeChangeOperation.Replace));
}
else
{
      changedAttributes.Add(new RmAttributeChange(sourceItem.Key, sourceItem.Value.Value, RmAttributeChangeOperation.Replace));
}

What is your thoughts and comments on this? I am sure the value is set to null for a purpose.