I'm starting a new ASP.NET project, and I'm trying to follow the multi-project approach I've seen mentioned in multiple questions around Stackoverflow.
I managed to set up the connection string (I think) successfully, by placing it in my presentation layer's Web.config file.
<add name="MyDbContext" connectionString="Data Source=|DataDirectory|MyDb.sdf" providerName="System.Data.SqlServerCe.4.0"/>
However, when I run the following code from my BLL, no DB is created.
using (var db = new MyDbContext())
{
db.MyEntities.Add(new MyEntity()
{
EntityName = "Entity 1"
});
db.SaveChanges();
}
So first of all, where will the actual sdf file be created? I'm assuming in my DAL project. And secondly, is there any further configuration I need to perform to get this to work properly? A link to a tutorial would be splendid.
I've tried following this tutorial, but my DAL project doesn't have a Global.asax file I can play around with.