示例#1
0
        public static DbProviderInfo GetProviderInfo(string DbContextName)
        {
            if (LocalConfig.providerInfoList == null || LocalConfig.providerInfoList.Count < 1)
            {
                LocalConfig.GetProviderFromFile();
            }
            DbProviderInfo dbProviderInfo = (
                from ww in LocalConfig.providerInfoList
                where ww.DbContextName == DbContextName
                select ww).FirstOrDefault <DbProviderInfo>();

            if (dbProviderInfo == null)
            {
                IConfiger service = ServiceTaker.GetService <IConfiger>(new object[0]);
                dbProviderInfo = service.GetFirst <DbProviderInfo>(DbContextName);
                LocalConfig.providerInfoList.Remove(dbProviderInfo);
                LocalConfig.providerInfoList.Add(dbProviderInfo);
            }
            return(dbProviderInfo);
        }