简体   繁体   English

实体框架-添加现有数据库

[英]Entity Framework - Add Existing Database

I'm trying to add a database using the Entity Data Model Wizard and keep on getting an error "An Item with the same key has already been added." 我试图使用实体数据模型向导添加数据库,并继续收到错误消息“已添加具有相同键的项”。

EF Designer from Database > New Connection > Error EF Designer从数据库>新建连接>错误

VS错误

This is a new connection that I'm working with. 这是我正在使用的新连接。 Where can I view what keys are entered? 在哪里可以查看输入了哪些键?

Make sure that what you key in for "Save connection settings in Web.Config" is unique . 确保您key的“在Web.Config中保存连接设置”的输入unique You can browse the web.config file to see what connections you've already saved. 您可以浏览web.config文件以查看已保存的连接。

I had the same problem a while ago and found out that I have model with the same property twice. 不久前,我遇到了同样的问题,发现我有两次具有相同属性的模型。 Just rename that property and it should work fine. 只需重命名该属性,它就可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM