Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion samples/EasyWay.Samples/Queries/SampleQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{
public class SampleQuery : Query<SampleModule, SampleQueryResult>
{
public string Name { get; set; }
public required string Name { get; init; }

public required int Age { get; init; }
}
}
6 changes: 3 additions & 3 deletions source/EasyWay.WebApi/RcpStyleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static WebKernel MapQuery<TModule, TQuery, TReadModel>(this WebKernel web
where TQuery : Query<TModule, TReadModel>
where TReadModel : ReadModel
{
webKernel.App.MapPost(typeof(TModule).Name + "/_queries/" + typeof(TQuery).Name, async ([FromBody] TQuery query, IModuleExecutor<TModule> executor, CancellationToken cancellationToken) =>
webKernel.App.MapGet("api/" + typeof(TModule).Name + "/" + typeof(TQuery).Name, async ([AsParameters] TQuery query, IModuleExecutor<TModule> executor, CancellationToken cancellationToken) =>
{
var queryResult = await executor.Execute(query, cancellationToken);

Expand All @@ -35,7 +35,7 @@ public static WebKernel MapCommand<TModule, TCommand>(this WebKernel webKernel)
where TModule : EasyWayModule
where TCommand : Command<TModule>
{
webKernel.App.MapPost(typeof(TModule).Name + "/_commands/" + typeof(TCommand).Name, async ([FromBody] TCommand command, IModuleExecutor<TModule> executor, CancellationToken cancellationToken) =>
webKernel.App.MapPost("api/" + typeof(TModule).Name + "/" + typeof(TCommand).Name, async ([FromBody] TCommand command, IModuleExecutor<TModule> executor, CancellationToken cancellationToken) =>
{
var commandResult = await executor.Execute(command, cancellationToken);

Expand All @@ -55,7 +55,7 @@ public static WebKernel MapCommand<TModule, TCommand, TCommandResult>(this WebKe
where TCommand : Command<TModule, TCommandResult>
where TCommandResult : OperationResult
{
webKernel.App.MapPost(typeof(TModule).Name + "/_commands/" + typeof(TCommand).Name, async ([FromBody] TCommand command, IModuleExecutor<TModule> executor, CancellationToken cancellationToken) =>
webKernel.App.MapPost("api/" + typeof(TModule).Name + "/" + typeof(TCommand).Name, async ([FromBody] TCommand command, IModuleExecutor<TModule> executor, CancellationToken cancellationToken) =>
{
var commandResult = await executor.Execute(command, cancellationToken);

Expand Down