connectionStrings问题 [英] connectionStrings problem

查看:51
本文介绍了connectionStrings问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Entity Framework4构建一个wcf解决方案。
$


当我运行应用程序时,我收到以下错误:
$
在配置中找不到指定的命名连接,不打算与EntityClient提供程序一起使用,或者无效。



我认为我在服务项目下没有正确的连接字符串。



我有客户端,主机,服务和数据访问层项目在我的解决方案中。



DAL项目位于文件夹D:\ DotNet Execises \EF \ DAL

服务项目位于文件夹D:\ DotNet Execises\EF\Service



PatientModal.edmx文件位于DAL项目中。



用于DAL的app.config中的连接字符串是
< add name =" PatientEntities" connectionString =" metadata = .\PatientModel.csdl | .\PatientModel.ssdl | .\PatientModel.msl; provider = System.Data.SqlClient; provider connection string =& quot; ... ...


装配名称为DAL,DAL项目版本1.0.0.0和服务项目服务。



服务项目中的连接是什么?



谢谢。

I am building a wcf solution with Entity Framework4.

When I run the application, I got the following error:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

I think I don't have a correct connection string under Service project.

I have client, host, service and data access layer projects in my solutin.

the DAL project is in the folder D:\DotNet Execises\EF\DAL
the Service project is in folder D:\DotNet Execises\EF\Service

the PatientModal.edmx file is in the DAL project.

the connection string in the app.config for DAL is
<add name="PatientEntities" connectionString="metadata=.\PatientModel.csdl|.\PatientModel.ssdl|.\PatientModel.msl;provider=System.Data.SqlClient;provider connection string=&quot; ...

The assembly name is DAL, version 1.0.0.0 for DAL project and Service for Service project.

What the connection should be in the Service project?

Thanks.

推荐答案

Stephen,

 

您使用的是CTP4还是随附的EF4的RTM版本.NET 4? 
如果您使用的是CTP4,那么您似乎正在尝试使用特殊的Entity Framework连接字符串和DbContext。 
特殊的EF连接字符串包含有关模型的信息,旨在用于Model First和Database First方法。 
这是DbContext支持的内容,但目前还没有。 
在CTP4中,DbContext专注于Code First方法,您没有任何模型的EDMX文件或特殊的EF连接字符串。 
而是根据代码构建模型,并且应该为DbContext提供常规的SQL客户端连接字符串。

Are you using CTP4 or the RTM version of EF4 that ships with .NET 4?  If you are using CTP4, then it looks like you are trying to use a special Entity Framework connection string with DbContext.  The special EF connection string contains information about the model and is designed to work for Model First and Database First approaches.  This is something that will be supported with DbContext but isn’t currently.  In CTP4 DbContext is focused around the Code First approach where you do not have any EDMX file for the model or a special EF connection string.  Instead the model is built from the code and DbContext should be given a regular SQL client connection string.

 

如果您正在使用RTM EF4,那么还有其他事情发生,我们应该将消息移到非预先发布论坛。

  ;

谢谢,

Arthur

 


这篇关于connectionStrings问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