Esempio n. 1
0
        private static string GetRelationShip(RelationshipMetadataProxy relationship, Settings settings, string prefix)
        {
            var template = settings.commonsettings.Template;

            if (relationship.Child?.Attributes == null)
            {
                return(string.Empty);
            }
            var name    = prefix + relationship.GetNameTechnical(settings);
            var summary = settings.XmlProperties ? relationship.Summary(settings) : string.Empty;

            if (!string.IsNullOrEmpty(summary))
            {
                summary = template.Summary.Replace("{summary}", summary);
            }
            var relation = template.Relationship
                           .Replace("{relationship}", name)
                           .Replace("{schemaname}", relationship.Metadata.SchemaName)
                           .Replace("{entity1}", relationship.Parent.GetNameTechnical(settings.ConstantName, settings))
                           .Replace("{entity2}", relationship.Child.GetNameTechnical(settings.ConstantName, settings))
                           .Replace("{relationtype}", GetRelationUMLNotation(relationship))
                           .Replace("{lookup}", settings.RelationshipLabels ? relationship.LookupAttribute?.GetNameTechnical(settings) : "")
                           .Replace("{summary}", summary)
                           .Replace("'", "\"")
                           .TrimEnd(' ', ':');

            return(relation);
        }
        private static string GetRelationShip(RelationshipMetadataProxy relationship, Settings settings, string prefix)
        {
            if (relationship.Child?.Attributes == null)
            {
                return(string.Empty);
            }
            var name     = prefix + relationship.GetNameTechnical(settings);
            var summary  = settings.XmlProperties ? relationship.Summary(settings) : string.Empty;
            var relation = new StringBuilder();

            if (!string.IsNullOrEmpty(summary))
            {
                relation.AppendLine($"/// <summary>{summary}</summary>");
            }
            relation.AppendLine(Template.Relationship
                                .Replace("{relationship}", name)
                                .Replace("{schemaname}", relationship.Metadata.SchemaName)
                                .Replace("'", "\""));
            return(relation.ToString());
        }