mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
refactor(cqrs): 简化接口定义并分离流式命令和查询接口
- 移除 ICommand<TResponse> 和 ICommand 的空实现体 - 移除 IQuery<TResponse> 和 IStreamQuery<TResponse> 的空实现体 - 移除 INotification、IRequest<TResponse>、IStreamRequest<TResponse> 的空实现体 - 将 IStreamCommand<TResponse> 分离到独立文件中 - 将 IStreamQuery<TResponse> 分离到独立文件中 - 保持所有接口的核心功能不变,仅简化语法结构
This commit is contained in:
parent
fe73d13991
commit
d881bd5ad1
@ -5,21 +5,9 @@ namespace GFramework.Cqrs.Abstractions.Cqrs.Command;
|
|||||||
/// 命令通常用于修改系统状态。
|
/// 命令通常用于修改系统状态。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TResponse">命令响应类型。</typeparam>
|
/// <typeparam name="TResponse">命令响应类型。</typeparam>
|
||||||
public interface ICommand<out TResponse> : IRequest<TResponse>
|
public interface ICommand<out TResponse> : IRequest<TResponse>;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示一个无显式返回值的 CQRS 命令。
|
/// 表示一个无显式返回值的 CQRS 命令。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICommand : ICommand<Unit>
|
public interface ICommand : ICommand<Unit>;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 表示一个流式 CQRS 命令。
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TResponse">流式响应元素类型。</typeparam>
|
|
||||||
public interface IStreamCommand<out TResponse> : IStreamRequest<TResponse>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
20
GFramework.Cqrs.Abstractions/Cqrs/Command/IStreamCommand.cs
Normal file
20
GFramework.Cqrs.Abstractions/Cqrs/Command/IStreamCommand.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2026 GeWuYou
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
namespace GFramework.Cqrs.Abstractions.Cqrs.Command;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示一个流式 CQRS 命令。
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResponse">流式响应元素类型。</typeparam>
|
||||||
|
public interface IStreamCommand<out TResponse> : IStreamRequest<TResponse>;
|
||||||
@ -4,6 +4,4 @@ namespace GFramework.Cqrs.Abstractions.Cqrs;
|
|||||||
/// 表示一个一对多发布的通知消息。
|
/// 表示一个一对多发布的通知消息。
|
||||||
/// 通知不要求返回值,允许被零个或多个处理器消费。
|
/// 通知不要求返回值,允许被零个或多个处理器消费。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface INotification
|
public interface INotification;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,6 +5,4 @@ namespace GFramework.Cqrs.Abstractions.Cqrs;
|
|||||||
/// 该接口是命令、查询以及其他请求语义的统一基接口。
|
/// 该接口是命令、查询以及其他请求语义的统一基接口。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TResponse">请求响应类型。</typeparam>
|
/// <typeparam name="TResponse">请求响应类型。</typeparam>
|
||||||
public interface IRequest<out TResponse>
|
public interface IRequest<out TResponse>;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,6 +5,4 @@ namespace GFramework.Cqrs.Abstractions.Cqrs;
|
|||||||
/// 请求处理器可以逐步产生响应序列,而不是一次性返回完整结果。
|
/// 请求处理器可以逐步产生响应序列,而不是一次性返回完整结果。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TResponse">流式响应元素类型。</typeparam>
|
/// <typeparam name="TResponse">流式响应元素类型。</typeparam>
|
||||||
public interface IStreamRequest<out TResponse>
|
public interface IStreamRequest<out TResponse>;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,14 +5,4 @@ namespace GFramework.Cqrs.Abstractions.Cqrs.Query;
|
|||||||
/// 查询用于读取数据,不应产生副作用。
|
/// 查询用于读取数据,不应产生副作用。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TResponse">查询响应类型。</typeparam>
|
/// <typeparam name="TResponse">查询响应类型。</typeparam>
|
||||||
public interface IQuery<out TResponse> : IRequest<TResponse>
|
public interface IQuery<out TResponse> : IRequest<TResponse>;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 表示一个流式 CQRS 查询。
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TResponse">流式响应元素类型。</typeparam>
|
|
||||||
public interface IStreamQuery<out TResponse> : IStreamRequest<TResponse>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
20
GFramework.Cqrs.Abstractions/Cqrs/Query/IStreamQuery.cs
Normal file
20
GFramework.Cqrs.Abstractions/Cqrs/Query/IStreamQuery.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2026 GeWuYou
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
namespace GFramework.Cqrs.Abstractions.Cqrs.Query;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示一个流式 CQRS 查询。
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResponse">流式响应元素类型。</typeparam>
|
||||||
|
public interface IStreamQuery<out TResponse> : IStreamRequest<TResponse>;
|
||||||
Loading…
x
Reference in New Issue
Block a user