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); } } }
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); }