更新实体框架模型 [英] Updating Entity Framework Model

查看:192
本文介绍了更新实体框架模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用EF开始,发现它很酷,但我遇到了一个问题,

I have just started using EF and found it cool, but I ran into a problem,

问题:

口更改的表内的用户一栏我的DB模式,这是VARBINARY(50)我以前然后把它改为VARCHAR(50),然后MyModel.edmx设计师里面我选择了从数据库更新模式 。点击完成后,我收到此错误

Problem:
I changed my DB schema of a column inside the table User, It was Varbinary(50) previously I then changed it into VarChar(50), and then inside the MyModel.edmx designer I chose "Update model from database", after clicking finish I received this error.

错误:


   Error 2019: Member Mapping specified is not valid.
    The type 'Edm.Binary [Nullable=False,DefaultValue=,MaxLength=100,FixedLength=False]' of member
   'Email' in type 'LearnDBModel.User' is not compatible with SqlServer.varchar 
    [Nullable=False,DefaultValue=, MaxLength=50,Unicode=False,FixedLength=False]' of member 'Email'
    in type 'LearnDBModel.Store.User'.

让我知道如何解决它。

推荐答案

我以前碰到类似的问题,发现的方式来解决它是从模型中删除该表。保存并关闭模型。然后重新打开该模型,并重新添加表。

I've run into similar issues before, and found that the way to solve it was to delete the table from the model. Save and close the model. Then reopen the model and re-add the table.

这篇关于更新实体框架模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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