using BS.Shared.Interface; using System; namespace BeWo.Data.Access { public static class DAOFactory { /// https://csharpindepth.com/articles/singleton /// -> Sixth version - using .NET 4's Lazy type /// /// Kleiner Fix bzgl Threadsafe private static readonly Lazy _AdoDAO = new Lazy(() => new AdoDAO()); private static readonly Lazy _GenericDAO = new Lazy(() => new GenericDAO()); private static readonly Lazy _GenericSearchDAO = new Lazy(() => new GenericSearchDAO()); private static readonly Lazy _FinanceDAO = new Lazy(() => new FinanceDAO()); private static readonly Lazy _OrganisationDAO = new Lazy(() => new OrganisationDAO()); private static readonly Lazy _ScriptDAO = new Lazy(() => new ScriptDAO()); private static readonly Lazy _SearchDAO = new Lazy(() => new SearchDAO()); private static readonly Lazy _UserDAO = new Lazy(() => 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; public static LocalFileStorageDAO GetLocalFileStorage(string rootpath) { return new LocalFileStorageDAO(rootpath); } public static LocalTenantFileStorageDAO GetLocalTenantFileStorage(string rootpath) { return new LocalTenantFileStorageDAO(rootpath); } } }