概念方面不能映射到对象方面吗? [英] Conceptual side cannot be mapped to object side?

查看:69
本文介绍了概念方面不能映射到对象方面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有Db-First方法的实体框架。我曾经有一个名为Rank的表,该表映射到带有一些继承的具体类的抽象基类。现在,我最近删除了所有继承,并选择只使用一个名为Rank的具体类。

I use the Entity Framework with Db-First approach. I used to have a table called Ranking that I mapped to an abstract base class with a few inherited concrete classes. Now I recently removed all the inheritance and choose to just use one concrete class called Ranking.

但是由于我将其更改回了,因此出现了以下运行时异常:

But since I changed it back I get the following runtime Exception:

在概念方面,类型'DbModel.Ranking'不能映射为对象方面的类型'My.Application.Models.Ranking'。这两种类型都必须是抽象类型,或者都必须是具体类型。

在我的代码生成中,我将Abstract设置为false,但是我不知道如何在 conceptual 端进行更改。

In my code generation I have set Abstract to false, but I don't know how to change this on the conceptual side.

我什至尝试从表设计器中删除排名表,然后从数据库中再次对其进行更新。

I even tried deleting the Ranking table from my table designer, and then update it again from the database. This didn't help either.

有人知道吗?

推荐答案

找到了。我定义了一个局部类,在其中我忘了删除abstract修饰符。

Found it. There was a partial class defined where I forgot to remove the abstract modifier.

因此,生成的部分类不再具有abstract修饰符,而其他部分仍具有。

So the generated partial class didn't had the abstract modifier anymore, but the other partial still had.

毕竟还是很愚蠢的,但是希望这可以防止其他人浪费半个小时。

Pretty stupid after all, but hopefully this prevents some other people wasting half an hour.

这篇关于概念方面不能映射到对象方面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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