Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a0b1f92

Browse files
Update namespaces and fix warnings
1 parent 1e64c1b commit a0b1f92

File tree

68 files changed

+193
-170
lines changed

Some content is hidden

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

68 files changed

+193
-170
lines changed

‎.editorconfig‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,19 @@ dotnet_diagnostic.CA1028.severity = error # CA1028: Enum storage should be Int32
224224
dotnet_diagnostic.CA1030.severity = suggestion # CA1030: Use events where appropriate
225225
dotnet_diagnostic.CA1031.severity = silent # CA1031: Do not catch general exception types
226226
dotnet_diagnostic.CA1032.severity = silent # CA1032: Implement standard exception constructors
227-
dotnet_diagnostic.CA1033.severity = error # CA1033: Interface methods should be callable by child types
227+
dotnet_diagnostic.CA1033.severity = warning # CA1033: Interface methods should be callable by child types
228228
dotnet_diagnostic.CA1034.severity = none # CA1034: Nested types should not be visible
229229
dotnet_diagnostic.CA1036.severity = silent # CA1036: Override methods on comparable types
230-
dotnet_diagnostic.CA1040.severity = error # CA1040: Avoid empty interfaces
230+
dotnet_diagnostic.CA1040.severity = warning # CA1040: Avoid empty interfaces
231231
dotnet_diagnostic.CA1041.severity = error # CA1041: Provide ObsoleteAttribute message
232232
dotnet_diagnostic.CA1043.severity = warning # CA1043: Use integral or string argument for indexers
233233
dotnet_diagnostic.CA1044.severity = error # CA1044: Properties should not be write only
234234
dotnet_diagnostic.CA1045.severity = error # CA1045: Do not pass types by reference
235235
dotnet_diagnostic.CA1046.severity = silent # CA1046: Do not overload operator equals on reference types
236236
dotnet_diagnostic.CA1047.severity = error # CA1047: Do not declare protected members in sealed types
237237
dotnet_diagnostic.CA1050.severity = error # CA1050: Declare types in namespaces
238-
dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible instance fields
239-
dotnet_diagnostic.CA1052.severity = error # CA1052: Static holder types should be Static or NotInheritable
238+
dotnet_diagnostic.CA1051.severity = warning # CA1051: Do not declare visible instance fields
239+
dotnet_diagnostic.CA1052.severity = warning # CA1052: Static holder types should be Static or NotInheritable
240240
dotnet_diagnostic.CA1053.severity = error # CA1053: Static holder types should not have default constructors
241241
dotnet_diagnostic.CA1054.severity = suggestion # CA1054: URI parameters should not be strings
242242
dotnet_diagnostic.CA1055.severity = suggestion # CA1055: URI return values should not be strings
@@ -288,7 +288,7 @@ dotnet_diagnostic.CA1717.severity = suggestion # CA1717: Only FlagsAttribute enu
288288
dotnet_diagnostic.CA1720.severity = warning # CA1720: Identifiers should not contain type names
289289
dotnet_diagnostic.CA1721.severity = warning # CA1721: Property names should not match get methods
290290
dotnet_diagnostic.CA1724.severity = none # CA1724: Type names should not match namespaces
291-
dotnet_diagnostic.CA1725.severity = error # CA1725: Parameter names should match base declaration
291+
dotnet_diagnostic.CA1725.severity = warning # CA1725: Parameter names should match base declaration
292292
dotnet_diagnostic.CA1727.severity = error # CA1727: Use PascalCase for named placeholders
293293
dotnet_diagnostic.CA1801.severity = error # CA1801: Review unused parameters
294294
dotnet_diagnostic.CA1802.severity = error # CA1802: Use Literals Where Appropriate
@@ -303,7 +303,7 @@ dotnet_diagnostic.CA1816.severity = error # CA1816: Call GC.SuppressFinalize cor
303303
dotnet_diagnostic.CA1819.severity = warning # CA1819: Properties should not return arrays
304304
dotnet_diagnostic.CA1820.severity = error # CA1820: Test for empty strings using string length
305305
dotnet_diagnostic.CA1821.severity = error # CA1821: Remove empty finalizers
306-
dotnet_diagnostic.CA1822.severity = error # CA1822: Mark members as static
306+
dotnet_diagnostic.CA1822.severity = warning # CA1822: Mark members as static
307307
dotnet_diagnostic.CA1823.severity = error # CA1823: Avoid unused private fields
308308
dotnet_diagnostic.CA1824.severity = warning # CA1824: Mark assemblies with NeutralResourcesLanguageAttribute
309309
dotnet_diagnostic.CA1825.severity = error # CA1825: Avoid zero-length array allocations
@@ -468,7 +468,7 @@ dotnet_diagnostic.CA5390.severity = error # CA5390: Do not hard-code encryption
468468
dotnet_diagnostic.CA5391.severity = warning # CA5391: Use antiforgery tokens in ASP.NET Core MVC controllers
469469
dotnet_diagnostic.CA5392.severity = warning # CA5392: Use DefaultDllImportSearchPaths attribute for P/Invokes
470470
dotnet_diagnostic.CA5393.severity = warning # CA5393: Do not use unsafe DllImportSearchPath value
471-
dotnet_diagnostic.CA5394.severity = error # CA5394: Do not use insecure randomness
471+
dotnet_diagnostic.CA5394.severity = warning # CA5394: Do not use insecure randomness
472472
dotnet_diagnostic.CA5395.severity = error # CA5395: Miss HttpVerb attribute for action methods
473473
dotnet_diagnostic.CA5396.severity = error # CA5396: Set HttpOnly to true for HttpCookie
474474
dotnet_diagnostic.CA5397.severity = error # CA5397: Do not use deprecated SslProtocols values
@@ -568,7 +568,7 @@ dotnet_diagnostic.IDE0056.severity = warning # IDE0056: Use index operator
568568
dotnet_diagnostic.IDE0056WithoutSuggestion.severity = warning # IDE0056: Use index operator
569569
dotnet_diagnostic.IDE0057.severity = suggestion # IDE0057: Use range operator
570570
dotnet_diagnostic.IDE0057WithoutSuggestion.severity = suggestion # IDE0057: Use range operator
571-
dotnet_diagnostic.IDE0058.severity = error # IDE0058: Expression value is never used
571+
dotnet_diagnostic.IDE0058.severity = warning # IDE0058: Expression value is never used
572572
dotnet_diagnostic.IDE0059.severity = error # IDE0059: Expression value is never used
573573
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
574574
dotnet_diagnostic.IDE0061.severity = silent # IDE0061: Use expression body for local functions

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Components/EventAggregator.cs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using EventAggregatorLibrary.Contracts;
1+
using StoreManagement.Contracts;
22

