Skip to content

Commit 99582fb

Browse files
committed
Implemented unified / async-only / nullable.
1 parent dd5dce4 commit 99582fb

File tree

159 files changed

+2133
-2032
lines changed

Some content is hidden

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

159 files changed

+2133
-2032
lines changed

.editorconfig

+77
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
1+
[*.cs]
2+
indent_style = space
3+
indent_size = 4
4+
csharp_using_directive_placement = outside_namespace:silent
5+
csharp_prefer_simple_using_statement = true:suggestion
6+
csharp_prefer_braces = true:silent
7+
csharp_style_namespace_declarations = file_scoped:error
8+
csharp_style_prefer_method_group_conversion = true:silent
9+
csharp_style_prefer_top_level_statements = true:silent
10+
csharp_style_prefer_primary_constructors = true:suggestion
11+
csharp_prefer_system_threading_lock = true:suggestion
12+
csharp_style_expression_bodied_methods = false:silent
13+
csharp_style_expression_bodied_constructors = false:silent
14+
csharp_style_expression_bodied_operators = false:silent
15+
csharp_style_expression_bodied_properties = true:silent
16+
csharp_style_expression_bodied_indexers = true:silent
17+
csharp_style_expression_bodied_accessors = true:silent
18+
csharp_style_expression_bodied_lambdas = true:silent
19+
csharp_style_expression_bodied_local_functions = false:silent
20+
csharp_indent_labels = one_less_than_current
21+
22+
[*.csproj]
23+
indent_style = space
24+
tab_width = 2
25+
126
[*.{yml,yaml}]
227
indent_style = space
328
indent_size = 2
29+
30+
[*.{cs,vb}]
31+
#### Naming styles ####
32+
33+
# Naming rules
34+
35+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
36+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
37+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
38+
39+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
40+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
41+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
42+
43+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
44+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
45+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
46+
47+
# Symbol specifications
48+
49+
dotnet_naming_symbols.interface.applicable_kinds = interface
50+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
51+
dotnet_naming_symbols.interface.required_modifiers =
52+
53+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
54+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
55+
dotnet_naming_symbols.types.required_modifiers =
56+
57+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
58+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
59+
dotnet_naming_symbols.non_field_members.required_modifiers =
60+
61+
# Naming styles
62+
63+
dotnet_naming_style.begins_with_i.required_prefix = I
64+
dotnet_naming_style.begins_with_i.required_suffix =
65+
dotnet_naming_style.begins_with_i.word_separator =
66+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
67+
68+
dotnet_naming_style.pascal_case.required_prefix =
69+
dotnet_naming_style.pascal_case.required_suffix =
70+
dotnet_naming_style.pascal_case.word_separator =
71+
dotnet_naming_style.pascal_case.capitalization = pascal_case
72+
73+
dotnet_naming_style.pascal_case.required_prefix =
74+
dotnet_naming_style.pascal_case.required_suffix =
75+
dotnet_naming_style.pascal_case.word_separator =
76+
dotnet_naming_style.pascal_case.capitalization = pascal_case
77+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
78+
tab_width = 4
79+
indent_size = 4
80+
end_of_line = crlf

Directory.Build.props

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<LangVersion>latest</LangVersion>
4+
</PropertyGroup>
5+
</Project>

Shuttle.Access.Application/ActivateIdentityParticipant.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99

1010
namespace Shuttle.Access.Application;
1111

