Skip to content

Commit 00cf90b

Browse files
authored
Merge pull request #102 from Tynab/develop
Develop
2 parents f275b8d + 983ee22 commit 00cf90b

File tree

93 files changed

+1275
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1275
-555
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ Extends the standard .NET Task API with additional methods for task coordination
128128

129129
- Conditional task waiting
130130
- Conditional task completion
131+
- Asynchronous enumeration of task results
132+
- Result limiting capabilities
131133
- Graceful error handling
132134
- Cancellation support
133135

@@ -145,6 +147,19 @@ var result = await tasks.WaitAnyWithCondition(x => x > 10);
145147

146148
// Similar functionality with WhenAny pattern
147149
var result2 = await tasks.WhenAnyWithCondition(x => x > 20); // Returns 25
150+
151+
// Process multiple matching results as an asynchronous stream
152+
// Internal methods accessible via InternalsVisibleTo for testing
153+
var results = tasks.WaitAnyWithConditions(x => x > 10);
154+
155+
await foreach (var item in results)
156+
{
157+
Console.WriteLine(item); // Outputs 15, then 25
158+
}
159+
160+
// Limit the number of results returned
161+
var limitedResults = tasks.WhenAnyWithConditions(x => x > 0, taken: 2);
162+
// Will only process the first 2 matching results
148163
```
149164

150165
### YANText
@@ -337,7 +352,7 @@ YANLib is designed with performance in mind. The library uses various optimizati
337352
YANJson is built on System.Text.Json, which offers significantly better performance compared to Newtonsoft.Json, especially for large datasets.
338353

339354
<div align="center">
340-
<img src='pic/1.jpg' alt="JSON Performance Comparison">
355+
<img src='https://raw.githubusercontent.com/Tynab/YANLib/refs/heads/main/pic/1.jpg' alt="JSON Performance Comparison">
341356
</div>
342357

343358
System.Text.Json is designed to provide better performance and security compared to other JSON libraries. It supports advanced features like parallel parsing and support for new data types such as Span and Utf8JsonReader, enabling faster data processing and reduced memory usage.
@@ -362,7 +377,7 @@ For the most recent performance benchmarks, visit:
362377
[https://yanlib.yamiannephilim.com/api/json/yan-vs-standards?quantity=10000&hideSystem=true](https://yanlib.yamiannephilim.com/api/json/yan-vs-standards?quantity=10000&hideSystem=true)
363378

364379
<div align="center">
365-
<img src='pic/0.jpg' alt="YAN vs Standards Performance">
380+
<img src='https://raw.githubusercontent.com/Tynab/YANLib/refs/heads/main/pic/0.jpg' alt="YAN vs Standards Performance">
366381
</div>
367382

368383
## 💻 Code Examples

console/YANLib.Benchmarks/Process/Common/ConcurrentCollectionBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class ConcurrentCollectionBenchmark
2222
[GlobalSetup]
2323
public void Setup()
2424
{
25-
_allData = [.. Range(1, Size).Select(i => new SampleClass
25+
_allData = [.. Range(1, Size).Select(static i => new SampleClass
2626
{
2727
Id = NewGuid()
2828
})];

host/YANLib.Blazor.Client/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
12
using System.Threading.Tasks;
23

34
namespace YANLib.Blazor.Client;

host/YANLib.Blazor.Client/YANLibBlazorAutoMapperProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using AutoMapper;
2+
13
namespace YANLib.Blazor.Client;
24

35
public class YANLibBlazorAutoMapperProfile : Profile

host/YANLib.Blazor.Client/YANLibBlazorClientModule.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
using System;
1+
using Blazorise.Bootstrap5;
2+
using Blazorise.Icons.FontAwesome;
3+
using Localization.Resources.AbpUi;
4+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
5+
using Microsoft.Extensions.DependencyInjection;
6+
using System;
27
using System.Net.Http;
8+
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
9+
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme;
10+
using Volo.Abp.Autofac.WebAssembly;
11+
using Volo.Abp.AutoMapper;
12+
using Volo.Abp.Identity.Blazor.WebAssembly;
13+
using Volo.Abp.Localization;
14+
using Volo.Abp.Modularity;
15+
using Volo.Abp.SettingManagement.Blazor.WebAssembly;
16+
using Volo.Abp.TenantManagement.Blazor.WebAssembly;
17+
using YANLib.Localization;
318

419
namespace YANLib.Blazor.Client;
520

host/YANLib.Blazor.Client/YANLibBrandingProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
namespace YANLib.Blazor.Client;
1+
using Microsoft.Extensions.Localization;
2+
using Volo.Abp.DependencyInjection;
3+
using Volo.Abp.Ui.Branding;
4+
using YANLib.Localization;
5+
6+
namespace YANLib.Blazor.Client;
27

38
[Dependency(ReplaceServices = true)]
49
public class YANLibBrandingProvider : DefaultBrandingProvider

host/YANLib.Blazor.Client/YANLibBundleContributor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace YANLib.Blazor.Client;
1+
using Volo.Abp.Bundling;
2+
3+
namespace YANLib.Blazor.Client;
24

35
/* Add your global styles/scripts here.
46
* See https://docs.abp.io/en/abp/latest/UI/Blazor/Global-Scripts-Styles to learn how to use it

host/YANLib.Blazor.Client/YANLibComponentBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace YANLib.Blazor.Client;
1+
using Volo.Abp.AspNetCore.Components;
2+
using YANLib.Localization;
3+
4+
namespace YANLib.Blazor.Client;
25

36
public abstract class YANLibComponentBase : AbpComponentBase
47
{

host/YANLib.HttpApi.Host/ExceptionHandling/YANLibExceptionToErrorInfoConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public class YANLibExceptionToErrorInfoConverter(
2121
IServiceProvider serviceProvider
2222
) : DefaultExceptionToErrorInfoConverter(localizationOptions, stringLocalizerFactory, stringLocalizer, serviceProvider), ITransientDependency
2323
{
24-
private readonly HashSet<string?> _errorCodes = new(typeof(YANLibDomainErrorCodes).GetFields(Public | Static | FlattenHierarchy)
25-
.Where(x => x.IsLiteral && !x.IsInitOnly)
26-
.Select(x => x.GetRawConstantValue()?.ToString())
27-
.Where(x => x.IsNotNull()));
24+
private readonly HashSet<string?> _errorCodes = [.. typeof(YANLibDomainErrorCodes).GetFields(Public | Static | FlattenHierarchy)
25+
.Where(static x => x.IsLiteral && !x.IsInitOnly)
26+
.Select(static x => x.GetRawConstantValue()?.ToString())
27+
.Where(static x => x.IsNotNull())];
2828

2929
protected override RemoteServiceErrorInfo CreateErrorInfoWithoutCode(Exception exception, AbpExceptionHandlingOptions options)
3030
{

host/YANLib.HttpApi.Host/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Serilog;
66
using System;
77
using System.Threading.Tasks;
8+
using YANLib.ServiceDefaults;
89
using static Microsoft.AspNetCore.Builder.WebApplication;
910
using static Serilog.Events.LogEventLevel;
1011
using static System.StringComparison;
@@ -21,7 +22,7 @@ public async static Task<int> Main(string[] args)
2122
#else
2223
.MinimumLevel.Information()
2324
#endif
24-
.MinimumLevel.Override("Microsoft", Information).MinimumLevel.Override("Microsoft.EntityFrameworkCore", Warning).Enrich.FromLogContext().WriteTo.Async(c => c.Console()).CreateLogger();
25+
.MinimumLevel.Override("Microsoft", Information).MinimumLevel.Override("Microsoft.EntityFrameworkCore", Warning).Enrich.FromLogContext().WriteTo.Async(static c => c.Console()).CreateLogger();
2526

2627
try
2728
{
@@ -31,7 +32,7 @@ public async static Task<int> Main(string[] args)
3132

3233
//await builder.Configuration.AddConfigFromAws(builder.Environment.EnvironmentName);
3334

34-
_ = builder.Host.AddAppSettingsSecretsJson().UseAutofac().UseSerilog((t, f) => f.Enrich.FromLogContext().ReadFrom.Configuration(t.Configuration));
35+
_ = builder.Host.AddAppSettingsSecretsJson().UseAutofac().UseSerilog(static (t, f) => f.Enrich.FromLogContext().ReadFrom.Configuration(t.Configuration));
3536
_ = builder.AddServiceDefaults();
3637
_ = await builder.AddApplicationAsync<YANLibHttpApiHostModule>();
3738

0 commit comments

Comments
 (0)