code first entity framework 4.1 The permission to CREATE DATABASE was refused in the database'master.'

entity-framework

Question

I have created a generic repository project using Entity Framework 4.1 and it works great with my projects when added as an existing project to them but it doesn't work on them when just referenced as dll.

I get this error

CREATE DATABASE permission denied in database 'master'.

but I have added app.config file and set relevant connection string to my SQL Server 2005 database (I have used DbContext as type my context)

Please help me.

Here is my connection string :

<configuration>
   <connectionStrings>
      <add name="TasksEntities" 
           connectionString="server=(local); database=Tasks; trusted_connection=false; User=sa; Password=****; Persist Security Info=True" 
           providerName="System.Data.SqlClient"/>
  </connectionStrings>
</configuration>
1
5
11/18/2012 10:02:33 AM

Popular Answer

I just ran into this myself. The connection string name must match the class name of your DbContext subclass exactly. If it doesn't EF will not find the connection string and will try and fall back to doing something else (SQL embedded?) which doesn't work on my machine (I have full SQL Server installed).

7
3/22/2012 2:32:45 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow