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: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ indent_style = space
indent_size = 4

# Microsoft .NET properties
csharp_preferred_modifier_order = public, private, protected, internal, abstract, virtual, sealed, override, static, new, readonly, extern, unsafe, volatile, async:suggestion
csharp_preferred_modifier_order = public, private, protected, internal, static, abstract, virtual, sealed, override, new, readonly, extern, unsafe, volatile, async:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
Expand Down Expand Up @@ -45,7 +45,7 @@ resharper_keep_existing_initializer_arrangement = false
resharper_keep_existing_invocation_parens_arrangement = false
resharper_keep_existing_switch_expression_arrangement = false
resharper_max_initializer_elements_on_line = 2
resharper_modifiers_order = public private protected internal abstract virtual sealed override static new readonly extern unsafe volatile async
resharper_modifiers_order = public private protected internal static abstract virtual sealed override new readonly extern unsafe volatile async
resharper_place_accessorholder_attribute_on_same_line = false
resharper_place_field_attribute_on_same_line = false
resharper_place_linq_into_on_new_line = false
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Authors>Cnblogs</Authors>
<Product>Cnblogs.Architecture</Product>
<PackageProjectUrl>https://github.com/cnblogs/Architecture</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static IEndpointConventionBuilder MapCommand<T>(
/// </code>
/// </example>
/// <returns></returns>
// ReSharper disable once UnusedTypeParameter
public static IEndpointConventionBuilder MapCommand<T>(
this IEndpointRouteBuilder app,
[StringSyntax("Route")] string route,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface IApiException<out TException>
/// <param name="message">错误信息。</param>
/// <param name="userFriendlyMessage">给用户显示的错误信息。</param>
[DoesNotReturn]
abstract static void Throw(int statusCode = -1, string message = "", string? userFriendlyMessage = null);
static abstract void Throw(int statusCode = -1, string message = "", string? userFriendlyMessage = null);

/// <summary>
/// 创建异常。
Expand All @@ -40,5 +40,5 @@ public interface IApiException<out TException>
/// <param name="message">错误信息。</param>
/// <param name="userFriendlyMessage">给用户显示的错误信息。</param>
/// <returns></returns>
abstract static TException Create(int statusCode = -1, string message = "", string? userFriendlyMessage = null);
static abstract TException Create(int statusCode = -1, string message = "", string? userFriendlyMessage = null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
[AttributeUsage(AttributeTargets.Assembly)]
public class AssemblyAppNameAttribute : Attribute
{
/// <inheritdoc />
/// <summary>
/// 配置应用名称。
/// </summary>
/// <param name="name">应用名称。</param>
public AssemblyAppNameAttribute(string name)
{
Name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task<TEnumerable> AddRangeAsync<TEnumerable>(TEnumerable entities)
return entities;
}

/// <inheritdoc />
/// <inheritdoc cref="IRepository{TEntity,TKey}.GetAsync" />
public async Task<TEntity?> GetAsync(TKey key)
{
return await Context.Set<TEntity>().FirstOrDefaultAsync(e => e.Id.Equals(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task<TEntity> DeleteAsync(TEntity entity)
return entity;
}

/// <inheritdoc />
/// <inheritdoc cref="IRepository{TEntity,TKey}.GetAsync" />
public async Task<TEntity?> GetAsync(TKey key)
{
return await Context.Set<TEntity>().Find(Builders<TEntity>.Filter.Eq(x => x.Id, key)).FirstOrDefaultAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Cnblogs.Architecture.Ddd.Infrastructure.MongoDb;
/// MongoContext 的配置文件。
/// </summary>
/// <typeparam name="TContext">要配置的 MongoContext。</typeparam>
// ReSharper disable once UnusedTypeParameter
public class MongoContextOptions<TContext> : MongoContextOptions
where TContext : MongoContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ public class CommandHandlers
ICommandHandler<DeleteCommand, TestError>
{
/// <inheritdoc />
public async Task<CommandResponse<TestError>> Handle(CreateCommand request, CancellationToken cancellationToken)
public Task<CommandResponse<TestError>> Handle(CreateCommand request, CancellationToken cancellationToken)
{
return request.NeedError
return Task.FromResult(request.NeedError
? CommandResponse<TestError>.Fail(TestError.Default)
: CommandResponse<TestError>.Success();
: CommandResponse<TestError>.Success());
}

/// <inheritdoc />
public async Task<CommandResponse<TestError>> Handle(UpdateCommand request, CancellationToken cancellationToken)
public Task<CommandResponse<TestError>> Handle(UpdateCommand request, CancellationToken cancellationToken)
{
return request.NeedError
return Task.FromResult(request.NeedError
? CommandResponse<TestError>.Fail(TestError.Default)
: CommandResponse<TestError>.Success();
: CommandResponse<TestError>.Success());
}

/// <inheritdoc />
public async Task<CommandResponse<TestError>> Handle(DeleteCommand request, CancellationToken cancellationToken)
public Task<CommandResponse<TestError>> Handle(DeleteCommand request, CancellationToken cancellationToken)
{
return request.NeedError
return Task.FromResult(request.NeedError
? CommandResponse<TestError>.Fail(TestError.Default)
: CommandResponse<TestError>.Success();
: CommandResponse<TestError>.Success());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace Cnblogs.Architecture.IntegrationTestProject.Application.Queries;

public record GetStringQuery() : IQuery<string>;
public record GetStringQuery : IQuery<string>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Cnblogs.Architecture.IntegrationTestProject.Application.Queries;
public class GetStringQueryHandler : IQueryHandler<GetStringQuery, string>
{
/// <inheritdoc />
public async Task<string?> Handle(GetStringQuery request, CancellationToken cancellationToken)
public Task<string?> Handle(GetStringQuery request, CancellationToken cancellationToken)
{
return "Hello";
return Task.FromResult((string?)"Hello");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace Cnblogs.Architecture.IntegrationTestProject.Application.Queries;
public class ListStringsQueryHandler : IPageableQueryHandler<ListStringsQuery, string>
{
/// <inheritdoc />
public async Task<PagedList<string>> Handle(ListStringsQuery request, CancellationToken cancellationToken)
public Task<PagedList<string>> Handle(ListStringsQuery request, CancellationToken cancellationToken)
{
return new PagedList<string>(new[] { "hello" });
return Task.FromResult(new PagedList<string>(new[] { "hello" }));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

namespace Cnblogs.Architecture.IntegrationTestProject
{
// ReSharper disable once PartialTypeWithSinglePart
public partial class Program
{
}
Expand Down