Donate

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:
customerEntity = new Database1Entities(_connectionString);
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.
return Regex.Replace(ConfigurationManager.ConnectionStrings[key].ToString(),  
           @"&quot", "'", RegexOptions.IgnoreCase);

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.