Acidmanic.Utilities
1.0.2
See the version list below for details.
dotnet add package Acidmanic.Utilities --version 1.0.2
NuGet\Install-Package Acidmanic.Utilities -Version 1.0.2
<PackageReference Include="Acidmanic.Utilities" Version="1.0.2" />
paket add Acidmanic.Utilities --version 1.0.2
#r "nuget: Acidmanic.Utilities, 1.0.2"
// Install Acidmanic.Utilities as a Cake Addin
#addin nuget:?package=Acidmanic.Utilities&version=1.0.2
// Install Acidmanic.Utilities as a Cake Tool
#tool nuget:?package=Acidmanic.Utilities&version=1.0.2
Utilities
This package contains some useful classes that commonly are being used in different project types.
Results
Its a cleaner substitution of tupples where a function needs to return the success/failure status of its operation along side or without the actual result of the operation (in case of success).
It has been implemented in three levels
Result
: Only represents the success/failureResult<T>
: provides the success/failure status and also holds a value of typeT
which in case of success would be the operation result- It's cast-able to both boolean (success/failure) and
T
- It's cast-able to both boolean (success/failure) and
Result<TPrimary,TSecondary>
: same asResult<T>
, but it can carry two different values.
Factory Base
The class FactoryBase<TProduct,TArgument>
provides an implementation
of Factory Design Pattern. Where TProduct
would be the type of what factory would
be making. and TArgument
is the type of argument passing to Make()
method, and factory should decide which the implementation based on this argument.
for example if you have an ICar
interface, and you have implementations like
MohaveCar
, CamaroCar
, CameryCar
and X3Car
. And you want to have a
factory that makes a car by it's brand name. So for this case, the TProduct would be
ICar
and TArgument would be string
.
Next step you would extend FactoryBase
class and implement it's match methods:
- implement
MatchesByType(Type,TArgument)
if your factory would be able to decide only by type and the argument. And it does not need to have the instance to make a decision. - implement
MatchByInstance(TProduct,TArgument)
if your factory needs an instance of the object to be able to decide if it matches the argument or not.
you also would need to satisfy the factoryMatching
argument in base class's
constructor. This argument determines which of two methods above are you using.
What about my DI?
If your implementations are needed to be created by any kind of DI or IOC,
all you have to do is to pass a Func<Type,object>
delegate to constructor.
this delegate will make the Factory class enable to use your Di resolver to
instantiate your implementations.
In the other hand, if you are not using a DI or any alternative for instantiating your implementations, Factory class would still work while your implementations have a non-parametric constructor.
How The Factory Finds My Implementations?
By default, the factory, when instantiated, scans the assembly containing your factory class,
(which you derived from FactoryBase<,>) for all implementations of TProduct.
If your implementations are in any other assembly, you can just call the method
ScanAssembly
passing that assembly to it.
_What There is no valid implementation for given Argument?
Usually the best practice would be to use a NULL Implementation for such situations.
FactoryBase would return null if it does not find any implementation. But you can change
this behavior by overriding the method DefaultValue
and return your
Null Implementation there.
If you have a class derived from TProduct that is actually a NullObject implementation,
to Prevent the FactoryBase to use it as a valid implementation, simply just Use
NullObject
attribute on your implementation.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Acidmanic.Utilities:
Package | Downloads |
---|---|
EnTier
Easy N-Tier Architecture, Working out of the box!(Kind of!!) |
|
Meadow.Framework
Managed and Enhanced ADO Wrapper |
|
EnTier.DataAccess.Meadow
This package adds extensions to use Meadow with EnTier |
|
CoreCommandLine
This library provides an easy setup for a commandline application. |
|
EnTier.EventStore.WebView
Web based event-browser for EnTier event-srouced applications |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.22-b03 | 41 | 6/20/2024 |
1.0.22-b02 | 370 | 10/28/2023 |
1.0.22-b01 | 63 | 10/26/2023 |
1.0.21 | 413 | 10/21/2023 |
1.0.20 | 141 | 10/3/2023 |
1.0.19 | 114 | 10/3/2023 |
1.0.18 | 455 | 9/12/2023 |
1.0.17 | 107 | 9/12/2023 |
1.0.16 | 138 | 9/6/2023 |
1.0.15 | 79 | 9/6/2023 |
1.0.14 | 105 | 9/6/2023 |
1.0.14-internal01 | 61 | 9/4/2023 |
1.0.13 | 283 | 8/31/2023 |
1.0.12 | 206 | 8/28/2023 |
1.0.11 | 130 | 8/27/2023 |
1.0.10 | 115 | 8/26/2023 |
1.0.9 | 88 | 8/26/2023 |
1.0.8 | 87 | 8/26/2023 |
1.0.7 | 172 | 8/21/2023 |
1.0.6 | 541 | 3/6/2023 |
1.0.4 | 636 | 2/26/2023 |
1.0.2 | 1,509 | 11/4/2022 |
1.0.0 | 5,171 | 9/5/2022 |