I am attempting to create a WPF application, using MSCE and Entity Framwork. (I am new to wpf)
In asp.net mvc 3 I have done similar things simply by giving the data context, the database, and the connection string the same name. I try that in wpf and it does not work (instead it creates a SqlExpress database.
How does one use a MSCE 4.0 database with WPF and codefirst? Is there some sort of secret add-in?
Here is some sample code
in the app.config
<connectionStrings>
<add name="ReportingContext" connectionString="provider=System.Data.SqlServerCe.4.0;provider connection string=Data Source=|DataDirectory|\ReportingContext.sdf" providerName="System.Data.EntityClient" />
</connectionStrings>
from the models folder
public class ReportingContext : DbContext
{
...
}
It was a problem with the nuget packages somehow. I deleted all of them, reinstalled and the problem vanished.