1.To setup dynamic connection string for Entity Framework (shortly EF), supposing that your
ObjectContext
class is named MyDataContext, you have to use its constructor that accept a connection string as parameter like in the example below;
2.To query EF by using this dynamic connection string you have to use the code like in the next example:
Student student = null;
using (MyDataContext dataContext = new MyDataContext(yourConnectionString))
{
var query = from st in dataContext .Students
where st.StudentName == "Bill"
select st;
student = query.FirstOrDefault();
}
3.For more details about EF including the using of string procedure in EF see details in the next site:
http://www.entityframeworktutorial.net/stored-procedure-in-entity-framework.aspx[
^]