I'm using VS 2015 and Entity Framework 6.0. I'm working on Windows Forms application that uses Entity Framework as a database access layer.
I have my database in .MDF file.
When I'm trying to regenerate database with Generate database from model...
after making some changes in EDMX diagram
everything works fine but at the end when trying to execute SQL DDL script I get: Database '<db_name>' does not exist. Make sure that the name is entered correctly.
Here is the connection string:
<connectionStrings>
<add name="DataInFileEntities" connectionString="metadata=res://*/MainAppModel.csdl|res://*/MainAppModel.ssdl|res://*/MainAppModel.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\WinFormsAppDb.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
Moreover I can connect to the database with built-in Server Explorer
and SQL Server Object Explorer
.
Where is the problem?