Solutions:
Solution modules are next-to-fully implemented programs that can be attached to other projects to expedite frequently required functionalities like payment processing or mailing.
A solution has the name "Codespirals.Solution.[Solution name]" and build on the code in library modules.
They usually contain one or more of the following:
Services
A set of [...]Service classes and interfaces that implement the functionality of the solution, which can be used via dependency injection. These services are defined by an interface of the same name.
public interface IAbcService
{
[Custom function definitions]
}
public class AbcService : IAbcService
{
[Custom function implementations]
}
Via the service collection of the application builder, this service is then registered (usually in a file named Programm or Startup).
builder.Services.AddService<IAbcService, AbcService>();
Usually a custom extension method for IServiceCollection is provided to make that step easier.
And finally, any class in the application that needs methods this service provides it can be used through common Dependency Injection
OtherClass(IAbcService abcService)
Builders
Builders are versatile, modular helper classes that allow for easy building (duh) of objects or methods.
They usually entail a way to "start" building - a method returning the builder (I usually don't allow new() for my builders), then all the modular methods to do the actual "building", each returning the builder themselves for method chaining, and finally a way to conclude building.
public class AbcClass
{
var builderResult = BuiderExample.StartBuilder().AddXX(xx).WithY(y).Build();
}
Options
A class that contains all the options that can be individualised in a project, which are required to use the solution. This is a POGO class that mirrors the options set in the appsettings.json file (or similar), which would look a bit like this:
{
AbcOptions:{
Version:"1.0.1",
XXXOption: 420,
ETC: "F"
}
}
Just like the services, we then have to register these options in the applications builder
builder.Services.Configure<AbcOptions>(builder.Configuration.GetSection(nameof(AbcOptions));
This options class will be used to inject settings into other services and classes via
Service(IOptions<AbcOptions> options)
Other interfaces, models and extensions
The simple models and extensions that make sure the solution is as self contained as possible.
Codespirals solutions:
Symbols
- ☭ - is, or will be released with a CC0 licence, free for anyone to use, modify and use for anyone however they wish
- 🔓 - open source, but with an attribution licence
- 🔑 - private until fully tested and released
- 🔒 - private with no current plans to release publicly