.NET 4:如何配置EDMX文件Web.Config中其他装配 [英] .NET 4: How to configure EDMX file in other assembly in Web.Config

查看:97
本文介绍了.NET 4:如何配置EDMX文件Web.Config中其他装配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有配置生活在一个其他装配比web项目的EDMX文件有问题。我的项目看起来有点像这样的:

I have a problem with configuring an EDMX file that lives in an other assembly than by web project. My project looks somewhat like this:

Project 1
--> Database.edmx
--> App.Config

Project 2
--> Ton's of .cs and .aspx files.
--> Web.Config with the proper connection string.

在Visual Studio中的内部项目1 .edmx文件的更新进展顺利,虽然我有内部项目2 .edmx文件的应用程序运行,因为它应该。

Inside Visual Studio the updating of the .EDMX file inside Project 1 goes smoothly and while I had the .EDMX file inside project 2 the application ran as it supposed to.

任何人有如何配置.edmx文件内项目1点到Web.config中的ConnectionString的想法? (或者我应该使用Project1.dll.config配置项目1?)

Anyone has an idea on how to configure the .EDMX file inside Project 1 to point to the connectionstring of Web.Config? (or should I use Project1.dll.config to configure Project 1?)

推荐答案

您必须修改 * 在其中的.edmx文件集名称的连接字符串在

You have to change the * in the connection string for the assembly name where the .edmx files are in:

<add name="Entities" connectionString="metadata=res://*/Models.EF.Model.csdl|res://*/Models.EF.Model.ssdl|res://*/Models.EF.Model.msl;provider=System.Data.SqlClient;provider connection ... ;" providerName="System.Data.EntityClient" />

<add name="Entities" connectionString="metadata=res://Project2/Models.EF.Model.csdl|res://Project2/Models.EF.Model.ssdl|res://Project2/Models.EF.Model.msl;provider=System.Data.SqlClient;provider connection ... ;" providerName="System.Data.EntityClient" />

这篇关于.NET 4:如何配置EDMX文件Web.Config中其他装配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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