public class Connection
{
public static string GetConecction()
{
return ConfigurationManager.ConnectionStrings[\"DCAssetEntities\"].ConnectionString;
Make the constructor yourself in a partial class:
public partial class DCAssetEntities: DbContext
{
public DCAssetEntities(string connectionstring)
: base(connectionstring)
{
}
}
Related question: Entity Connection String Constructor not found in EF 5 and WCF 4.5 at runtime
Your class DCAssetEntities
needs to have a constructor with the following definition.
public DCAssetEntities(string connectionString){}
You need to mark the constructor as public
(or internal
).