Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

entity framework 4.1 code first CREATE DATABASE permission denied in database 'master'

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>
like image 680
bobby Avatar asked Sep 06 '11 10:09

bobby


1 Answers

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).

like image 56
jlew Avatar answered Nov 15 '22 08:11

jlew