Use file scoped namepace

This commit is contained in:
2022-12-22 15:29:53 +01:00
parent 27bf5f0b24
commit 6d7e447ccc
51 changed files with 886 additions and 937 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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