public string GetConnectionString(PlayerDBTypes connectionType) { string retVal = String.Empty; switch (connectionType) { case PlayerDBTypes.SQL: retVal = Properties.Settings.Default.SqlConnectionString; break; case PlayerDBTypes.XML: retVal = Properties.Settings.Default.StorageDir + Properties.Settings.Default.XmlConnectionString; break; case PlayerDBTypes.DAT: default: retVal = Properties.Settings.Default.StorageDir + Properties.Settings.Default.BinConnectionString; break; } return retVal; }
public IPlayerDB GetDBObj(PlayerDBTypes type, string connectionStr) { IPlayerDB returnVal; switch (type) { case PlayerDBTypes.SQL: returnVal = new PlayerSQL(connectionStr); break; case PlayerDBTypes.DAT: returnVal = new PlayerDAT(connectionStr); break; case PlayerDBTypes.XML: returnVal = new PlayerXML(connectionStr); break; default: throw new NotSupportedException(); } return returnVal; }
public IPlayerDB GetDBObj(PlayerDBTypes type) { return GetDBObj(type, GetConnectionString(type)); }