I've a databaseconnectionString
variable in file databasetablename.cs and I want to use this databaseconnectionString
in my other files without creating the connection string details for each api,following is how my project structure looks like and how I tried to use the variable databaseconnectionString
which throws an error doesnot exist in current context
,what am I missing?how to use the databaseconnectionString
in product.cs file?
Repository
--->BuildRepositoryfolder
Product.cs
--->DatabaseConnections
databasetablename.cs
databasetablename.cs
public class databasetablename
{
public string databaseconnectionString = "server=xx.xx.xxx.xxx;database=aci_dev;uid=wciadmin;pwd=adSHEEP91min;";
}
Product.cs
public IEnumerable<Info> InfoSearch(LookaheadRunsFilterCriteria filterCriteria)
{
var conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = databaseconnectionString; --> throws an error
}