Keyword Not Supported: Metadata c# entity-framework sql-server


This phrase:

WebSecurity.InitializeDatabaseConnection(connectionStringName: "DefaultConnection", userTableName: "UserProfile", userIdColumn: "UserID", userNameColumn: "UserName", autoCreateTables: true);

Throwing is:

System.Data.dll experienced a "System.ArgumentException," but user code did not respond to it.

Additional details: 'Metadata' is an unsupported keyword.

What is my connection string?

add name="DefaultConnection" connectionString="metadata=res://*/TalyllynModel.csdl|res://*/TalyllynModel.ssdl|res://*/TalyllynModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=***********;initial catalog=********;persist security info=True;user id=*********;password=********;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.SqlClient" /></connectionStrings>

I'm unsure of where I'm going wrong.

6/11/2015 2:28:54 AM

Accepted Answer

The string you provided is a Connection string for EF that has a SQL Server connection string in it, not a genuine database connection string.provider connection string argument; a legitimate database connection string is required by WebSecurity.InitializeDatabaseConnection.

You can use the EntityConnectionStringBuilder class to parse the string and extract the database connection string from its ProviderConnectionString property instead of manually parsing the connection string.

11/25/2013 12:11:03 PM

Popular Answer

This occurred to me since the connection string contained the following:


but it ought to be:


because it is an EF connection string, as was stated in the other answer.

Related Questions


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