public class Context : DbContext
{
public Context(string connString) : base(connString)
{
Database.SetInitializer(new MyContextInitializer());
}
//...
Need to pass a connection string to the context constructor. How should the string look like, for example, for SQL Compact? Tried this, but no success:
Context db = new Context("Provider=System.Data.SqlServerCe.4.0;Data Source=D:\\Context.sdf");
Edit:
If I try this string: "Data Source=D:\\Context.sdf"
System.Data.ProviderIncompatibleException was unhandled
Message=An error occurred while getting provider information from the database.
This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.Source=EntityFramework
And if I try to mention the provider like this: "Data Source=D:\\Context.sdf;provider=System.Data.SqlServerCe.4.0"
System.ArgumentException was unhandled
Message=Keyword not supported: 'provider'.
Source=System.Data