无法使用TFS从数据库更新EF模型 [英] Cannot Update EF Model From Database with TFS

查看:90
本文介绍了无法使用TFS从数据库更新EF模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用TFS 2012,并编辑了几个文件并签入没有任何问题。但是,我刚刚开始处理EF数据模型,尽管能够打开文件,但实体设计器右键单击菜单上的从数据库更新模型选项仍显示为灰色/已禁用。

I've recently moved to using TFS 2012 and have edited a couple of files and checked in without any problems. However, I've just started work on the EF data model and despite being able to open the file the "Update Model From Database" option on the Entity designer right-click menu is greyed out / disabled.

我对此感到困惑。我尝试使用允许其他用户签出但阻止他们签入来检出文件,但这没有任何区别。也不检查项目所在的整个文件夹。

I'm a bit baffled by this. I've tried checking out the file with the "Allow other users to check out but prevent them from checking in" but that doesn't make any difference. Nor does checking out the whole folder the project is in.

有人知道我在做什么错吗?

Does anyone know what I'm doing wrong?

编辑:

我发现,如果我在TFS中创建一个项目并向其中添加实体模型,则可以对其进行更新。但是,如果我将现有项目导入到TFS中,然后尝试编辑.edmx文件,那就是问题发生了。

I've discovered that if I create a project in TFS and add an entity model to it then I can update it. However, if I import an existing project into TFS and then try to edit the .edmx file then that's when the problem happens.

推荐答案

我设法解决了这个问题,我将其张贴在这里,以防万一其他人受此困扰:

I managed to work out the problem, I'll post it here just in case anyone else suffers with this:

该项目的设置不正确。我正在编辑本地路径中的文件,但没有首先打开项目(现在看来有点愚蠢,但这是我第一次使用TFS,我以为在TFS中打开项目是在VS中将其打开为项目) 。
当我在源代码管理资源管理器中双击.csproj文件时,出现以下提示:您打开的解决方案处于源代码管理下,但当前未在Visual Studio中配置为集成源代码管理。您想现在将此解决方案绑定到源代码控制吗?

The project wasn't set up properly. I was editing the files in the "local path" having not opened the project first (seems kind of stupid now, but this is my first time with TFS and I'd assumed opening the project in TFS opened it as a project in VS). When I double-clicked on the .csproj file within the Source Control Explorer I was prompted with: "The solution you have opened is under source control but not currently configured for integrated source control in Visual Studio. Would you like to bind this solution to source control now?"

单击是正确打开了项目,我可以从数据库中运行更新模型。

Clicking "Yes" opened the project correctly and I could run the update the model from the database.

这篇关于无法使用TFS从数据库更新EF模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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