当我尝试访问 .edmx 中的视图时出现此错误:
All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.
这是产生错误的代码:
private IQueryable<daDialogNotes.viewDialogNotesAll> GetAuthorizedList()
{
List<int> authorizedClients = al.GetClientIds();
daDialogNotes.NTS2001Entities context = new daDialogNotes.NTS2001Entities();
IQueryable<daDialogNotes.viewDialogNotesAll> m;
m = context.viewDialogNotesAlls.Where(x => (authorizedClients.Contains(x.Client_Id))).AsQueryable();
// error in line above
return m;
}
这是我的观点的图像:
提供者的 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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="NTS2001Entities" connectionString="metadata=res://*/DialogNotes.csdl|res://*/DialogNotes.ssdl|res://*/DialogNotes.msl;provider=System.Data.SqlClient;provider connection string="data source=NTS-UAT;initial catalog=NTS2001;persist security info=True;user id=*******;password=*********;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
我在所有东西上运行 .net 4.5。edmx 在另一个项目文件中,我在我的应用程序中引用了 dll。谷歌搜索我发现人们在从 .net 3.5 升级到 4.0 时遇到此错误,但这一直在 4.5 上运行。
有任何想法吗?