ISEbd_21_Kuklew_M.I._Softwa.../SoftwareInstallationDatabaseImplement/Implements/BackUpInfo.cs
Максим Куклев ed3e400b30 загрузил
2024-06-17 19:27:42 +04:00

29 lines
636 B
C#

using SoftwareInstallationContracts.StoragesContracts;
namespace SoftwareInstallationDatabaseImplement.Implements
{
public class BackUpInfo : IBackUpInfo
{
public List<T>? GetList<T>() where T : class, new()
{
using var context = new RepairsShopDatabase();
return context.Set<T>().ToList();
}
public Type? GetTypeByModelInterface(string modelInterfaceName)
{
var assembly = typeof(BackUpInfo).Assembly;
var types = assembly.GetTypes();
foreach (var type in types)
{
if (type.IsClass &&
type.GetInterface(modelInterfaceName) != null)
{
return type;
}
}
return null;
}
}
}