i have changed the connection string to point to a database in the remote server. But when I execute the project the program still points to the local db.
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="TEDALS_Ver01.DAL.TedalsContext"
connectionString="Data Source=FE0VMC0643\SQLEXPRESS;
AttachDbFilename=|DataDirectory|\TeDaLSdev.mdf;
Integrated Security=False"
providerName="System.Data.SqlClient"
/>
<!--<add
name="TEDALS_Ver01.DAL.TedalsContext"
connectionString="Server=FE0VMC0643; Database=TeDaLSdev; "
providerName="System.Data.SqlClient" />-->
<!--<add name="TEDALS_Ver01.DAL.TedalsContext"
providerName="System.Data.SqlClient"
connectionString="Server=FE0VMC0643;Data Source=FE0VMC0643;
Initial Catalog=TeDaLSdev;
Integrated Security=True;
Connect Timeout=15;
Encrypt=False;
TrustServerCertificate=False;" />-->
</connectionStrings>
Comments are the different connection strings i have treid so far. i never had a connections string when I was using the LocalDB.
Constructor for Connection
public class TedalsContext : DbContext
{
public TedalsContext()
: base("TedalsContext")
{
//Database.SetInitializer<TedalsContext>(null);
}
}
i am using SQL Server Express as my database. I have also tried changing the name of the parameter for base
in constructor as the name of the Database. But it did not change anything.
I have already tried if I have access to the database through SSMS. I am able to create tables but I am unable to rename the database as such(I do not have access rights to rename the database TeDalSdev).
Are there any other work around i could try? Should the name of the remote database and the local database should be the same to avoid changing a lot of code?
UPDATE
Controller
public class LsystemFamiliesController : Controller
{
private TedalsContext db = new TedalsContext();
//Code goes here
}