using System; using IBatisNet.Common.Utilities; using IBatisNet.DataAccess; namespace NPetshop.Service { /// /// Summary description for ServiceConfig. /// public class ServiceConfig { static private object _synRoot = new Object(); static private ServiceConfig _instance; private DaoManager _daoManager = null; /// /// Remove public constructor. prevent instantiation. /// private ServiceConfig(){} static public ServiceConfig GetInstance() { if (_instance==null) { lock(_synRoot) { if (_instance==null) { ConfigureHandler handler = new ConfigureHandler( ServiceConfig.Reset ); DaoManager.ConfigureAndWatch( handler ); _instance = new ServiceConfig(); _instance._daoManager = DaoManager.GetInstance("SqlMapDao"); } } } return _instance; } /// /// Reset the singleton /// /// /// Must verify ConfigureHandler signature. /// /// /// static public void Reset(object obj) { _instance =null; } public DaoManager DaoManager { get { return _daoManager; } } } }