私は2つのプロジェクトを持っています
MyProject //MVC 3 app
MyProject.DAL //Class Library project type
内部MyProject.DAL
には、生成されたエンティティを含むフォルダーがありますEntityModels
(EF Code-First アプローチ)。
namespace MyProject.DAL.EntityModels
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class myEntities : DbContext
{
public myEntities() : base("name=myEntities")
{
...
}
}
}
app.config:
<add name="myEntities" connectionString="metadata=res://*/EntityModels.DBMainModel.csdl|res://*/EntityModels.DBMainModel.ssdl|res://*/EntityModels.DBMainModel.msl;provider=..." providerName="System.Data.EntityClient" />
次に、プロジェクトでそのエンティティを使用したいMyProject
ので、同じ接続文字列をファイルに追加しweb.config
ます。
しかし、私はUnable to load the specified metadata resource.
エラーが発生します。web.config
私はそのようないくつかの変更を加えてみました
<add name="myEntities"
connectionString="metadata=res://*/MyProject.DAL.EntityModels.DBMainModel.csdl|
res://*/MyProject.DAL.EntityModels.DBMainModel.ssdl|
res://*/MyProject.DAL.EntityModels.DBMainModel.msl;provider=..." providerName="System.Data.EntityClient" />
<add name="myEntities"
connectionString="metadata=res://MyProject.DAL.EntityModels.DBMainModel.csdl|
res://MyProject.DAL.EntityModels.DBMainModel.ssdl|
res://MyProject.DAL.EntityModels.DBMainModel.msl;provider=..." providerName="System.Data.EntityClient" />
<add name="myEntities"
connectionString="metadata=res://MyProject.DAL/EntityModels.DBMainModel.csdl|
res://MyProject.DAL/EntityModels.DBMainModel.ssdl|
res://MyProject.DAL/EntityModels.DBMainModel.msl;provider=..." providerName="System.Data.EntityClient" />
しかし、何も機能しません。それを修正する方法?