SQL Server 2008: Verify that IncludeMetadataConvention is Added to the DbModelBuilder Conventions

The full error I get is this:

Model compatibility cannot be verified because the database does not contain model metadata. Make sure IncludeMetadataConvention is added to the DbModelBuilder conventions.

I used this using SQL Server Compact and it works great, but the hosting provider only supports CE for dedicated servers. I am using a generic plan, so I am using SQL Server 2008. My db connection string is in the following format:

  <connectionStrings>
    <add name="DBContext"
         connectionString="Data Source=1.1.1.1;Initial Catalog=dbname;User Id=user;Password=pass;"
         providerName="System.Data.SqlClient"/>
  </connectionStrings>

I also have a DatabaseInitializer that runs in Application_Startup. If any additional code is needed, just let me know? I also don't have edmx data model, I use EF code first.

I changed the initializer code. Drop the database always, but now I get an error that resolved the CREATE DATABASE permission on the "master" database. I don’t know why I get this when I say this in the Start Directory.

I pass the null value to SetInitializer, but now I get the following error:

Unable to open database "dbname" requested by login. Login failed. Login failed for user user.

I still use the connection string at the top.

+5
source share
1 answer

I changed the initializer code. Always delete the database, but now I get the error, allow CREATE DATABASE in the database "master". I don’t know why I get this when I say this in the Start directory to use.

, . -. SQL- , , , , ( ).

null SetInitializer, :

. . - -, .

DatabaseInitializer, Application_Startup.

, , . .

+4

All Articles