Skip to content

Commit

Permalink
todo summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynab committed Jan 8, 2024
1 parent b21b256 commit 877c674
Show file tree
Hide file tree
Showing 107 changed files with 2,822 additions and 1,412 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using BenchmarkDotNet.Attributes;
using YANLib.Benchmarks.Models;
using static System.Guid;
using static System.Threading.Tasks.Parallel;
using YANLib.Benchmarks.Models;

namespace YANLib.Benchmarks.Process.Common;

Expand Down
4 changes: 1 addition & 3 deletions console/YANLib.Benchmarks/Process/Common/HttpBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using BenchmarkDotNet.Attributes;

namespace YANLib.Benchmarks.Process.Common;
namespace YANLib.Benchmarks.Process.Common;

public class HttpBenchmark
{
Expand Down
5 changes: 1 addition & 4 deletions console/YANLib.Benchmarks/Process/Common/LoopBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using BenchmarkDotNet.Attributes;
using static System.Runtime.InteropServices.CollectionsMarshal;

namespace YANLib.Benchmarks.Process.Common;
namespace YANLib.Benchmarks.Process.Common;

public class LoopBenchmark
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using BenchmarkDotNet.Attributes;
using YANLib.Benchmarks.Models;
using YANLib.Core;
using static Newtonsoft.Json.JsonConvert;
using static System.Guid;
using static System.Threading.Tasks.Parallel;
using YANLib.Benchmarks.Models;

namespace YANLib.Benchmarks.Process.Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using BenchmarkDotNet.Attributes;
using YANLib.Benchmarks.Models;
using YANLib.Core;
using static Newtonsoft.Json.JsonConvert;
using static System.Guid;
using static System.Threading.Tasks.Parallel;
using YANLib.Benchmarks.Models;

namespace YANLib.Benchmarks.Process.Library;

Expand Down
4 changes: 1 addition & 3 deletions console/YANLib.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static System.Console;

#if RELEASE
#if RELEASE
using YANLib.Benchmarks.Process.Common;
using YANLib.Benchmarks.Process.Library;
using static BenchmarkDotNet.Running.BenchmarkRunner;
Expand Down
5 changes: 1 addition & 4 deletions host/YANLib.HttpApi.Host/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;

namespace YANLib.Controllers;
namespace YANLib.Controllers;

public class HomeController : AbpController
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace YANLib.EntityFrameworkCore;
namespace YANLib.EntityFrameworkCore;

public class YANLibHttpApiHostMigrationsDbContext(DbContextOptions<YANLibHttpApiHostMigrationsDbContext> options) : AbpDbContext<YANLibHttpApiHostMigrationsDbContext>(options)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
using static System.IO.Directory;

namespace YANLib.EntityFrameworkCore;
namespace YANLib.EntityFrameworkCore;

public class YANLibHttpApiHostMigrationsDbContextFactory : IDesignTimeDbContextFactory<YANLibHttpApiHostMigrationsDbContext>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using Microsoft.AspNetCore.Http;
using System;
using System.IO;
using System.Threading.Tasks;
using static Microsoft.AspNetCore.Http.StatusCodes;
using static Serilog.Log;
using static System.Net.HttpStatusCode;

namespace YANLib.Middlewares;
namespace YANLib.Middlewares;

public class UnauthorizedHandlerMiddleware(RequestDelegate next)
{
Expand Down
10 changes: 1 addition & 9 deletions host/YANLib.HttpApi.Host/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.Threading.Tasks;
using static Microsoft.AspNetCore.Builder.WebApplication;

namespace YANLib;
namespace YANLib;

public class Program
{
Expand Down
5 changes: 1 addition & 4 deletions host/YANLib.HttpApi.Host/YANLibBrandingProvider.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Volo.Abp.DependencyInjection;
using Volo.Abp.Ui.Branding;

namespace YANLib;
namespace YANLib;

[Dependency(ReplaceServices = true)]
public class YANLibBrandingProvider : DefaultBrandingProvider
Expand Down
45 changes: 0 additions & 45 deletions host/YANLib.HttpApi.Host/YANLibHttpApiHostModule.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,6 @@
using DotNetCore.CAP;
using Elastic.Apm.DiagnosticSource;
using Elastic.Apm.EntityFrameworkCore;
using Elastic.Apm.NetCoreAll;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.EventBus.Azure;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Http.Client;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Swashbuckle;
using YANLib.EntityFrameworkCore;
using YANLib.Utilities;
using static Elastic.Apm.Agent;
using static HealthChecks.UI.Client.UIResponseWriter;
using static Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerDefaults;
using static Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus;
using static System.Convert;
using static System.StringSplitOptions;

#if !DEBUG
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Http;
using YANLib.Middlewares;
using static Microsoft.OpenApi.Models.ParameterLocation;
using static Microsoft.OpenApi.Models.SecuritySchemeType;
using static System.Net.HttpStatusCode;
using static System.Threading.Tasks.Task;
#endif

namespace YANLib;
Expand Down
46 changes: 2 additions & 44 deletions lib/YANLib/Core/YANBytes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,11 @@ public static partial class YANBytes
/// <returns>A byte array representing the UTF-8 encoded serialization of the input object, or <see langword="null"/> if the input object is <see langword="null"/>.</returns>
public static byte[]? ToByteArray(this object? val) => val.IsNull() ? default : UTF8.GetBytes(val.StandardSerialize() ?? string.Empty);

/// <summary>
/// Converts a collection of objects to an enumerable collection of byte arrays.
/// If the collection is <see langword="null"/> or empty, returns <see langword="null"/>.
/// Each object in the collection is converted to a byte array.
/// </summary>
/// <param name="vals">The collection of objects to be converted to byte arrays. Can be <see langword="null"/>.</param>
/// <returns>An enumerable collection of byte arrays, or <see langword="null"/> if the input collection is <see langword="null"/> or empty.</returns>
public static IEnumerable<byte[]?>? ToByteArrays(this IEnumerable<object?>? vals) => vals.IsEmptyOrNull() ? default : vals.Select(x => x.ToByteArray());

/// <summary>
/// Converts a collection (ICollection) of objects to an enumerable collection of byte arrays.
/// If the collection is <see langword="null"/> or empty, returns <see langword="null"/>.
/// Each object in the collection is converted to a byte array.
/// </summary>
/// <param name="vals">The ICollection of objects to be converted to byte arrays. Can be <see langword="null"/>.</param>
/// <returns>An enumerable collection of byte arrays, or <see langword="null"/> if the input ICollection is <see langword="null"/> or empty.</returns>
public static IEnumerable<byte[]?>? ToByteArrays(this ICollection<object?>? vals) => vals.IsEmptyOrNull() ? default : vals.Select(x => x.ToByteArray());

/// <summary>
/// Converts an array of objects to an enumerable collection of byte arrays.
/// If the array is <see langword="null"/> or empty, returns <see langword="null"/>.
/// Each object in the array is converted to a byte array.
/// </summary>
/// <param name="vals">The array of objects to be converted to byte arrays. Can be <see langword="null"/>.</param>
/// <returns>An enumerable collection of byte arrays, or <see langword="null"/> if the input array is <see langword="null"/> or empty.</returns>
public static IEnumerable<byte[]?>? ToByteArrays(this object?[]? vals) => vals.IsEmptyOrNull() ? default : vals.Select(x => x.ToByteArray());
public static IEnumerable<byte[]?>? ToByteArrays(params object?[]? vals) => vals.IsEmptyOrNull() ? default : vals.Select(x => x.ToByteArray());

/// <summary>
/// Converts a byte array to its equivalent object of type <typeparamref name="T"/>.
Expand All @@ -49,30 +28,9 @@ public static partial class YANBytes
/// <returns>The object of type <typeparamref name="T"/> represented by the deserialized byte array, or the default value of type <typeparamref name="T"/> if the byte array is <see langword="null"/>.</returns>
public static T? FromByteArray<T>(this byte[]? arr) => arr.IsNull() ? default : UTF8.GetString(arr).Deserialize<T>();

/// <summary>
/// Converts a collection of byte arrays to an enumerable collection of objects of type <typeparamref name="T"/>.
/// If the collection is <see langword="null"/> or empty, returns <see langword="null"/>.
/// Each byte array in the collection is converted to an object of type <typeparamref name="T"/>.
/// </summary>
/// <param name="arrs">The collection of byte arrays to be converted. Can be <see langword="null"/>.</param>
/// <returns>An enumerable collection of objects of type <typeparamref name="T"/>, or <see langword="null"/> if the input collection is <see langword="null"/> or empty.</returns>
public static IEnumerable<T?>? FromByteArrays<T>(this IEnumerable<byte[]?>? arrs) => arrs.IsEmptyOrNull() ? default : arrs.Select(x => x.FromByteArray<T>());

/// <summary>
/// Converts a collection (ICollection) of byte arrays to an enumerable collection of objects of type <typeparamref name="T"/>.
/// If the collection is <see langword="null"/> or empty, returns <see langword="null"/>.
/// Each byte array in the collection is converted to an object of type <typeparamref name="T"/>.
/// </summary>
/// <param name="arrs">The ICollection of byte arrays to be converted. Can be <see langword="null"/>.</param>
/// <returns>An enumerable collection of objects of type <typeparamref name="T"/>, or <see langword="null"/> if the input ICollection is <see langword="null"/> or empty.</returns>
public static IEnumerable<T?>? FromByteArrays<T>(this ICollection<byte[]?>? arrs) => arrs.IsEmptyOrNull() ? default : arrs.Select(x => x.FromByteArray<T>());

/// <summary>
/// Converts an array of byte arrays to an enumerable collection of objects of type <typeparamref name="T"/>.
/// If the array is <see langword="null"/> or empty, returns <see langword="null"/>.
/// Each byte array in the array is converted to an object of type <typeparamref name="T"/>.
/// </summary>
/// <param name="arrs">The array of byte arrays to be converted. Can be <see langword="null"/>.</param>
/// <returns>An enumerable collection of objects of type <typeparamref name="T"/>, or <see langword="null"/> if the input array is <see langword="null"/> or empty.</returns>
public static IEnumerable<T?>? FromByteArrays<T>(this byte[]?[]? arrs) => arrs.IsEmptyOrNull() ? default : arrs.Select(x => x.FromByteArray<T>());
public static IEnumerable<T?>? FromByteArrays<T>(params byte[]?[]? arrs) => arrs.IsEmptyOrNull() ? default : arrs.Select(x => x.FromByteArray<T>());
}
Loading

0 comments on commit 877c674

Please sign in to comment.