Wellcome C4Sharp 7.0.x 🚀
⚠️ Attention: breaking changes
A change in one part of this version could cause other components to fail; Not possible to fix old entries without a breaking change, so remap old to new in import lib.
📦 Release
We released a new version of C4Sharp. The release includes minor bug fixes to the write test log, code maintainability, and performance. You can read the full list of new enhancements and bug fixes below:
New base class for DiagramBuildRunner
Now C4Sharp has new specific Builders:
- ContainerDiagram
- ComponentDiagram
- SoftwareSystemDiagram
- ContextDiagram
- SequenceDiagram
- DeploymentDiagram
syntax improvement
We improved syntax to create a new diagram from scratch
public class ContainerDiagramSample: ContainerDiagram
{
protected override string Title => "Container diagram for Internet Banking System";
protected override IEnumerable<Structure> Structures => new Structure[]
{
Person.None | Boundary.External
| ("Customer", "Personal Banking Customer", "A customer of the bank, with personal bank accounts."),
SoftwareSystem.None | ("BankingSystem", "Internet Banking System",
"Allows customers to view information about their bank accounts, and make payments."),
SoftwareSystem.None | Boundary.External
| ("MailSystem", "E-mail system", "The internal Microsoft Exchange e-mail system."),
Bound("c1", "Internet Banking",
Container.None | (WebApplication, "WebApp", "WebApp", "C#, WebApi",
"Delivers the static content and the Internet banking SPA"),
Container.None | (Spa, "Spa", "Spa", "JavaScript, Angular",
"Delivers the static content and the Internet banking SPA"),
Container.None | (Mobile, "MobileApp", "Mobile App", "C#, Xamarin",
"Provides a mobile banking experience"),
Container.None | (Database, "SqlDatabase", "SqlDatabase", "SQL Database",
"Stores user registration information, hashed auth credentials, access logs, etc."),
Container.None | (Queue, "RabbitMQ", "RabbitMQ", "RabbitMQ",
"Stores user registration information, hashed auth credentials, access logs, etc."),
Container.None | (Api, "BackendApi", "BackendApi", "Dotnet, Docker Container",
"Provides Internet banking functionality via API.")
)
};
protected override IEnumerable<Relationship> Relationships => new[]
{
this["Customer"] > this["WebApp"] | ("Uses", "HTTPS"),
this["Customer"] > this["Spa"] | ("Uses", "HTTPS"),
this["Customer"] > this["MobileApp"] | "Uses",
this["WebApp"] > this["Spa"] | "Delivers" | Position.Neighbor,
this["Spa"] > this["BackendApi"] | ("Uses", "async, JSON/HTTPS"),
this["MobileApp"] > this["BackendApi"] | ("Uses", "async, JSON/HTTPS"),
this["SqlDatabase"] < this["BackendApi"] | ("Uses", "async, JSON/HTTPS") | Position.Neighbor,
this["RabbitMQ"] < this["BackendApi"] | ("Uses", "async, JSON"),
this["Customer"] < this["MailSystem"] | "Sends e-mails to",
this["MailSystem"] < this["BackendApi"] | ("Sends e-mails using", "sync, SMTP"),
this["BackendApi"] > this["BankingSystem"] | ("Uses", "sync/async, XML/HTTPS") | Position.Neighbor
};
}
New compilation
Now you don't need to call the method .Build()
explicitly
using C4Sharp.Diagrams;
using C4Sharp.Diagrams.Plantuml;
using C4Sharp.Diagrams.Themes;
using ModelDiagrams.Diagrams;
var diagrams = new DiagramBuilder[]
{
new ContextDiagramSample(),
new ComponentDiagramSample(),
new ContainerDiagramSample(),
new EnterpriseDiagramSample(),
new SequenceDiagramSample(),
new DeploymentDiagramSample()
};
var path = Path.Combine("..", "..", "..", "..", "..", "docs", "images");
new PlantumlContext()
.UseDiagramImageBuilder()
.Export(path, diagrams, new DefaultTheme());
Wellcome Themes
You can use themes to customize your diagrams.
new PlantumlContext()
.UseDiagramImageBuilder()
.Export(path, diagrams, new DefaultTheme());
Boundary Style
New methods to customize Boundaries
public IBoundaryStyle? BoundaryStyle => new BoundaryStyle()
.UpdateBoundaryStyle(ElementName.System, "#FFFFFF", "#000000", "#000000", false, Shape.RoundedBoxShape)
.UpdateBoundaryStyle(ElementName.Container, "#FFFFFF", "#000000", "#000000", false, Shape.RoundedBoxShape)
.UpdateBoundaryStyle(ElementName.Enterprise, "#FFFFFF", "#000000", "#000000", false, Shape.RoundedBoxShape);
New Sample Project
See the new sample project
What's Changed
- Update README.md by @yanjustino in #48
- Features/new builders and themes by @yanjustino in #49
- Fix by @yanjustino in #50
- Features/new builders and themes by @yanjustino in #51
- Features/new builders and themes by @yanjustino in #52
- New README.md by @yanjustino in #53
- Features/new builders and themes by @yanjustino in #54
Full Changelog: v6.2.x...v7.0.x