Beispiel #1
0
 public override void Execute()
 {
     ProgressTaskInit(Entities.Count);
     foreach (EntityDefinition entity in Entities)
     {
         ProgressTaskStart("Processing entity: " + entity.Name);
         foreach (EntityRelation relation in entity.Relations)
         {
             var entityChanged   = false;
             var oldPropertyName = relation.UtilizingPropertyName;
             var newPropertyName = GeneralUtils.CreateUtilizingPropertyName(relation, ProjectToTarget.Properties);
             //Make sure 'Setting up pluralization and singularization of names' is done as descibed here: http://www.llblgen.com/documentation/2.6/hh_start.htm
             //else newPropertyName will be singular
             if (relation.UtilizingPropertyName != newPropertyName)
             {
                 relation.UtilizingPropertyName = newPropertyName;
                 base.LogLineToApplicationOutput(string.Format("Related field '{0}' of entity '{1}' has been changed to '{2}' ", oldPropertyName, entity.Name, newPropertyName), "RenameRelatedFieldsPlugin", false, true);
                 entityChanged = true;
             }
             if (entityChanged)
             {
                 entity.MarkEntityDefinitionAsChanged(ObjectChangeType.EntityFields);
                 entity.MarkEntityDefinitionRequiresRedraw(ObjectChangeType.EntityFields);
             }
         }
         ProgressTaskComplete();
     }
 }