0

这是一个引用实体框架类库的 WPF 应用程序。在类库项目的 App.config 中,我有这个:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For 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=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

都非常标准。我想要做的是添加一个连接字符串,这将使我能够通过数据库的 URL 连接到远程服务器。这有可能吗?

我试过这样的事情:

<connectionStrings>
    <add name="LanguageEntities" connectionString="metadata=res://*/LanguageModel.csdl|res://*/LanguageModel.ssdl|res://*/LanguageModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=http://www.myweb.net:667;User ID=Remote;Password=cleverstring;initial catalog=LanguageModel.LanguageEntities;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

但是我的应用程序似乎默认为本地连接而没有给我一条错误消息。

任何建议都非常感激。

非常感谢!

4

0 回答 0