Use file-scoped namespaces

This commit is contained in:
Andriy
2023-07-29 15:14:52 +03:00
parent a24332370d
commit 8ab067a027
58 changed files with 2222 additions and 2280 deletions
+27 -28
View File
@@ -3,34 +3,33 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Kruzya.TelegramBot.Core
namespace Kruzya.TelegramBot.Core;
public abstract class Module
{
public abstract class Module
protected readonly Core Core;
protected IConfiguration Configuration => Core.Configuration;
public Module(Core core)
{
protected readonly Core Core;
protected IConfiguration Configuration => Core.Configuration;
public Module(Core core)
{
Core = core;
}
public virtual void ConfigureServices(IServiceCollection services)
{
}
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
/// <summary>
/// Ensures if module is loaded and started. Note that call can change module event chain.
/// </summary>
/// <typeparam name="T">The Module type.</typeparam>
/// <returns>Module instance.</returns>
protected T EnsureLoaded<T>() where T : Module
{
return (T) Core.EnsureLoaded(typeof(T));
}
Core = core;
}
}
public virtual void ConfigureServices(IServiceCollection services)
{
}
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
/// <summary>
/// Ensures if module is loaded and started. Note that call can change module event chain.
/// </summary>
/// <typeparam name="T">The Module type.</typeparam>
/// <returns>Module instance.</returns>
protected T EnsureLoaded<T>() where T : Module
{
return (T) Core.EnsureLoaded(typeof(T));
}
}