Skip to content

A lightweight library for the Business Layer for processing requests coming from Presentation Layer.

License

Notifications You must be signed in to change notification settings

Use-Case-NET/RequestR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RequestR - Getting Started

1) Create the Request, Response and Use Case classes

The request and the response can be any C# classes.

public class PresentProductsRequest
{
}

public class PresentProductsResponse
{
}

The use case must implement the IUseCase interface.

internal class PresentProductsUseCase : IUseCase<PresentProductsRequest, PresentProductsResponse>
{
    public Task<PresentProductsResponse> Execute(PresentProductsRequest request, CancellationToken cancellationToken)
    {
        // Return the list of products.
    }
}

Note: The response class is optional, it may be missing if the use case has nothing to return.

2) Create the Request Bus and register the Use Case

RequestBus requestBus = new RequestBus();
requestBus.RegisterUseCase<PresentProductsUseCase>();

3) Send a new Request

PresentProductsRequest request = new PresentProductsRequest();
PresentProductsResponse response = requestBus.Process<PresentProductsRequest, PresentProductsResponse>(request);

About

A lightweight library for the Business Layer for processing requests coming from Presentation Layer.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages