feat: Legacy-Version des Client Services erstellt und bestehende Services und Routen integriert
This commit is contained in:
parent
966b96f315
commit
d1ac521e8d
@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindreamHub.Abstractions",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindreamHub.Client", "src\WindreamHub.Client\WindreamHub.Client.csproj", "{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindreamHub.Legacy.Client", "src\WindreamHub.Legacy.Client\WindreamHub.Legacy.Client.csproj", "{67E6A3A1-F863-417E-9619-DC9B6A710512}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -23,6 +25,10 @@ Global
|
||||
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{67E6A3A1-F863-417E-9619-DC9B6A710512}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -30,6 +36,7 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{4C12B988-FEB8-4141-8CD2-1EA4AC3E9270} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
|
||||
{D499FEC3-FDDD-45F0-BEA2-025B533BCD21} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
|
||||
{67E6A3A1-F863-417E-9619-DC9B6A710512} = {7BFFBEF2-6639-41F6-B6C2-D231FF719F57}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C2C9327F-0E3C-40B5-B878-DA59F03CF150}
|
||||
|
||||
23
src/WindreamHub.Legacy.Client/DIExtensions.cs
Normal file
23
src/WindreamHub.Legacy.Client/DIExtensions.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using DigitalData.Core.Legacy.Client;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using WindreamHub.Legacy.Client.Route;
|
||||
|
||||
namespace WindreamHub.Legacy.Client
|
||||
{
|
||||
public static class DIExtensions
|
||||
{
|
||||
public static IServiceCollection AddWindreamClientService(this IServiceCollection services, string uri)
|
||||
{
|
||||
services
|
||||
.AddHttpClientService<WindreamClientOptions>(opt =>
|
||||
{
|
||||
opt.Uri = uri;
|
||||
})
|
||||
.AddSingleton<WindreamClientService>()
|
||||
.AddSingleton<SubscriptionsRouteService>()
|
||||
.AddSingleton<SystemDetailsRouteService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
src/WindreamHub.Legacy.Client/Properties/AssemblyInfo.cs
Normal file
36
src/WindreamHub.Legacy.Client/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WindreamHub.Legacy.Client")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Digital Data GmbH")]
|
||||
[assembly: AssemblyProduct("WindreamHub.Legacy.Client")]
|
||||
[assembly: AssemblyCopyright("Copyright © Digital Data GmbH 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("67e6a3a1-f863-417e-9619-dc9b6a710512")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
24
src/WindreamHub.Legacy.Client/Routes/BaseRouteService.cs
Normal file
24
src/WindreamHub.Legacy.Client/Routes/BaseRouteService.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using DigitalData.Core.Legacy.Client;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace WindreamHub.Legacy.Client.Routes
|
||||
{
|
||||
public class BaseRouteService : HttpClientService<WindreamClientOptions>
|
||||
{
|
||||
public BaseRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
|
||||
base(client, cookieContainer, clientOptions)
|
||||
{
|
||||
var route_name = this.GetRouteName();
|
||||
|
||||
clientOptions.Value.Routes.TryGetValue(route_name, out string route);
|
||||
|
||||
if(route is null)
|
||||
throw new InvalidOperationException($"Route not found for the route name: {route_name}.");
|
||||
|
||||
Uri = route;
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/WindreamHub.Legacy.Client/Routes/RouteExtensions.cs
Normal file
38
src/WindreamHub.Legacy.Client/Routes/RouteExtensions.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WindreamHub.Legacy.Client.Routes
|
||||
{
|
||||
public static class RouteExtensions
|
||||
{
|
||||
public static string GetRouteName(this object service)
|
||||
{
|
||||
// Get the full class name including namespace
|
||||
string fullClassName = service.GetType().FullName;
|
||||
|
||||
// Extract the class name part by getting the substring after the last dot (.)
|
||||
string className = fullClassName.Substring(fullClassName.LastIndexOf('.') + 1);
|
||||
|
||||
// Remove the "RouteService" part and return the remainder
|
||||
string suffix = "RouteService";
|
||||
if (className.EndsWith(suffix))
|
||||
{
|
||||
// Remove the "RouteService" part
|
||||
string prefix = className.Substring(0, className.Length - suffix.Length);
|
||||
// Convert the first letter to lowercase
|
||||
if (prefix.Length > 0)
|
||||
{
|
||||
prefix = char.ToLower(prefix[0]) + prefix.Substring(1);
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Class name does not follow the expected format.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
using DigitalData.Core.Legacy.Client;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using WindreamHub.Legacy.Client.Routes;
|
||||
|
||||
namespace WindreamHub.Legacy.Client.Route
|
||||
{
|
||||
public class SubscriptionsRouteService : BaseRouteService
|
||||
{
|
||||
public SubscriptionsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
|
||||
base(client, cookieContainer, clientOptions)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using WindreamHub.Legacy.Client.Routes;
|
||||
|
||||
namespace WindreamHub.Legacy.Client.Route
|
||||
{
|
||||
public class SystemDetailsRouteService : BaseRouteService
|
||||
{
|
||||
public SystemDetailsRouteService(HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
|
||||
base(client, cookieContainer, clientOptions)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/WindreamHub.Legacy.Client/WindreamClientOptions.cs
Normal file
14
src/WindreamHub.Legacy.Client/WindreamClientOptions.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using DigitalData.Core.Legacy.Client;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WindreamHub.Legacy.Client
|
||||
{
|
||||
public class WindreamClientOptions : HttpClientOptions
|
||||
{
|
||||
public Dictionary<string, string> Routes = new Dictionary<string, string>()
|
||||
{
|
||||
{ "subscriptions", "/subscriptions" },
|
||||
{ "systemDetails", "/systemDetails" }
|
||||
};
|
||||
}
|
||||
}
|
||||
23
src/WindreamHub.Legacy.Client/WindreamClientService.cs
Normal file
23
src/WindreamHub.Legacy.Client/WindreamClientService.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using DigitalData.Core.Legacy.Client;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using WindreamHub.Legacy.Client.Route;
|
||||
|
||||
namespace WindreamHub.Legacy.Client
|
||||
{
|
||||
public class WindreamClientService : HttpClientService<WindreamClientOptions>
|
||||
{
|
||||
public WindreamClientService(SubscriptionsRouteService subscriptions, SystemDetailsRouteService systemDetails,
|
||||
HttpClient client, CookieContainer cookieContainer, IOptions<WindreamClientOptions> clientOptions) :
|
||||
base(client, cookieContainer, clientOptions)
|
||||
{
|
||||
Subscriptions = subscriptions;
|
||||
SystemDetails = systemDetails;
|
||||
}
|
||||
|
||||
public SubscriptionsRouteService Subscriptions { get; }
|
||||
|
||||
public SystemDetailsRouteService SystemDetails { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{67E6A3A1-F863-417E-9619-DC9B6A710512}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WindreamHub.Legacy.Client</RootNamespace>
|
||||
<AssemblyName>WindreamHub.Legacy.Client</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Core.Client.Legacy">
|
||||
<HintPath>..\..\..\WebCoreModules\DigitalData.Core.Legacy.Client\bin\Debug\DigitalData.Core.Client.Legacy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Options, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Extensions.Options.8.0.2\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DIExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Routes\BaseRouteService.cs" />
|
||||
<Compile Include="Routes\RouteExtensions.cs" />
|
||||
<Compile Include="Routes\SystemDetailsRouteService.cs" />
|
||||
<Compile Include="Routes\SubscriptionsRouteService.cs" />
|
||||
<Compile Include="WindreamClientOptions.cs" />
|
||||
<Compile Include="WindreamClientService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
15
src/WindreamHub.Legacy.Client/app.config
Normal file
15
src/WindreamHub.Legacy.Client/app.config
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
13
src/WindreamHub.Legacy.Client/packages.config
Normal file
13
src/WindreamHub.Legacy.Client/packages.config
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.1" targetFramework="net462" />
|
||||
<package id="Microsoft.Extensions.Options" version="8.0.2" targetFramework="net462" />
|
||||
<package id="Microsoft.Extensions.Primitives" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user