29 lines
1.5 KiB
C#
29 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace BeWo.Data.Access
|
|
{
|
|
public static class DAOFactory
|
|
{
|
|
/// 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());
|
|
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;
|
|
public static ScriptDAO ScriptDAO => _ScriptDAO.Value;
|
|
public static SearchDAO SearchDAO => _SearchDAO.Value;
|
|
public static UserDAO UserDAO => _UserDAO.Value;
|
|
}
|
|
} |