3-
namespace EventAggregatorLibrary.Components;
3+
namespace StoreManagement.Components;
44

55
public class EventAggregator : IEventAggregator
66
{
@@ -29,7 +29,7 @@ public void Publish(IEvent @event)
2929
observer.OnNext(@event);
3030
}
3131

32-
if (!_typedObservers.TryGetValue(@event.GetType(), out List<IObserver<IEvent>> typedObservers))
32+
if (!_typedObservers.TryGetValue(@event.GetType(), out var typedObservers))
3333
{
3434
return;
3535
}
@@ -75,15 +75,15 @@ public IDisposable Subscribe<T>(ICustomObserver<T> newObserver)
7575
observers = _typedObservers[typeof(T)] = new List<IObserver<IEvent>>();
7676
}
7777

78-
return SubsribeAndSendEvents(observers, newObserver, _events.Where(evt => evt is T));
78+
return SubscribeAndSendEvents(observers, newObserver, _events.Where(evt => evt is T));
7979
}
8080

8181
private IDisposable SubscribeToAllEvents(IObserver<IEvent> newObserver)
8282
{
83-
return SubsribeAndSendEvents(_observers, newObserver, _events);
83+
return SubscribeAndSendEvents(_observers, newObserver, _events);
8484
}
8585

86-
private IDisposable SubsribeAndSendEvents(
86+
private IDisposable SubscribeAndSendEvents(
8787
List<IObserver<IEvent>> currentObservers,
8888
IObserver<IEvent> newObserver,
8989
IEnumerable<IEvent> events)
@@ -101,4 +101,4 @@ private IDisposable SubsribeAndSendEvents(
101101

102102
return new Unsubscriber<IEvent>(currentObservers, newObserver);
103103
}
104-
}
104+
}

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Components/Publishers/OrderPublisher.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using EventAggregatorLibrary.Contracts;
2-
using EventAggregatorLibrary.Events;
1+
using StoreManagement.Contracts;
2+
using StoreManagement.Events;
33

