Split VAR.WebForms.Common to a class library.

This commit is contained in:
2020-03-01 11:54:12 +01:00
parent df927722ba
commit e414663d12
37 changed files with 333 additions and 116 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Linq;
namespace VAR.WebForms.Common.Code
{
public static class GlobalConfig
{
private static IGlobalConfig _globalConfig = null;
public static IGlobalConfig Get()
{
if (_globalConfig == null)
{
Type iGlobalConfig = typeof(IGlobalConfig);
Type foundGlobalConfig = AppDomain.CurrentDomain
.GetAssemblies()
.SelectMany(x => x.GetTypes())
.Where(x =>
x.IsAbstract == false &&
x.IsInterface == false &&
iGlobalConfig.IsAssignableFrom(x) &&
true)
.FirstOrDefault();
_globalConfig = ObjectActivator.CreateInstance(foundGlobalConfig) as IGlobalConfig;
}
return _globalConfig;
}
}
}