ciao!
nel mio appSettings.json ho questo:
codice:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost\\SQLEXPRESS;Database=mp_test;Trusted_Connection=True;user id=root;password=9211;"
},
........
}
nella mia classe per la connessione ho fatto questo:
codice:
private string conn;
public PersonaDb()
{
try
{
conn = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
}
catch (Exception ex)
{
throw ex;
}
}
quando avvio il progettpo ottengo questo errore:
codice:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
System.Configuration.ConnectionStringSettingsCollection.this[string].get ha restituito null.
qualche idea??