Popularity
1.9
Growing
Activity
7.3
-
56
3
3

Programming language: C#
License: MIT License

Plastic alternatives and similar packages

Based on the "Application Frameworks" category.
Alternatively, view Plastic alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Plastic or a related project?

Add another 'Application Frameworks' Package

README

Build Source Code Nuget

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.

Blog post Blog post(한국어)

Flow of the command

[Platstic의 명령 흐름](docs/resources/flow.jpg)

Quick Start

Step 1. Specify The Command

// [CommandName("AddCommand")]
class AddCommandSpec : CommandSpecificationBase<int, int>
{
        public AddCommandSpec(IMyCalculator calculator)
        { 
            ...
        }

        public override Task<ExecutionResult<int>> ExecuteAsync(int param, CancellationToken token = default)
        {
            ...
        }

        public override Task<Response> CanExecuteAsync(int param, CancellationToken token = default)
        {
            return CanBeExecuted();
        }

}

Step 2. Add Plastic to IServiceCollection

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

        services.UsePlastic(pipelineBuilder);
}

Step 3. Use a generated command

class AddController : ControllerBase
{
        public AddController(AddCommand addCommand)
        {
                ...
                var result = addCommand.Execute( 1 );
        }
}