Keyword not supported: “data source” (Passing Connection String Of Type EF to EF constructor)
Assuming you have a connection string that points to an Entity Framework object.
And in your connection class, you pass the connection string to the Entity Framework constructor below:
You encountered an error Keyword not supported: "data source".
The solution is presented here: Keyword not supported data source initializing entity framework context
It suggests to replace the " word with single quote (') character.
So, in this case, I used Regex to perform replace operation.
customerEntity = new Database1Entities(_connectionString);
The solution is presented here: Keyword not supported data source initializing entity framework context
It suggests to replace the " word with single quote (') character.
So, in this case, I used Regex to perform replace operation.
return Regex.Replace(ConfigurationManager.ConnectionStrings[key].ToString(), @""", "'", RegexOptions.IgnoreCase);
Comments
Post a Comment