12-
public class ActivateIdentityParticipant : IAsyncParticipant<RequestResponseMessage<ActivateIdentity, IdentityActivated>>
12+
public class ActivateIdentityParticipant : IParticipant<RequestResponseMessage<ActivateIdentity, IdentityActivated>>
1313
{
1414
private readonly IEventStore _eventStore;
1515
private readonly IIdentityQuery _identityQuery;
1616

1717
public ActivateIdentityParticipant(IIdentityQuery identityQuery, IEventStore eventStore)
1818
{
19-
Guard.AgainstNull(identityQuery, nameof(identityQuery));
20-
Guard.AgainstNull(eventStore, nameof(eventStore));
19+
Guard.AgainstNull(identityQuery);
20+
Guard.AgainstNull(eventStore);
2121

2222
_identityQuery = identityQuery;
2323
_eventStore = eventStore;
2424
}
2525

2626
public async Task ProcessMessageAsync(IParticipantContext<RequestResponseMessage<ActivateIdentity, IdentityActivated>> context)
2727
{
28-
Guard.AgainstNull(context, nameof(context));
28+
Guard.AgainstNull(context);
2929

3030
var message = context.Message.Request;
3131
var now = DateTime.UtcNow;
@@ -53,7 +53,7 @@ public async Task ProcessMessageAsync(IParticipantContext<RequestResponseMessage
5353
var stream = await _eventStore.GetAsync(id);
5454

5555
stream.Apply(identity);
56-
stream.AddEvent(identity.Activate(now));
56+
stream.Add(identity.Activate(now));
5757

5858
context.Message.WithResponse(new()
5959
{

Shuttle.Access.Application/ChangePasswordParticipant.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88
namespace Shuttle.Access.Application;
99

10-
public class ChangePasswordParticipant : IAsyncParticipant<RequestMessage<ChangePassword>>
10+
public class ChangePasswordParticipant : IParticipant<RequestMessage<ChangePassword>>
1111
{
1212
private readonly IEventStore _eventStore;
1313
private readonly IHashingService _hashingService;
1414
private readonly ISessionRepository _sessionRepository;
1515

1616
public ChangePasswordParticipant(IHashingService hashingService, ISessionRepository sessionRepository, IEventStore eventStore)
1717
{
18-
Guard.AgainstNull(hashingService, nameof(hashingService));
19-
Guard.AgainstNull(sessionRepository, nameof(sessionRepository));
20-
Guard.AgainstNull(eventStore, nameof(eventStore));
18+
Guard.AgainstNull(hashingService);
19+
Guard.AgainstNull(sessionRepository);
20+
Guard.AgainstNull(eventStore);
2121

2222
_hashingService = hashingService;
2323
_sessionRepository = sessionRepository;
@@ -26,7 +26,7 @@ public ChangePasswordParticipant(IHashingService hashingService, ISessionReposit
2626

2727
public async Task ProcessMessageAsync(IParticipantContext<RequestMessage<ChangePassword>> context)
2828
{
29-
Guard.AgainstNull(context, nameof(context));
29+
Guard.AgainstNull(context);
3030

3131
var request = context.Message.Request;
3232

@@ -70,7 +70,7 @@ public async Task ProcessMessageAsync(IParticipantContext<RequestMessage<ChangeP
7070
}
7171

7272
stream.Apply(user);
73-
stream.AddEvent(user.SetPassword(_hashingService.Sha256(request.NewPassword)));
73+
stream.Add(user.SetPassword(_hashingService.Sha256(request.NewPassword)));
7474

7575
await _eventStore.SaveAsync(stream);
7676
}

Shuttle.Access.Application/ConfigureApplicationParticipant.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Shuttle.Access.Application;
1010

11-
public class ConfigureApplicationParticipant : IAsyncParticipant<ConfigureApplication>
11+
public class ConfigureApplicationParticipant : IParticipant<ConfigureApplication>
1212
{
1313
private readonly IIdentityQuery _identityQuery;
1414
private readonly IMediator _mediator;
@@ -34,10 +34,10 @@ public class ConfigureApplicationParticipant : IAsyncParticipant<ConfigureApplic
3434

3535
public ConfigureApplicationParticipant(IMediator mediator, IRoleQuery roleQuery, IPermissionQuery permissionQuery, IIdentityQuery identityQuery)
3636
{
37-
Guard.AgainstNull(mediator, nameof(mediator));
38-
Guard.AgainstNull(roleQuery, nameof(roleQuery));
39-
Guard.AgainstNull(permissionQuery, nameof(permissionQuery));
40-
Guard.AgainstNull(identityQuery, nameof(identityQuery));
37+
Guard.AgainstNull(mediator);
38+
Guard.AgainstNull(roleQuery);
39+
Guard.AgainstNull(permissionQuery);
40+
Guard.AgainstNull(identityQuery);
4141

4242
_mediator = mediator;
4343
_roleQuery = roleQuery;
@@ -47,7 +47,7 @@ public ConfigureApplicationParticipant(IMediator mediator, IRoleQuery roleQuery,
4747

4848
public async Task ProcessMessageAsync(IParticipantContext<ConfigureApplication> context)
4949
{
50-
Guard.AgainstNull(context, nameof(context));
50+
Guard.AgainstNull(context);
5151

5252
var roleSpecification = new DataAccess.Query.Role.Specification().AddName("Administrator");
5353

Shuttle.Access.Application/GenerateHashParticipant.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
namespace Shuttle.Access.Application;
77

8-
public class GenerateHashParticipant : IAsyncParticipant<GenerateHash>
8+
public class GenerateHashParticipant : IParticipant<GenerateHash>
99
{
1010
private readonly IHashingService _hashingService;
1111

1212
public GenerateHashParticipant(IHashingService hashingService)
1313
{
14-
Guard.AgainstNull(hashingService, nameof(hashingService));
14+
Guard.AgainstNull(hashingService);
1515

1616
_hashingService = hashingService;
1717
}
1818

1919
public async Task ProcessMessageAsync(IParticipantContext<GenerateHash> context)
2020
{
21-
Guard.AgainstNull(context, nameof(context));
21+
Guard.AgainstNull(context);
2222

2323
context.Message.Hash = _hashingService.Sha256(context.Message.Value);
2424

Shuttle.Access.Application/GeneratePasswordParticipant.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
namespace Shuttle.Access.Application;
77

8-
public class GeneratePasswordParticipant : IAsyncParticipant<GeneratePassword>
8+
public class GeneratePasswordParticipant : IParticipant<GeneratePassword>
99
{
1010
private readonly IPasswordGenerator _passwordGenerator;
1111

1212
public GeneratePasswordParticipant(IPasswordGenerator passwordGenerator)
1313
{
14-
Guard.AgainstNull(passwordGenerator, nameof(passwordGenerator));
14+
Guard.AgainstNull(passwordGenerator);
1515

1616
_passwordGenerator = passwordGenerator;
1717
}
1818

1919
public async Task ProcessMessageAsync(IParticipantContext<GeneratePassword> context)
2020
{
21-
Guard.AgainstNull(context, nameof(context));
21+
Guard.AgainstNull(context);
2222

2323
context.Message.GeneratedPassword = _passwordGenerator.Generate();
2424

Shuttle.Access.Application/GetPasswordResetTokenParticipant.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Shuttle.Access.Application;
1010

11-
public class GetPasswordResetTokenParticipant : IAsyncParticipant<RequestResponseMessage<GetPasswordResetToken, Guid>>
11+
public class GetPasswordResetTokenParticipant : IParticipant<RequestResponseMessage<GetPasswordResetToken, Guid>>
1212
{
1313
private readonly IEventStore _eventStore;
1414
private readonly IIdentityQuery _identityQuery;
@@ -40,7 +40,7 @@ public async Task ProcessMessageAsync(IParticipantContext<RequestResponseMessage
4040
{
4141
if (!identity.HasPasswordResetToken)
4242
{
43-
stream.AddEvent(identity.RegisterPasswordResetToken());
43+
stream.Add(identity.RegisterPasswordResetToken());
4444

4545
await _eventStore.SaveAsync(stream);
4646
}

Shuttle.Access.Application/RefreshSessionParticipant.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Shuttle.Access.Application;
88

9-
public class RefreshSessionParticipant : IAsyncParticipant<RefreshSession>
9+
public class RefreshSessionParticipant : IParticipant<RefreshSession>
1010
{
1111
private readonly IAccessService _accessService;
1212
private readonly IAuthorizationService _authorizationService;

Shuttle.Access.Application/RegisterIdentityParticipant.cs

+14-14
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,37 @@
1010

1111
namespace Shuttle.Access.Application;
1212

13-
public class RegisterIdentityParticipant : IAsyncParticipant<RequestResponseMessage<RegisterIdentity, IdentityRegistered>>
13+
public class RegisterIdentityParticipant : IParticipant<RequestResponseMessage<RegisterIdentity, IdentityRegistered>>
1414
{
1515
private readonly IEventStore _eventStore;
1616
private readonly IIdentityQuery _identityQuery;
17-
private readonly IKeyStore _keyStore;
17+
private readonly IIdKeyRepository _idKeyRepository;
1818
private readonly IRoleQuery _roleQuery;
1919

20-
public RegisterIdentityParticipant(IEventStore eventStore, IKeyStore keyStore, IIdentityQuery identityQuery, IRoleQuery roleQuery)
20+
public RegisterIdentityParticipant(IEventStore eventStore, IIdKeyRepository idKeyRepository, IIdentityQuery identityQuery, IRoleQuery roleQuery)
2121
{
22-
Guard.AgainstNull(eventStore, nameof(eventStore));
23-
Guard.AgainstNull(keyStore, nameof(keyStore));
24-
Guard.AgainstNull(identityQuery, nameof(identityQuery));
25-
Guard.AgainstNull(roleQuery, nameof(roleQuery));
22+
Guard.AgainstNull(eventStore);
23+
Guard.AgainstNull(idKeyRepository);
24+
Guard.AgainstNull(identityQuery);
25+
Guard.AgainstNull(roleQuery);
2626

2727
_eventStore = eventStore;
28-
_keyStore = keyStore;
28+
_idKeyRepository = idKeyRepository;
2929
_identityQuery = identityQuery;
3030
_roleQuery = roleQuery;
3131
}
3232

3333
public async Task ProcessMessageAsync(IParticipantContext<RequestResponseMessage<RegisterIdentity, IdentityRegistered>> context)
3434
{
35-
Guard.AgainstNull(context, nameof(context));
35+
Guard.AgainstNull(context);
3636

3737
var message = context.Message.Request;
3838

3939
EventStream stream;
4040
Identity identity;
4141

4242
var key = Identity.Key(message.Name);
43-
var id = await _keyStore.FindAsync(key);
43+
var id = await _idKeyRepository.FindAsync(key);
4444

4545
if (id.HasValue)
4646
{
@@ -59,14 +59,14 @@ public async Task ProcessMessageAsync(IParticipantContext<RequestResponseMessage
5959
id = Guid.NewGuid();
6060
identity = new();
6161

62-
await _keyStore.AddAsync(id.Value, key);
62+
await _idKeyRepository.AddAsync(id.Value, key);
6363

6464
stream = await _eventStore.GetAsync(id.Value);
6565
}
6666

6767
var registered = identity.Register(message.Name, message.PasswordHash, message.RegisteredBy, message.GeneratedPassword, message.Activated);
6868

69-
stream.AddEvent(registered);
69+
stream.Add(registered);
7070

7171
var count = await _identityQuery.CountAsync(new DataAccess.Query.Identity.Specification().WithRoleName("Administrator"));
7272

@@ -83,13 +83,13 @@ public async Task ProcessMessageAsync(IParticipantContext<RequestResponseMessage
8383

8484
if (role.Name.Equals("Administrator", StringComparison.InvariantCultureIgnoreCase))
8585
{
86-
stream.AddEvent(identity.AddRole(role.Id));
86+
stream.Add(identity.AddRole(role.Id));
8787
}
8888
}
8989

9090
if (message.Activated)
9191
{
92-
stream.AddEvent(identity.Activate(registered.DateRegistered));
92+
stream.Add(identity.Activate(registered.DateRegistered));
9393
}
9494

9595
context.Message.WithResponse(new()

0 commit comments

Comments
 (0)