public string Summary(Settings settings)
 {
     if (Metadata is ManyToManyRelationshipMetadata)
     {
         return
             ($"Entity 1: \"{Parent?.GetNameTechnical(settings.ConstantName, settings)}\" " +
              $"Entity 2: \"{Child?.GetNameTechnical(settings.ConstantName, settings)}\"");
     }
     return
         ($"Parent: \"{Parent?.GetNameTechnical(settings.ConstantName, settings)}\" " +
          $"Child: \"{Child?.GetNameTechnical(settings.ConstantName, settings)}\" " +
          $"Lookup: \"{LookupAttribute?.GetNameTechnical(settings)}\"");
 }
        private static string GetClass(List <EntityMetadataProxy> selectedentities, EntityMetadataProxy entitymetadata, EntityMetadataProxy commonentity, Settings settings)
        {
            var name = entitymetadata.GetNameTechnical(settings.ConstantName, settings);

            name = settings.commonsettings.EntityPrefix + name + settings.commonsettings.EntitySuffix;
            var description = entitymetadata.Description?.Replace("\n", "\n/// ");
            var summary     = settings.XmlProperties && entitymetadata.LogicalName != "[common]" ? entitymetadata.GetEntityProperties(settings) : settings.XmlDescription ? description : string.Empty;
            var remarks     = settings.XmlProperties && entitymetadata.LogicalName != "[common]" && settings.XmlDescription ? description : string.Empty;
            var entity      = new StringBuilder();

            if (!string.IsNullOrEmpty(summary))
            {
                entity.AppendLine($"/// <summary>{summary}</summary>");
            }
            if (!string.IsNullOrEmpty(remarks))
            {
                entity.AppendLine($"/// <remarks>{remarks}</remarks>");
            }
            entity.AppendLine(Template.Class
                              .Replace("{classname}", name)
                              .Replace("{entity}", GetEntity(entitymetadata))
                              .Replace("'", "\"")
                              .Replace("{attributes}", GetAttributes(entitymetadata, commonentity, settings))
                              .Replace("{relationships}", GetRelationships(entitymetadata, selectedentities, settings))
                              .Replace("{optionsets}", GetOptionSets(entitymetadata, settings)));
            return(entity.ToString());
        }
Example #3
0
        private static string GetClass(EntityMetadataProxy entitymetadata, EntityMetadataProxy commonentity, Settings settings)
        {
            var template = settings.commonsettings.Template;
            var name     = entitymetadata.GetNameTechnical(settings.ConstantName, settings);

            name = settings.commonsettings.EntityPrefix + name + settings.commonsettings.EntitySuffix;
            var description = entitymetadata.Description?.Replace("\n", "\n/// ");
            var summary     = settings.XmlProperties && entitymetadata.LogicalName != "[common]" ? entitymetadata.GetEntityProperties(settings) : settings.XmlDescription ? description : string.Empty;
            var remarks     = settings.XmlProperties && entitymetadata.LogicalName != "[common]" && settings.XmlDescription ? description : string.Empty;

            if (!string.IsNullOrEmpty(summary))
            {
                summary = template.Summary.Replace("{summary}", summary);
            }
            if (!string.IsNullOrEmpty(remarks))
            {
                remarks = template.Remarks.Replace("{remarks}", remarks);
            }
            var entity = template.EntityContainer
                         .Replace("{entityname}", name)
                         .Replace("{entitydetail}", GetEntity(entitymetadata, template))
                         .Replace("{type}", entitymetadata.Metadata.IsCustomEntity == true ? "custom" : "standard")
                         .Replace("{summary}", summary)
                         .Replace("{remarks}", remarks)
                         .Replace("'", "\"")
                         .Replace("{attributes}", GetAttributes(entitymetadata, commonentity, settings))
                         .Replace("{relationships}", GetRelationships(entitymetadata, settings))
                         .Replace("{optionsets}", GetOptionSets(entitymetadata, settings));

            return(entity);
        }