예제 #1
0
 public static void ReloadProvider()
 {
     lock (o)
     {
         provider = null;
     }
 }
예제 #2
0
        public static AbstractProvider GetProvider()
        {
            if (provider == null)
            {
                lock (o)
                {
                    if (provider == null)
                    {
                        switch (DbHelper.GetProviderType(CGConfig.Instance.ConnectString))
                        {
                            case EnumProviderType.MySql:
                                provider = new MySqlProvider();
                                break;

                            case EnumProviderType.MsSql:
                                provider = new MsSqlProvider();
                                break;

                            case EnumProviderType.Access:
                                throw new NotImplementedException("没有实现Access");
                            case EnumProviderType.Oracle:
                                throw new NotImplementedException("没有实现Oracle");
                            default:
                                throw new NotImplementedException("没有实现");
                        }
                    }
                }
            }

            return provider;
        }