I have a API setup doing all of calls to the database, but there is one occasion in a website that cannot make a call api call for some reason. And only thing I can think of is just doing a quick call to the database in the website itself. I just want to run a quick linq query against my database. What is the proper hard coded connectionstring settings, and how can I plug in my GlobalDAtacontext as well. Thanks for any help.
//Example of what I would like to do
using (var conn = new SqlConnection("WHAT IS THE PROPER CONNECTIONSTRING FORMAT")
{
conn.open();
using (var context = new dbcontext())
{
var user = (from x in context.users where x.ID == userid).FirstOrDefault();
}
}