You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,16 @@ The WebResultEndpoint and ServiceResultEndpoint abstractions are a structured ap
19
19
## Key Features
20
20
21
21
- Organizes ASP.NET Core Minimal Apis in REPR pattern endpoints
22
-
- Encapsulates endpoint behaviors like request validation, request handling, and response mapping.
22
+
- Encapsulates endpoint behaviors like request validation, request handling, and response mapping*.
23
23
- Supports anything that Minimal Apis does. Configuration, parameter binding, authentication, Open Api tooling, filters, etc. are all Minimal Apis under the hood.
24
24
- Supports auto discovery and registration.
25
25
- Has built-in validation support with [FluentValidation](https://github.com/FluentValidation/FluentValidation). If a validator is registered for request model, request is automatically validated before being handled.
26
26
- Supports constructor dependency injection in endpoint implementations.
27
27
- Enforces response model type safety in request handlers.
28
28
- Abstracts the logic for converting business results into HTTP responses.
29
29
30
+
*WebResultEndpoint abstracts the logic for converting business results into HTTP responses.
31
+
30
32
## Workflow
31
33
32
34
An endpoint must implement two virtual methods: Configure and HandleAsync.
@@ -280,10 +282,25 @@ See [test results](./samples/BenchmarkWebApi/BenchmarkFiles/inprocess_benchmark_
280
282
281
283
WebResultEndpoint and ServiceResultEndpoint, the two abstract endpoint bases, have a 'HandleAsync' method which returns a strongly typed [business result](https://github.com/modabas/ModResults).
282
284
283
-
They differ only in converting these business results into HTTP responses before sending response to client. Other features described previously are common for both of them.
285
+
These two endpoint types differ only in converting these business results into HTTP responses before sending response to client.
286
+
287
+
MinimalEndpoint within ModEndpoints.Core package, is closest to barebones Minimal Api. Its 'HandleAsync' method support the following types of return values:
288
+
289
+
- string
290
+
- T (Any other type)
291
+
- Minimal Api IResult based
292
+
293
+
Other features described previously are common for all of them.
284
294
285
295
Each type of andpoint has various implementations that accept a request model or not, that has a response model or not.
286
296
297
+
### MinimalEndpoint
298
+
299
+
A MinimalEndpoint implementation, after handling request, returns the response model.
300
+
301
+
- MinimalEndpoint<TRequest, TResponse>: Has a request model, supports request validation and returns a response model.
302
+
- MinimalEndpoint<TResponse>: Doesn't have a request model and returns a response model.
303
+
287
304
### ServiceResultEndpoint
288
305
289
306
A ServiceResultEndpoint implementation, after handling request, encapsulates the [business result](https://github.com/modabas/ModResults) of HandleAsync method in a HTTP 200 Minimal Api IResult and sends to client. The [business result](https://github.com/modabas/ModResults) returned may be in Ok or Failed state. This behaviour makes ServiceResultEndpoints more suitable for internal services, where clients are aware of Result or Result<TValue> implementations.
@@ -295,7 +312,7 @@ A ServiceResultEndpoint implementation, after handling request, encapsulates the
295
312
296
313
### WebResultEndpoint
297
314
298
-
A WebResultEndpoint implementation, after handling request, maps the [business result](https://github.com/modabas/ModResults) of HandleAsync method to an IResult depending on the result type, state and failure type (if any). Mapping behaviour can be modified or replaced with a custom one.
315
+
A WebResultEndpoint implementation, after handling request, maps the [business result](https://github.com/modabas/ModResults) of HandleAsync method to a Minimal Api IResult depending on the business result type, state and failure type (if any). Mapping behaviour can be modified or replaced with a custom one.
299
316
300
317
- WebResultEndpoint<TRequest, TResponse>: Has a request model, supports request validation and returns a response model as body of Minimal Api IResult if successful.
301
318
- WebResultEndpoint<TRequest>: Has a request model, supports request validation, doesn't have a response model to return within Minimal Api IResult.
0 commit comments