c# - EF Codefirst Winforms app - Connection string problems -


i've been trying build code first desktop app - works fine on dev machine, but, seem having many errors trying deploy it.

the main 1 @ moment can't work out when running, following error:

unhandled exception has occurred in application. if click continue, application ignore error , attempt continue. if click quit, application close immediately.  expansion of |datadirectory| failed while processing connection string. ensure |datadirectory| set valid fully-qualified path. 

i understand connection strings on asp.net/mvc/ef, but, have been having problems learning/using them on winform projects. after lot of searching, found following code on msdn allows app work on dev machine:

public myconfiguration() {     setexecutionstrategy("system.data.sqlclient", () => new sqlazureexecutionstrategy());     setdefaultconnectionfactory(new localdbconnectionfactory("mssqllocaldb")); } 

i put following code in:

system.windows.forms.messagebox.show(db.database.connection.connectionstring.tostring()); 

which returns this:

data source=|datadirectory|myapp.context.sdf;  

i've tried googling without luck , can't seem find else on stackoverflow similar issue.

i tried few things including removing reinstalling entity framework nuget package, , same code returns this:

data source=(localdb)\mssqllocaldb;initial catalog=myapp.context;integrated security=true;multipleactiveresultsets=true 

there no change in app.config , @ loss has happened.

can understand/explain has happened here?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -