Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change namespace of extension methods #6

Merged
merged 1 commit into from
Feb 5, 2023
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Asp.Versioning;
using Asp.Versioning.Conventions;

using Microsoft.Extensions.DependencyInjection;

namespace Cnblogs.Architecture.Ddd.Cqrs.AspNetCore;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Api Versioning 注入扩展
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Cnblogs.Architecture.Ddd.Cqrs.AspNetCore;
using Microsoft.AspNetCore.Mvc;

namespace Cnblogs.Architecture.Ddd.Cqrs.AspNetCore;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// 用于注入 Model Binder 的扩展方法。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Hosting;

using Serilog;

namespace Cnblogs.Architecture.Ddd.Cqrs.AspNetCore;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.Hosting;

/// <summary>
/// 注入 Serilog 的扩展方法。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Cnblogs.Architecture.Ddd.Infrastructure.Dapper;
using Cnblogs.Architecture.Ddd.Cqrs.Dapper;
using Cnblogs.Architecture.Ddd.Infrastructure.Dapper;

using Microsoft.Extensions.DependencyInjection;

namespace Cnblogs.Architecture.Ddd.Cqrs.Dapper;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// ServiceCollection 注入类。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System.Reflection;

using Cnblogs.Architecture.Ddd.Cqrs.Abstractions;

using Cnblogs.Architecture.Ddd.Cqrs.DependencyInjection;
using MediatR;

using Microsoft.Extensions.DependencyInjection;

namespace Cnblogs.Architecture.Ddd.Cqrs.DependencyInjection;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// 依赖注入扩展方法。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Reflection;
using Cnblogs.Architecture.Ddd.EventBus.Abstractions;
using Cnblogs.Architecture.Ddd.EventBus.Dapr;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;

namespace Cnblogs.Architecture.Ddd.EventBus.Dapr;
// ReSharper disable once CheckNamespace
namespace Microsoft.AspNetCore.Routing;

/// <summary>
/// 用于事件订阅的扩展方法。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Cnblogs.Architecture.Ddd.Domain.Abstractions;

using MediatR;

namespace Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;
// ReSharper disable once CheckNamespace
namespace MediatR;

/// <summary>
/// 发布领域时间的拓展方法。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public PagedList(IReadOnlyCollection<T> items, PagingParams pagingParams, int to
{
Items = items;
TotalCount = totalCount;
(var pageIndex, var pageSize) = pagingParams;
var (pageIndex, pageSize) = pagingParams;
PageIndex = pageIndex;
PageSize = pageSize;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Linq.Expressions;
using Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;

namespace Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;
// ReSharper disable once CheckNamespace
namespace System.Linq;

/// <summary>
/// <see cref="OrderBySegment" /> 用于 <see cref="IQueryable{T}" /> 的扩展方法。
Expand All @@ -26,7 +28,7 @@ private static string GetThenByMethodName(bool isDesc)
/// <returns>排好序的 <see cref="IQueryable{T}" />。</returns>
public static IQueryable<TSource> OrderBy<TSource>(this IQueryable<TSource> queryable, OrderBySegment segment)
{
(var isDesc, var exp) = segment;
var (isDesc, exp) = segment;
var method = GetOrderByMethodName(isDesc);
Type[] types = { queryable.ElementType, exp.Body.Type };
var rs = Expression.Call(typeof(Queryable), method, types, queryable.Expression, exp);
Expand Down Expand Up @@ -62,7 +64,7 @@ public static IQueryable<TSource> OrderBy<TSource>(
IEnumerable<OrderBySegment> segments)
{
var isFirst = true;
foreach ((var isDesc, var exp) in segments)
foreach (var (isDesc, exp) in segments)
{
var method = isFirst ? GetOrderByMethodName(isDesc) : GetThenByMethodName(isDesc);
Type[] types = { queryable.ElementType, exp.Body.Type };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;
using Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;

// ReSharper disable once CheckNamespace
namespace System.Linq;

/// <summary>
/// <see cref="PagingParams" /> 用于 <see cref="IQueryable{T}" /> 的扩展方法。
Expand All @@ -14,7 +17,7 @@ public static class QueryPager
/// <returns>分页后的列表。</returns>
public static IQueryable<T> Paging<T>(this IQueryable<T> queryable, PagingParams pagingParams)
{
(var pageIndex, var pageSize) = pagingParams;
var (pageIndex, pageSize) = pagingParams;
return queryable.Paging(pageIndex, pageSize);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Linq.Expressions;
using Cnblogs.Architecture.Ddd.Domain.Abstractions;
using Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;
using MediatR;
using Microsoft.EntityFrameworkCore;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Cnblogs.Architecture.Ddd.Domain.Abstractions;
using Cnblogs.Architecture.Ddd.Infrastructure.Abstractions;
using MediatR;
using MongoDB.Driver;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Cnblogs.Architecture.Ddd.Cqrs.AspNetCore;
using Cnblogs.Architecture.Ddd.Cqrs.DependencyInjection;
using Cnblogs.Architecture.IntegrationTestProject.Application.Commands;
using Cnblogs.Architecture.IntegrationTestProject.Application.Queries;
using Cnblogs.Architecture.IntegrationTestProject.Payloads;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Cnblogs.Architecture.Ddd.EventBus.Dapr;
using Cnblogs.Architecture.TestIntegrationEvents;
using Cnblogs.Architecture.TestIntegrationEvents;

using FluentAssertions;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;

namespace Cnblogs.Architecture.UnitTests.EventBus;

Expand Down