Skip to content

Commit e5e41e4

Browse files
authored
Feature/value task (#4)
* preapre docs * bump version * bump tasks * update tasks * allocate dispatcher * update valuetask
1 parent 29f86e5 commit e5e41e4

File tree

96 files changed

+3234
-1360
lines changed

Some content is hidden

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

96 files changed

+3234
-1360
lines changed

.editorconfig

Lines changed: 103 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,41 @@ indent_size = 4
1515
indent_style = space
1616

1717
# New line preferences
18-
end_of_line = unset
18+
end_of_line = crlf
1919
insert_final_newline = false
20+
dotnet_style_coalesce_expression = true:suggestion
21+
dotnet_style_null_propagation = true:suggestion
22+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
23+
dotnet_style_prefer_auto_properties = true:silent
24+
dotnet_style_object_initializer = true:suggestion
25+
dotnet_style_collection_initializer = true:suggestion
26+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
27+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
28+
dotnet_style_prefer_conditional_expression_over_return = true:silent
29+
dotnet_style_explicit_tuple_names = true:suggestion
30+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
31+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
32+
dotnet_style_prefer_compound_assignment = true:suggestion
33+
dotnet_style_prefer_simplified_interpolation = true:suggestion
34+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
35+
dotnet_style_namespace_match_folder = true:suggestion
36+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
37+
dotnet_diagnostic.CA1304.severity = warning
38+
dotnet_diagnostic.CA1707.severity = none
39+
dotnet_diagnostic.CA1829.severity = warning
2040

2141
#### Build files ####
2242

2343
# Solution files
24-
[*.{sln,slnx}]
44+
[*.{sln}]
2545
tab_width = 4
2646
indent_size = 4
2747
indent_style = tab
2848

49+
# Modern solution files
50+
[*.{slnx}]
51+
indent_size = 2
52+
2953
# Configuration files
3054
[*.{json,xml,yml,config,runsettings}]
3155
indent_size = 2
@@ -123,7 +147,7 @@ csharp_prefer_braces = true:suggestion
123147
csharp_using_directive_placement = outside_namespace:warning
124148
csharp_style_namespace_declarations = file_scoped:warning
125149
csharp_style_unused_value_assignment_preference = discard_variable:warning
126-
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
150+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
127151
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
128152

129153
# Expression-level preferences
@@ -225,9 +249,9 @@ dotnet_naming_style.prefix_interface_interface_with_i.required_prefix
225249
# Naming Rules
226250

227251
# Async
228-
dotnet_naming_rule.async_methods_end_in_async.severity = silent
252+
dotnet_naming_rule.async_methods_end_in_async.severity = silent
229253
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
230-
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
254+
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
231255

232256
dotnet_naming_symbols.any_async_methods.applicable_kinds = method
233257
dotnet_naming_symbols.any_async_methods.applicable_accessibilities = *
@@ -237,45 +261,45 @@ dotnet_naming_style.end_in_async.required_suffix
237261
dotnet_naming_style.end_in_async.capitalization = pascal_case
238262

239263
# Constant fields must be PascalCase
240-
dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = silent
264+
dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = silent
241265
dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields
242-
dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case
266+
dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case
243267
# Public, internal and protected readonly fields must be PascalCase
244-
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = silent
268+
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = silent
245269
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.symbols = non_private_readonly_fields
246-
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case
270+
dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case
247271
# Static readonly fields must be PascalCase
248-
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = silent
272+
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = silent
249273
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields
250-
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case
274+
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case
251275
# Private readonly fields must be camelCase
252-
dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = silent
276+
dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = silent
253277
dotnet_naming_rule.private_readonly_fields_must_be_camel_case.symbols = private_readonly_fields
254-
dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = camel_case
278+
dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = camel_case
255279
# Public and internal fields must be PascalCase
256-
dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.severity = silent
280+
dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.severity = silent
257281
dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.symbols = public_internal_protected_fields
258-
dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.style = pascal_case
282+
dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.style = pascal_case
259283
# Private and protected fields must be camelCase
260-
dotnet_naming_rule.private_fields_must_be_camel_case.severity = silent
284+
dotnet_naming_rule.private_fields_must_be_camel_case.severity = silent
261285
dotnet_naming_rule.private_fields_must_be_camel_case.symbols = private_protected_fields
262-
dotnet_naming_rule.private_fields_must_be_camel_case.style = prefix_private_field_with_underscore
286+
dotnet_naming_rule.private_fields_must_be_camel_case.style = prefix_private_field_with_underscore
263287
# Public members must be capitalized
264-
dotnet_naming_rule.public_members_must_be_capitalized.severity = silent
288+
dotnet_naming_rule.public_members_must_be_capitalized.severity = silent
265289
dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
266-
dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper
290+
dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper
267291
# Parameters must be camelCase
268-
dotnet_naming_rule.parameters_must_be_camel_case.severity = silent
292+
dotnet_naming_rule.parameters_must_be_camel_case.severity = silent
269293
dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters
270-
dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case
294+
dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case
271295
# Class, struct, enum and delegates must be PascalCase
272-
dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = silent
296+
dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = silent
273297
dotnet_naming_rule.non_interface_types_must_be_pascal_case.symbols = non_interface_types
274-
dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case
298+
dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case
275299
# Interfaces must be PascalCase and start with an 'I'
276-
dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = silent
300+
dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = silent
277301
dotnet_naming_rule.interface_types_must_be_prefixed_with_i.symbols = interface_types
278-
dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i
302+
dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i
279303
# prefix_private_field_with_underscore - Private fields must be prefixed with _
280304
dotnet_naming_style.prefix_private_field_with_underscore.capitalization = camel_case
281305
dotnet_naming_style.prefix_private_field_with_underscore.required_prefix = _
@@ -344,18 +368,36 @@ dotnet_diagnostic.CA2238.severity = warning
344368
dotnet_diagnostic.CA2240.severity = warning
345369
dotnet_diagnostic.CA2241.severity = warning
346370
dotnet_diagnostic.CA2242.severity = warning
371+
dotnet_diagnostic.CS9107.severity = suggestion
372+
dotnet_diagnostic.CS0612.severity = suggestion
373+
374+
# Async Fixer
375+
376+
dotnet_diagnostic.AsyncFixer01.severity = silent
377+
378+
# ErrorProne
379+
380+
dotnet_diagnostic.EPC12.severity = suggestion
381+
dotnet_diagnostic.EPS05.severity = suggestion
382+
383+
# IDispossable
384+
385+
dotnet_diagnostic.IDISP001.severity = warning
386+
dotnet_diagnostic.IDISP017.severity = none
387+
dotnet_diagnostic.IDISP013.severity = suggestion
388+
dotnet_diagnostic.IDISP004.severity = warning
389+
dotnet_diagnostic.IDISP001.severity = warning
390+
dotnet_diagnostic.IDISP026.severity = suggestion
347391

348392
# Require file header OR A source file contains a header that does not match the required text
349393
dotnet_diagnostic.IDE0073.severity = error
350394

351395
# StyleCop Code Analysis
352396

353-
# Closing parenthesis should be spaced correctly: "foo()!"
354-
dotnet_diagnostic.SA1009.severity = none
355-
356-
# Hide warnings when using the new() expression from C# 9.
357-
dotnet_diagnostic.SA1000.severity = none
358-
397+
dotnet_diagnostic.SA1005.severity = suggestion # Single line comments should begin with a space
398+
dotnet_diagnostic.SA0001.severity = none
399+
dotnet_diagnostic.SA1009.severity = none # Closing parenthesis should be spaced correctly: "foo()!"
400+
dotnet_diagnostic.SA1000.severity = none # Hide warnings when using the new() expression from C# 9.
359401
dotnet_diagnostic.SA1011.severity = none
360402
dotnet_diagnostic.SA1101.severity = none
361403

@@ -382,7 +424,7 @@ dotnet_diagnostic.SA1602.severity = none
382424
dotnet_diagnostic.SA1611.severity = none
383425

384426
# DocumentationTextMustEndWithAPeriod: Let's enable this rule back when we shift to WinUI3 (v8.x). If we do it now, it would mean more than 400 file changes.
385-
dotnet_diagnostic.SA1629.severity = none
427+
dotnet_diagnostic.SA1629.severity = warning
386428

387429
dotnet_diagnostic.SA1633.severity = none
388430
dotnet_diagnostic.SA1634.severity = none
@@ -409,7 +451,33 @@ dotnet_diagnostic.WPF0070.severity = none # Add default field to converter
409451
# Suppress some IDE warnings
410452
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor
411453
dotnet_diagnostic.CS1591.severity = none # Missing XML comment for publicly visible type or member
412-
# 15000+ warnings in the solution
454+
413455
dotnet_diagnostic.CA1510.severity = none # Use ArgumentNullException throw helper
414-
# doesn't work with older versions of .NET
415-
456+
csharp_prefer_simple_using_statement = true:suggestion
457+
csharp_style_prefer_method_group_conversion = true:silent
458+
csharp_style_prefer_top_level_statements = true:silent
459+
csharp_style_prefer_primary_constructors = true:suggestion
460+
csharp_style_expression_bodied_local_functions = false:silent
461+
462+
dotnet_diagnostic.ASPIREPROXYENDPOINTS001.severity = none
463+
csharp_prefer_system_threading_lock = true:suggestion
464+
csharp_style_prefer_null_check_over_type_check = true:suggestion
465+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
466+
dotnet_diagnostic.CA1311.severity = warning
467+
468+
# unreachable code
469+
dotnet_diagnostic.CS0162.severity = error
470+
471+
# non-nullable property uninitialized
472+
dotnet_diagnostic.CS8618.severity = error
473+
474+
# nullability of type argument doesn't match 'notnull' constraint
475+
dotnet_diagnostic.CS8714.severity = error
476+
477+
# nullability mismatch in return type of lambda
478+
dotnet_diagnostic.CS8621.severity = error
479+
dotnet_diagnostic.CS8766.severity = error
480+
481+
# switch expression not exhaustive
482+
dotnet_diagnostic.CS8524.severity = warning
483+
dotnet_diagnostic.CS8509.severity = error

.github/workflows/reflection-events-cd-nuget.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: dotnet restore
3838

3939
- name: Build
40-
run: dotnet build ReflectionEventing.sln --configuration Release --no-restore -p:SourceLinkEnabled=true
40+
run: dotnet build ReflectionEventing.slnx --configuration Release --no-restore -p:SourceLinkEnabled=true
4141

4242
- name: Publish the package to NuGet.org
4343
run: nuget push **\*.nupkg -NonInteractive -SkipDuplicate -Source 'https://api.nuget.org/v3/index.json'

.github/workflows/reflection-events-pr-validator.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: dotnet restore
2828

2929
- name: Build
30-
run: dotnet build ReflectionEventing.sln --configuration Release --no-restore
30+
run: dotnet build ReflectionEventing.slnx --configuration Release --no-restore
3131

3232
- name: Run tests
33-
run: dotnet test ReflectionEventing.sln --configuration Release --no-restore --no-build --verbosity quiet
33+
run: dotnet test ReflectionEventing.slnx --configuration Release --no-restore --no-build --verbosity quiet

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ src/lepo.snk
99
# DocFX
1010
docs/api/
1111

12+
docs/board.md
13+
1214
# User-specific files
1315
*.rsuser
1416
*.suo

.serena/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/cache
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Architecture and Design Patterns
2+
3+
## Core Architecture
4+
5+
ReflectionEventing follows a modular architecture with clear separation of concerns:
6+
7+
### Core Components
8+
9+
1. **EventBus** (`src/ReflectionEventing/EventBus.cs`)
10+
- Central event dispatching mechanism
11+
- Manages consumer registration and event publication
12+
- Supports multiple processing modes
13+
14+
2. **IConsumer<T>** Interface
15+
- Event consumers implement this interface
16+
- Provides `ConsumeAsync(T payload, CancellationToken)` method
17+
- Allows multiple consumers per event type
18+
19+
3. **Consumer Providers**
20+
- Abstract consumer resolution from specific DI containers
21+
- Each DI integration has its own provider implementation
22+
- Supports dependency injection for consumers
23+
24+
4. **Consumer Types Providers**
25+
- Hashed lookup for efficient consumer discovery
26+
- Supports polymorphic event handling
27+
- Uses reflection to find matching consumers
28+
29+
5. **Event Queues** (`src/ReflectionEventing/Queues/`)
30+
- Channel-based event queue implementation
31+
- Background processing support
32+
- Failed event handling
33+
34+
## Design Patterns
35+
36+
### Dependency Injection
37+
- Core abstraction independent of specific DI container
38+
- Adapter pattern for each DI framework
39+
- Consumers resolved from DI container at runtime
40+
41+
### Builder Pattern
42+
- `EventBusBuilder` for configuring the event bus
43+
- Fluent API for adding consumers and options
44+
- Extension methods for each DI integration
45+
46+
### Observer Pattern
47+
- Event bus as subject
48+
- Consumers as observers
49+
- Decoupled event publishers and subscribers
50+
51+
### Strategy Pattern
52+
- Different processing modes (sequential, parallel, queued)
53+
- Pluggable consumer type resolution strategies
54+
- Flexible error handling strategies
55+
56+
### Factory Pattern
57+
- Consumer provider factories for each DI container
58+
- EventBus instantiation through builders
59+
60+
## Processing Modes
61+
62+
1. **Sequential** - Events processed one at a time in order
63+
2. **Parallel** - Multiple events processed concurrently
64+
3. **Queued** - Events placed in queue for background processing
65+
66+
## Key Design Principles
67+
68+
### Inversion of Control (IoC)
69+
- Event publishers don't know about consumers
70+
- Consumers registered via DI container
71+
- Loose coupling between components
72+
73+
### Single Responsibility
74+
- EventBus: Event routing
75+
- Consumer Providers: DI integration
76+
- Consumer Types Providers: Type resolution
77+
- Event Queues: Background processing
78+
79+
### Open/Closed Principle
80+
- Core library closed for modification
81+
- Open for extension via DI integrations
82+
- Custom consumer types providers can be implemented
83+
84+
### Interface Segregation
85+
- Small, focused interfaces (`IEventBus`, `IConsumer<T>`)
86+
- Separate concerns (provider vs types provider)
87+
88+
### Dependency Inversion
89+
- Depend on abstractions (`IEventBus`, `IConsumerProvider`)
90+
- DI integrations depend on core abstractions
91+
92+
## Threading and Async
93+
- Async/await throughout
94+
- CancellationToken support
95+
- Channel-based queuing for thread-safe event processing
96+
- Task-based parallelism for concurrent event handling
97+
98+
## Error Handling
99+
- EventBusException for bus-specific errors
100+
- QueueException for queue-specific errors
101+
- Failed events captured and can be reprocessed
102+
- Graceful degradation on consumer failures
103+
104+
## Performance Considerations
105+
- Hashed lookup for consumer types (O(1) average case)
106+
- Channel-based queuing for efficient producer-consumer pattern
107+
- AOT compilation support for .NET 8.0+
108+
- Trimming support to reduce app size

0 commit comments

Comments
 (0)