I am using an SqlCe 4 database with an Entity Framework 6 code first data model.
I set the connection string in the DbContext constructor like so:
private static readonly string DATABASE_PASSWORD = "...";
private static readonly string CONNECTION_STRING = string.Format(@"Data Source={0};Password={1}", MyProject.Properties.Settings.Default.DatabaseLocation, DATABASE_PASSWORD);
public DataModel()
: base(CONNECTION_STRING)
{
}
And when I run my application which uses this model it works.
In the designer in Visual Studio however it keeps freezing for about 30 seconds at a time when I try to view a WPF control that load a set of records in the View model constructor and I get an error message as follows:
Error 2 Unable to complete operation. The supplied SqlConnection does not specify an initial catalog or AttachDBFileName.
I am not using SqlServer I am using Sql Server Compact so there should be no need to even think about using Sql Server.
Can anyone see anything wrong with my connection string?