Files
BeWoPlaner/Data/Access/DAOFactory.cs

40 lines
1.8 KiB
C#
Raw Normal View History

2025-06-02 11:16:35 +02:00
using BS.Shared.Interface;
using System;
2025-02-27 10:03:28 +01:00
namespace BeWo.Data.Access
2016-06-27 01:45:38 +02:00
{
public static class DAOFactory
{
2025-02-27 10:03:28 +01:00
/// https://csharpindepth.com/articles/singleton
/// -> Sixth version - using .NET 4's Lazy<T> type
///
/// Kleiner Fix bzgl Threadsafe
private static readonly Lazy<AdoDAO> _AdoDAO = new Lazy<AdoDAO>(() => new AdoDAO());
private static readonly Lazy<GenericDAO> _GenericDAO = new Lazy<GenericDAO>(() => new GenericDAO());
private static readonly Lazy<GenericSearchDAO> _GenericSearchDAO = new Lazy<GenericSearchDAO>(() => new GenericSearchDAO());
private static readonly Lazy<FinanceDAO> _FinanceDAO = new Lazy<FinanceDAO>(() => new FinanceDAO());
private static readonly Lazy<OrganisationDAO> _OrganisationDAO = new Lazy<OrganisationDAO>(() => new OrganisationDAO());
2025-02-27 10:03:28 +01:00
private static readonly Lazy<ScriptDAO> _ScriptDAO = new Lazy<ScriptDAO>(() => new ScriptDAO());
private static readonly Lazy<SearchDAO> _SearchDAO = new Lazy<SearchDAO>(() => new SearchDAO());
private static readonly Lazy<UserDAO> _UserDAO = new Lazy<UserDAO>(() => new UserDAO());
public static AdoDAO AdoDAO => _AdoDAO.Value;
public static GenericDAO GenericDAO => _GenericDAO.Value;
public static GenericSearchDAO GenericSearchDAO => _GenericSearchDAO.Value;
public static FinanceDAO FinanceDAO => _FinanceDAO.Value;
public static OrganisationDAO OrganisationDAO => _OrganisationDAO.Value;
2025-02-27 10:03:28 +01:00
public static ScriptDAO ScriptDAO => _ScriptDAO.Value;
public static SearchDAO SearchDAO => _SearchDAO.Value;
public static UserDAO UserDAO => _UserDAO.Value;
2025-06-02 11:16:35 +02:00
2025-06-03 12:24:30 +02:00
public static LocalFileStorageDAO GetLocalFileStorage(string rootpath)
2025-06-02 11:16:35 +02:00
{
return new LocalFileStorageDAO(rootpath);
}
2025-06-05 14:03:55 +02:00
public static LocalTenantFileStorageDAO GetLocalTenantFileStorage(string rootpath)
{
return new LocalTenantFileStorageDAO(rootpath);
}
}
2016-06-27 01:45:38 +02:00
}