Visual Studio 2010 Add In using Entity Framework -
i'm creating addin launches forms-based gui. addin , gui in different projects. gui connects database , utilizes ef orm.
when launch gui project vs, works great. when publish gui vs add-ins folder , run it, works fine. when launch gui add-in in vs, loads fine, tries hit database fails. ef complains metadata files.
exception: specified named connection either not found in configuration, not intended used entityclient provider, or not valid.
at system.data.entityclient.entityconnection.changeconnectionstring()
here configuration in app.config
<connectionstrings> <add name="companyentities" connectionstring="metadata=res://*/;provider=system.data.sqlclient;provider connection string="data source=testdb;initial catalog=company;persist security info=true;user id=id;password=password;multipleactiveresultsets=true"" providername="system.data.entityclient"/> </connectionstrings>
the thing can think of "res://*/" portion maps differently when starting assembly different, i've tried using absolute paths csdl/msl/ssdl files without success.
what different launching gui add-in breaks configuration?
don't rely on connectionstring
in config file don't control. instead, pass explicitly when new context, using objectcontext
overload takes connection string.
Comments
Post a Comment