Skip to content

Commit

Permalink
Merge pull request #3 from The-Standard-Organization/users/lboullosa/…
Browse files Browse the repository at this point in the history
…models-abstraction

MODELS: Abstraction interfaces
  • Loading branch information
LBoullosa authored May 22, 2024
2 parents 36c65a0 + bb3cbea commit 7d61937
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
11 changes: 11 additions & 0 deletions STX.SPAL.Abstractions/ISPALBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// ----------------------------------------------------------------------------------
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

namespace STX.SPAL.Abstractions
{
public interface ISPALBase
{
string GetSPALId();
}
}
41 changes: 41 additions & 0 deletions STX.SPAL.Abstractions/Providers/IAbstractionProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// ----------------------------------------------------------------------------------
// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using System.Threading.Tasks;

namespace STX.SPAL.Abstractions.Providers
{
public interface IAbstractionProvider<T>
where T : ISPALBase
{
T GetProvider();

void UseProvider(string spalId = null);

void UseProvider(
Type concreteProviderType = null,
string spalId = null);

void UseProvider<TConcreteProviderType>(
string spalId = null)
where TConcreteProviderType : T;

void Invoke<TResult>(Action<T> spalFunction);

void InvokeWithProvider<TConcreteProviderType, TResult>(
Action<T> spalFunction)
where TConcreteProviderType : T;

TResult Invoke<TResult>(
Func<T, TResult> spalFunction);

ValueTask InvokeAsync<TResult>(
Func<T, ValueTask> spalFunction);

ValueTask<TResult> InvokeAsync<TResult>(
Func<T, ValueTask<TResult>> spalFunction);

}
}
9 changes: 9 additions & 0 deletions STX.SPAL.Abstractions/STX.SPAL.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions STX.SPAL.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "STX.SPAL.Core.Tests.Accepta
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "STX.SPAL.Core.Tests.Unit", "STX.SPAL.Core.Tests.Unit\STX.SPAL.Core.Tests.Unit.csproj", "{FB55487C-EB2D-405A-95F1-295DDE2DFE75}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "STX.SPAL.Abstractions", "STX.SPAL.Abstractions\STX.SPAL.Abstractions.csproj", "{05AECCF2-472D-424D-A36E-17541C9FF019}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STX.SPAL.Providers.Core", "STX.SPAL.Providers.Core\STX.SPAL.Providers.Core.csproj", "{002F2D46-A7A4-4C11-9A3A-C494419EB5E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,6 +37,14 @@ Global
{FB55487C-EB2D-405A-95F1-295DDE2DFE75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB55487C-EB2D-405A-95F1-295DDE2DFE75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB55487C-EB2D-405A-95F1-295DDE2DFE75}.Release|Any CPU.Build.0 = Release|Any CPU
{05AECCF2-472D-424D-A36E-17541C9FF019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05AECCF2-472D-424D-A36E-17541C9FF019}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05AECCF2-472D-424D-A36E-17541C9FF019}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05AECCF2-472D-424D-A36E-17541C9FF019}.Release|Any CPU.Build.0 = Release|Any CPU
{002F2D46-A7A4-4C11-9A3A-C494419EB5E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{002F2D46-A7A4-4C11-9A3A-C494419EB5E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{002F2D46-A7A4-4C11-9A3A-C494419EB5E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{002F2D46-A7A4-4C11-9A3A-C494419EB5E6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 4 additions & 0 deletions STX.SPAL.Core/STX.SPAL.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\STX.SPAL.Abstractions\STX.SPAL.Abstractions.csproj" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions STX.SPAL.Providers.Core/STX.SPAL.Providers.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

</Project>

0 comments on commit 7d61937

Please sign in to comment.