Files
BeWoPlaner/Data/Access/DAOFactory.cs

23 lines
1015 B
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<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 ScriptDAO ScriptDAO => _ScriptDAO.Value;
public static SearchDAO SearchDAO => _SearchDAO.Value;
public static UserDAO UserDAO => _UserDAO.Value;
}
}