Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyword Not Supported: Metadata

This line:

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

Is throwing:

'System.ArgumentException' occurred in System.Data.dll but was not handled in user code

Additional information: Keyword not supported: 'metadata'.

My connection string is:

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>

Not sure where it is im going wrong.

like image 923
ASPCoder1450 Avatar asked Nov 25 '13 02:11

ASPCoder1450


2 Answers

The string you passed is not a valid database connection string, it's an EF connection string that contains a SQL Server connection string in its provider connection string parameter. WebSecurity.InitializeDatabaseConnection expects a valid database connection string

To avoid parsing the connection string yourself, you can use the EntityConnectionStringBuilder class to parse the string and retrieve the database connection string from its ProviderConnectionString property

like image 50
Panagiotis Kanavos Avatar answered Oct 14 '22 02:10

Panagiotis Kanavos


When this happened to me it was because the connection string had:

providerName="System.Data.SqlClient"

but it should be:

providerName="System.Data.EntityClient"

because as was said by the other answer, it is an EF connection string.

like image 60
Will Newton Avatar answered Oct 14 '22 02:10

Will Newton