public DbEntity GetDbEntity(string key = "") { if (string.IsNullOrEmpty(key)) { key = db_key; } ICache cache = CacheFactory.Cache(); DbEntity db = cache.GetCache <DbEntity>(key); if (db == null) { var manager = ConfigurationManager.ConnectionStrings[key]; db = new DbEntity() { Name = key, ConnectionString = manager.ConnectionString, ProviderName = manager.ProviderName }; cache.WriteCache <DbEntity>(db, key); } return(db); }
public string GetConnectionString(string key) { DbEntity db = GetDbEntity(key); return(db.ConnectionString); }