I’m building a class library for an application (exitgames photon) and it doesn’t have a web.config or an app.config.
Therefore I am setting the connection string against the context like this:
db.Database.Connection.ConnectionString = "Data Source=machinename\\SqlExpress;Initial Catalog=AwesomeDB;Integrated Security=True";
The context (db) then ignores the connection string and uses the default one as if I didn’t specify it (based on the namespace and context name etc).
Anyone know how to specify the connection string inline thus removing the requirement for an app.config?
I wouldn’t recommend hard coding the connection string. You can pass the connection string in the default constructor.