예제 #1
0
        public static ServiceConfig GetInstance()
        {
            if (_instance == null)
            {
                lock (_synRoot)
                {
                    if (_instance == null)
                    {
                        ConfigureHandler handler = new ConfigureHandler(ServiceConfig.Reset);
                        DomDaoManagerBuilder builder = new DomDaoManagerBuilder();

                        builder.ConfigureAndWatch("Dao.config", handler);
                        builder.Configure();

                        _instance = new ServiceConfig();
                        // TODO:默认为sqlMapDao指定的Context, 要提供对多个Context的支持.
                        _instance._daoManager = IBatisNet.DataAccess.DaoManager.GetInstance("SqlMapDao");

                    }
                }
            }
            return _instance;
        }
예제 #2
0
        public static ServiceConfig GetInstanceByFile()
        {
            if (_instance == null)
            {
                lock (_synRoot)
                {
                    if (_instance == null)
                    {
                        //Define the Absoluate File path to Found the Dao File [f**k this shit]
                        string filepath = @"E:\ADO.NEt Entity FrameWork Program\MyBatis_Demo\BatisDemonstarate_DUI\CustomerWeb_UI\Dao.Config";
                        if (File.Exists(filepath))
                        {
                            DomDaoManagerBuilder getbuilder = new DomDaoManagerBuilder();
                            getbuilder.Configure(filepath);

                            _instance = new ServiceConfig();
                            _instance._daoManager = IBatisNet.DataAccess.DaoManager.GetInstance("SqlMapDao");
                        }
                    }
                }
            }
            return _instance;
        }