Skip to content

Add filter and namesOnly options - #30

Merged
SimonCropp merged 1 commit into
mainfrom
diagram-filter-and-names-only
Oct 13, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
diagram-filter-and-names-only

Conversation

@SimonCropp

Copy link
Copy Markdown
Owner

Adds two optional parameters to the render methods.

filter

Selects what is included in the diagram. Foreign keys to an excluded table or entity type are omitted.

  • SqlServerToMermaid: Func<Microsoft.SqlServer.Management.Smo.Table, bool> on the methods that take a SqlConnection. Not on the FromScript methods.
  • EfToMermaid: Func<IEntityType, bool>.
var markdown = await SqlServerToMermaid.RenderMarkdown(
    connection,
    // exclude temporal history tables, and the AuditLogs table
    filter: _ => _.TemporalType != TableTemporalType.HistoryTable &&
                 _.Name != "AuditLogs");

namesOnly

Renders only the table names, without columns. Relationships are kept. On all render methods, including FromScript.

var markdown = await SqlServerToMermaid.RenderMarkdown(
    connection,
    namesOnly: true);
erDiagram
  Customers["**Customers**"]
  Orders["**Orders**"]
  Customers ||--o{ Orders : "FK_Orders_Customers"

Notes

  • Both parameters sit before cancel, so a caller passing cancel positionally will need to name it.
  • SqlServerToMermaidTool is unchanged.
  • Version bumped to 2.3.0.

@SimonCropp SimonCropp added this to the 2.3.0 milestone Oct 13, 2026
@SimonCropp
SimonCropp merged commit 35b9261 into main Oct 13, 2026
3 checks passed
@SimonCropp
SimonCropp deleted the diagram-filter-and-names-only branch October 13, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant