Ejemplo n.º 1
0
 //holding in a form such as List <EDOID>, not as List<string>, makes it possible to identify whether the ID of any part. It would be easier to debug.
 private static void CollectIds(IIDPropertiesProvider obj, List <string> ids)
 {
     foreach (string propertyName in obj.IdProperties)
     {
         string id = (string)PropertyPathHelper.GetValue(obj, propertyName);
         ids.Add(id);
     }
 }
Ejemplo n.º 2
0
 private static void RenameIds(IIDPropertiesProvider obj, List <string> ids, Action <RenameResult> action)
 {
     foreach (string propertyName in obj.IdProperties)
     {
         RenameResult result = RenameId(obj, propertyName, ids);
         if (result.IsIdPropertyRenamed && action != null)
         {
             action(result);
         }
     }
 }
Ejemplo n.º 3
0
        private static RenameResult RenameId(IIDPropertiesProvider obj, string propertyName, List <string> ids)
        {
            RenameResult result = new RenameResult(propertyName);
            string       id     = (string)PropertyPathHelper.GetValue(obj, propertyName);

            if (ids.Contains(id))
            {
                string newId = IDUtils.NewGuid();
                PropertyPathHelper.SetValue(obj, propertyName, newId);
                result.OldId = id;
                result.NewId = newId;
                return(result);
            }
            return(result);
        }
Ejemplo n.º 4
0
 private static void RenameIds(IIDPropertiesProvider obj, List <string> ids)
 {
     RenameIds(obj, ids, null);
 }