GitPedia

Plastic

This project provides encapsulation of things like Domain, Application Rules, Business Rules or Business Logic in Application.

From sang-hyeon·Updated December 17, 2025·View on GitHub·
·Archived

This project provides encapsulation of things like Domain, Application Rules, Business Rules or Business Logic in Application. For this, Command pattern is used. The project is written primarily in C#, distributed under the MIT License license, first published in 2021. Key topics include: application, application-rules, business-logic, business-rules, clean-architecture.

Latest release: v.2.6.4Updated the dependent packages
June 29, 2024View Changelog →

Build Source Code
Nuget

<br>

Abstract

This project provides encapsulation of things like Domain, Application Rules, Business Rules or Business Logic in Application. For this, Command pattern is used.

All applications such as Web, CLI, GUI application can use this project.
This can be part of the Usecase Layer, Domain Service Layer or CQRS.

The source generator introduced in .Net 5 is used to implement this Idea. If metaprogramming such as Source generator is properly used, it's possible to provide flexible source code that has not been provided by traditional programming.
Generated source code has the same effect as the source code you wrote yourself because it will be injected at compile time.

The name of this project is Plastic Command.

Blog post <br>
Blog post(한국어)

<br>

Flow of the plastic command

Platstic의 명령 흐름

<br>

Plastic Command

Quick Start

Step 1. Specify The Command

cs
// [CommandName("AddCommand")] class AddCommandSpec : ICommandSpecification<int, int> { public AddCommandSpec(IMyCalculator calculator) { ... } public Task<int> ExecuteAsync(int param, CancellationToken token = default) { ... } }

Step 2. Add Plastic to IServiceCollection

cs
void Configure(IServiceCollection services) { var pipelineBuilder = new BuildPipeline(...); services.UsePlastic(pipelineBuilder); }

Step 3. Use a Generated Command

cs
class AddController : ControllerBase { public AddController(AddCommand addCommand) { ... ... int result = addCommand.ExecuteAsync( 1 ); } }

Contributors

Showing top 2 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from sang-hyeon/Plastic via the GitHub API.Last fetched: 6/20/2026