I Build an ASP.NET project with PL,BL,DAl, BE of Entity Data Model(=.edmx) which I generated from a service Based DB (= .mdf) which is located in my DAL project.
I did copied the connectionString from the BE app.config to the PL web.config
what's wrong? why I get this error:
System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Documents and Settings\user\שולחן העבודה\למידה אישית\Lev\Lev\App_Data\Midrasha.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
my code logic is PL->BL->DAL- > try to save the new object to the DB. the code line which generate the problem is :
public void AddFeedback(Feedback feed)
{
MidrashaEntities _context = new MidrashaEntities();
_context.Feedback.AddObject(feed);
_context.SaveChanges(); <-------throw the exception
}
Feedback is a table in my DAL's SQL which I generate as Object entity.