feat: IConfiguration for system and other configurations
This commit is contained in:
8
Engine.Core/Config/ConfigurationExtensions.cs
Normal file
8
Engine.Core/Config/ConfigurationExtensions.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Engine.Core.Exceptions;
|
||||
|
||||
namespace Engine.Core.Config;
|
||||
|
||||
public static class ConfigurationExtensions
|
||||
{
|
||||
public static T GetRequired<T>(this IConfiguration configuration, string key) => configuration.Get<T>(key) ?? throw new NotFoundException($"Type of {typeof(T).FullName} with the key {key} was not present in the {configuration.GetType().FullName}");
|
||||
}
|
||||
Reference in New Issue
Block a user