c# - No connection string named 'MyAppDbContext' could be found in the application config file -


inside dal project have repositories consume ui. i've refactor project bit , on gather data repository i'm getting error

"no connection string named 'myappdbcontext' found in application config file."

my app.config on same project (dal) repository lives have following context

<?xml version="1.0" encoding="utf-8"?> <configuration>   <configsections>     <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 -->     <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" />       </configsections>   <connectionstrings>     <add name="myappdbcontext" connectionstring="data source=.\sqlexpress;initial catalog=myapp.dal.myappdbcontext;integrated security=true;attachdbfilename=myapp.dal.myappdbcontext.mdf" providername="system.data.sqlclient" />                  </connectionstrings>   <entityframework>     <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" />     <providers>       <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" />     </providers>   </entityframework> </configuration> 

i have 2 questions:

  • why i'm getting error message: "no connection string named 'myappdbcontext' found in application config file."
  • how can set path in conn. string use db app_data directory (after move there ofcourse)

try adding connection string configuration file of consuming project, not dal project.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -