Initial commit

This commit is contained in:
2021-06-15 10:59:47 +02:00
commit 8e156ba356
65 changed files with 1786 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using GerstITS.Web.Rest.WebClients;
using Microsoft.Extensions.Configuration;
namespace GerstITS.Examples.WebClients.Examples.Api.Configurations
{
internal class ExampleApiClientConfiguration : RestWebServiceConfigurationBase
{
#region Constructors
public ExampleApiClientConfiguration(IConfiguration configuration)
: base(configuration)
{
}
#endregion
}
}

View File

@@ -0,0 +1,27 @@
using GerstITS.Web.WebClients;
namespace GerstITS.Examples.WebClients.Examples.Api
{
public interface ICountry : IWebService
{
[WebMethod(WebMethods.Get),
ResourceUrl("Country/{id}")]
Country Get(int id);
[WebMethod(WebMethods.Get),
ResourceUrl("Country/Search")]
SearchResult<Country> Search(SearchCriteria criteria);
[WebMethod(WebMethods.Post),
ResourceUrl("Country")]
Country Create(Country model);
[WebMethod(WebMethods.Put),
ResourceUrl("Country")]
void Update(Country model);
[WebMethod(WebMethods.Delete),
ResourceUrl("Country/{id}")]
void Delete(int id);
}
}

View File

@@ -0,0 +1,12 @@
namespace GerstITS.Examples.WebClients.Examples.Api
{
public class Country
{
#region Properties
public int Id { get; set; }
public string Name { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,18 @@
namespace GerstITS.Examples.WebClients.Examples.Api
{
public class SearchCriteria
{
#region Properties
internal int Id { get; set; }
public string Name { get; set; }
public int? Skip { get; set; }
public int? Take { get; set; }
public string SortBy { get; set; }
public SortingDirections SortDirection { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
namespace GerstITS.Examples.WebClients.Examples.Api
{
public class SearchResult<TItem>
{
#region Properties
public int TotalCount { get; set; }
public IEnumerable<TItem> Result { get; set; }
#endregion
#region Constructors
public SearchResult()
{
Result = Array.Empty<TItem>();
}
#endregion
}
}

View File

@@ -0,0 +1,8 @@
namespace GerstITS.Examples.WebClients.Examples.Api
{
public enum SortingDirections
{
Ascending = 0,
Descending
}
}

View File

@@ -0,0 +1,25 @@
using System;
using GerstITS.Examples.WebClients.Examples.Api.Configurations;
using GerstITS.Web.Rest.WebClients;
namespace GerstITS.Examples.WebClients.Examples.Api.CreationRules
{
internal sealed class ExampleApiClientCreatingRule : RestApiClientCreationRuleBase<ExampleApiClientConfiguration>
{
#region Properties
protected override Type[] SupportedTypes => new[] { typeof(ICountry) };
#endregion
#region Constructors
public ExampleApiClientCreatingRule(ExampleApiClientConfiguration configuration,
Func<IRestWebServiceConfiguration, IRestWebServiceClient> restWebServiceClientFactory)
: base(configuration, restWebServiceClientFactory)
{
}
#endregion
}
}

View File

@@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Company>ITSCare GbR</Company>
<Authors>ITSCare GbR</Authors>
<Copyright>Copyright © ITSCare GbR 2021</Copyright>
<Product>ITSCare GbR Example WebClient</Product>
<Version>0.0.0.0</Version>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
<FileVersion>0.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<WarningsAsErrors />
<NoWarn />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GerstITS.IoC" Version="2021.6.17" />
<PackageReference Include="GerstITS.IoC.DotNetCore" Version="2021.6.17" />
<PackageReference Include="GerstITS.System" Version="2021.6.17" />
<PackageReference Include="GerstITS.Web" Version="2021.6.17" />
<PackageReference Include="GerstITS.Web.Rest" Version="2021.6.17" />
</ItemGroup>
<ItemGroup>
<Compile Update="Module.Configurations.cs">
<DependentUpon>Module.cs</DependentUpon>
</Compile>
<Compile Update="Module.CreationRules.cs">
<DependentUpon>Module.cs</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=contracts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=contracts_005Cserialization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,17 @@
using GerstITS.Examples.WebClients.Examples.Api.Configurations;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.WebClients.Examples.Api
{
public sealed partial class Module
{
#region Methods
private static void RegisterConfigurations(IServiceCollection container)
{
container.AddSingleton<ExampleApiClientConfiguration>();
}
#endregion
}
}

View File

@@ -0,0 +1,18 @@
using GerstITS.Examples.WebClients.Examples.Api.CreationRules;
using GerstITS.Web.WebClients;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.WebClients.Examples.Api
{
public sealed partial class Module
{
#region Methods
private static void RegisterCreationRules(IServiceCollection container)
{
container.AddTransient<IWebServiceClientCreationRule, ExampleApiClientCreatingRule>();
}
#endregion
}
}

View File

@@ -0,0 +1,18 @@
using GerstITS.IoC;
using Microsoft.Extensions.DependencyInjection;
namespace GerstITS.Examples.WebClients.Examples.Api
{
public sealed partial class Module : IIoCModule<IServiceCollection>
{
#region IIoCModule
public void RegisterComponents(IServiceCollection container)
{
RegisterConfigurations(container);
RegisterCreationRules(container);
}
#endregion
}
}