I need to consume some .net code from classic ASP, hence I am using com interop.
This works well apart from EF6 and its connection strings. When I try and call the method that uses EF from classic ASP I get
No connection string named 'Entities' could be found in the application config file.
So I thought I would code the connection string into the context with the following:
using (Entities context = new Entities())
{
context.Database.Connection.ConnectionString = @"metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string='data source=server;initial catalog=database;persist security info=True;user id=sa;password=PasswordRemoved;MultipleActiveResultSets=True;App=EntityFramework'";
However, at runtime from my .net test harness, when that method is called, we once again get:
No connection string named 'Entities' could be found in the application config file.
I made sure I specified that I would set the connection string in my code in the entity creation wizard, and subsequently the connection string isn't in my app.config file.
What is stopping EF6.1 from accepting my connection string in code rather than from the config file? Important to note I have scoured SO for solutions and none of them have stuck.