Skip to content

Commit 771a49f

Browse files
committed
- Rename project to Light Chain from Simple Chain because the name is already taken on nuget.org.
- Update package publish info.
1 parent 1c51f95 commit 771a49f

8 files changed

+68
-35
lines changed

SimpleChain.sln renamed to LightChain.sln

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.9.34902.65
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleChain", "SimpleChain\SimpleChain.csproj", "{0F65EDD3-359B-41D0-B412-5BC4B130AA2A}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LightChain", "SimpleChain\LightChain.csproj", "{0F65EDD3-359B-41D0-B412-5BC4B130AA2A}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{1EEA11FA-60E3-480A-87F9-BC4279751185}"
99
ProjectSection(SolutionItems) = preProject
1010
.editorconfig = .editorconfig
11+
README.md = README.md
1112
EndProjectSection
1213
EndProject
1314
Global

README.md

+29-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Simple Chain
1+
# Light Chain
22

3-
Lightweight library for implementing simplified version of [chain of responsibility](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern) in C#.
3+
Lightweight library for implementing simplified version of
4+
[chain of responsibility](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern)
5+
in C#.
46

5-
The inspiration for this library came from figuring out a way to break up `if/else` chains
6-
into loosely coupled, separate units to improve maintainability through separation of concerns.
7+
The inspiration for this library came from figuring out a way to break up
8+
`if/else` chains into loosely coupled, separate units to improve maintainability
9+
through separation of concerns.
710

811
Example of `if/else` chain:
912

@@ -34,21 +37,23 @@ public class Main
3437
}
3538
```
3639

37-
As we can see from the example, all the blocks of conditions and processing are stuck together
38-
in the `if/else` construct within the same class. The `if/else` construct itself adds a bit of noise.
39-
It is difficult to view and change high level concerns only, such as order of each case.
40+
As we can see from the example, all the blocks of conditions and processing are
41+
stuck together in the `if/else` construct within the same class. The `if/else`
42+
construct itself adds a bit of noise. It is difficult to view and change high
43+
level concerns only, such as order of each case.
4044

4145
# Getting Started
4246

4347
## Installation
4448

45-
Add the library via NuGet to the project(s) that you want to use Simple Chain:
49+
Add the library via NuGet to the project(s) that you want to use Light Chain:
4650

47-
- Either via Project > Manage NuGet Packages... / Browse / search for simple-chain / Install
51+
- Either via Project > Manage NuGet Packages... / Browse / search for
52+
light-chain / Install
4853
- Or by running a command in the Package Manager Console
4954

5055
```c#
51-
Install-Package SimpleChain
56+
Install-Package LightChain
5257
```
5358

5459
## Usage
@@ -67,12 +72,11 @@ public class AnimalProcessorInput
6772
Derive a processor interface from `IProcessor`:
6873

6974
```c#
70-
using SimpleChain;
75+
using LightChain;
7176

7277
public interface IAnimalProcessor : IProcessor<AnimalProcessorInput, string>
7378
{
7479
}
75-
7680
```
7781

7882
Create each of the processors derived from the interface you just created:
@@ -116,7 +120,7 @@ public class DefaultProcessor : IAnimalProcessor
116120
Now you can create the chain and use it with the input:
117121

118122
```c#
119-
using SimpleChain;
123+
using LightChain;
120124

121125
public class Main
122126
{
@@ -151,18 +155,20 @@ public class Main
151155
}
152156
```
153157

154-
Be aware that the order of the processors in the list matters:
155-
the first processor whose condition returns `true` will handle returning the output.
158+
Be aware that the order of the processors in the list matters: the first
159+
processor whose condition returns `true` will handle returning the output.
156160

157161
### Dependency Injection
158162

159-
Using a dependency injection framework, the processor list and chain instance can be
160-
defined separately from the main class via the dependency injection framework.
163+
Using a dependency injection framework, the processor list and chain instance
164+
can be defined separately from the main class via the dependency injection
165+
framework.
161166

162-
Using Microsoft.Extensions.DependencyInjection the `Main` class can be refactored:
167+
Using Microsoft.Extensions.DependencyInjection the `Main` class can be
168+
refactored:
163169

164170
```c#
165-
using SimpleChain;
171+
using LightChain;
166172

167173
public class Main
168174
{
@@ -193,7 +199,7 @@ The main, processors, and chain classes can be registered with the DI framework:
193199

194200
```c#
195201
using Microsoft.Extensions.DependencyInjection;
196-
using SimpleChain;
202+
using LightChain;
197203

198204
internal static class ServiceRegistrations
199205
{
@@ -211,10 +217,11 @@ internal static class ServiceRegistrations
211217
}
212218
```
213219

214-
The end result is improved separation of concerns such that the main class no longer needs to change due to any modifications related to processors:
220+
The end result is improved separation of concerns such that the main class no
221+
longer needs to change due to any modifications related to processors:
215222

216223
- Adding or removing processors from the chain.
217224
- Reordering processors in the chain.
218225
- Changing implementation details of a processor.
219226

220-
Also, each processor is completely separate from each other and the chain.
227+
Also, each processor is completely separate from each other and the chain.

SimpleChain/Chain.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SimpleChain;
1+
namespace LightChain;
22

33
/// <inheritdoc cref="IChain{TInput, TOutput}" />
44
/// <typeparam name="TProcessor">Interface for processors to be used. Recommended to be derived from <see cref="IProcessor{T}"/>.</typeparam>

SimpleChain/IChain.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SimpleChain;
1+
namespace LightChain;
22

33
/// <summary>
44
/// Orchestrator of the chain of responsibility.

SimpleChain/IProcessor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SimpleChain;
1+
namespace LightChain;
22

33
/// <summary>
44
/// Base processor interface used by the library. All processors must implement this interface.

SimpleChain/LightChain.csproj

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<Title>Light Chain</Title>
8+
<Authors>Coding Flow</Authors>
9+
<Description>Lightweight library for implementing simplified version of chain of responsibility in C#.
10+
11+
The inspiration for this library came from figuring out a way to break up `if/else` chains into loosely coupled, separate units to improve maintainability through separation of concerns.</Description>
12+
<PackageIcon>nuget-package-logo.png</PackageIcon>
13+
<PackageReadmeFile>README.md</PackageReadmeFile>
14+
<RepositoryUrl>https://github.com/CodingFlow/simple-chain</RepositoryUrl>
15+
<RepositoryType>git</RepositoryType>
16+
<PackageTags>chain;chain-of-responsibility;design;design-patterns;separation-of-concerns;</PackageTags>
17+
<PackageReleaseNotes>0.1.0
18+
- Initial release.</PackageReleaseNotes>
19+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
20+
<VersionPrefix>0.1.0</VersionPrefix>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<None Include="..\nuget-package-logo.png">
25+
<Pack>True</Pack>
26+
<PackagePath>\</PackagePath>
27+
</None>
28+
<None Include="..\README.md">
29+
<Pack>True</Pack>
30+
<PackagePath>\</PackagePath>
31+
</None>
32+
</ItemGroup>
33+
34+
</Project>

SimpleChain/SimpleChain.csproj

-9
This file was deleted.

nuget-package-logo.png

6.23 KB
Loading

0 commit comments

Comments
 (0)