entity framework 6 - DbContext constructor connection string error keyword name not supported -
the entity framework documentation states can use named parameter when supplying connection string:
public class bloggingcontext : dbcontext { public bloggingcontext() : base("name=bloggingcompactdatabase") { } }
i don't bother named parameter:
public tspdbcontext() : base("viktorvooey") { }
but thought i'd give go confirmation:
public tspdbcontext() : base("name=viktorvooey") { }
and fails saying
keyword not supported : name
this on ef6. i'm sort of stuck between not caring still wanting know "what's that" same.
i came across post because had same error. msdn documentation ef 6 dbcontext explcitly states 'name=' part of constructor string parameter supported , means:
the name can passed in form 'name=myname', in case name must found in config file or exception thrown.
in other words "name=" prefix forces ef config file entry connection string.
so should check value pass "name=" name key value in config file.
for example, in config file:
<add name="mycontextname" connectionstring="blah blah"/>
in constructor:
public mycontext() : base("name=mycontextname")
Comments
Post a Comment