4-
namespace EventAggregatorLibrary.Components.Publishers;
4+
namespace StoreManagement.Components.Publishers;
55

66
public class OrderPublisher : IPublisher
77
{

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Components/Publishers/WarehousePublisher.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using EventAggregatorLibrary.Contracts;
2-
using EventAggregatorLibrary.Events;
1+
using StoreManagement.Contracts;
2+
using StoreManagement.Events;
33

4-
namespace EventAggregatorLibrary.Components.Publishers;
4+
namespace StoreManagement.Components.Publishers;
55

66
public class WarehousePublisher : IPublisher
77
{

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Components/Subscribers/BusinessTrackingSubscriber.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using EventAggregatorLibrary.Contracts;
1+
using StoreManagement.Contracts;
22

3-
namespace EventAggregatorLibrary.Components.Subscribers;
3+
namespace StoreManagement.Components.Subscribers;
44

55
/// <summary>
66
/// Business tracking subscriber tracks all events in the system.

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Components/Subscribers/OrderSubscriber.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using EventAggregatorLibrary.Contracts;
2-
using EventAggregatorLibrary.Events;
1+
using StoreManagement.Contracts;
2+
using StoreManagement.Events;
33

4-
namespace EventAggregatorLibrary.Components.Subscribers;
4+
namespace StoreManagement.Components.Subscribers;
55

66
/// <summary>
77
/// Order subscriber tracks only order created event.
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace EventAggregatorLibrary.Components;
1+
namespace StoreManagement.Components;
22

33
/// <summary>
44
/// Enables a subscriber to unsubscribe from further events.
@@ -7,6 +7,7 @@ public class Unsubscriber<T> : IDisposable
77
{
88
private readonly List<IObserver<T>> _observers;
99
private readonly IObserver<T> _observerToUnsubscribe;
10+
private bool _isDisposed;
1011

1112
public Unsubscriber(List<IObserver<T>> observers, IObserver<T> observerToUnsubscribe)
1213
{
@@ -16,10 +17,27 @@ public Unsubscriber(List<IObserver<T>> observers, IObserver<T> observerToUnsubsc
1617

1718
public void Dispose()
1819
{
19-
if (_observers.Contains(_observerToUnsubscribe))
20+
Dispose(true);
21+
GC.SuppressFinalize(this);
22+
}
23+
24+
// The bulk of the clean-up code is implemented in Dispose(bool)
25+
protected virtual void Dispose(bool disposing)
26+
{
27+
if (_isDisposed)
2028
{
21-
_observers.Remove(_observerToUnsubscribe);
22-
Console.WriteLine($"Observer is unsubsribed.");
29+
return;
2330
}
31+
32+
if (disposing)
33+
{
34+
if (_observers.Contains(_observerToUnsubscribe))
35+
{
36+
_observers.Remove(_observerToUnsubscribe);
37+
Console.WriteLine($"Observer is unsubsribed.");
38+
}
39+
}
40+
41+
_isDisposed = true;
2442
}
25-
}
43+
}

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Contracts/ICustomObserver.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace EventAggregatorLibrary.Contracts;
1+
namespace StoreManagement.Contracts;
22

33
public interface ICustomObserver<T> : IObserver<IEvent>
44
where T : IEvent

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Contracts/IEvent.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace EventAggregatorLibrary.Contracts;
1+
namespace StoreManagement.Contracts;
22

33
public interface IEvent
44
{

‎src/AdditionalPatterns/EventAggregator/StoreManagement/Contracts/IEventAggregator.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace EventAggregatorLibrary.Contracts;
1+
namespace StoreManagement.Contracts;
22

33
public interface IEventAggregator : IObservable<IEvent>
44
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /