指定的成员映射无效。在数据库中添加新列时,ADO.net 实体框架中出现错误?

发布于 2024-12-07 03:55:11 字数 860 浏览 3 评论 0原文

我对 ADo.net 实体 框架非常陌生,

 The type 'Edm.Byte' of the member 'IsActive' in the conceptual side type 
 NopSolutions.NopCommerce.BusinessLogic.Data.Language' does not match with the type 
 System.Boolean' of the member 'IsActive' on the object side type   NopSolutions.NopCommerce.BusinessLogic.Directory.Language'.

据我了解,缺少一些与 edm 的数据类型相关的错误object

但我在数据库表中创建了一个位类型的列,并且在 langauge.cs 中我声明了

   public bool IsActive { get; set; }

any 的属性需要的详细信息我可以在这里发布

编辑:

当我谷歌搜索时我发现stackoverflow上的这个问题

et-model-property-to-boolean-in-实体框架正在将字节更改为布尔值以映射tinyint,

但在我的情况下,我在数据库中也是如此。

I am very new to ADo.net entity framework and i am getting the following error

 The type 'Edm.Byte' of the member 'IsActive' in the conceptual side type 
 NopSolutions.NopCommerce.BusinessLogic.Data.Language' does not match with the type 
 System.Boolean' of the member 'IsActive' on the object side type   NopSolutions.NopCommerce.BusinessLogic.Directory.Language'.

as far i understand that there is some missing to relating the data type of edm and object

but i made a column in database table which is bit type and in langauge.cs i declare the property of

   public bool IsActive { get; set; }

any details needed i can post here

EDIT :

as i google around i found this question on stackoverflow

et-model-property-to-boolean-in-entity-framework which is changing the Byte to Boolean for mapping tinyint

but in my case i have in database is also the bit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深白境迁sunset 2024-12-14 03:55:11

假设您有一个可以修改的 .edmx 文件。在 XML 编辑器中打开它并搜索 元素。其中应包含实体的定义,查找 元素,该元素应声明如下内容:

<Property Name="IsActive" Type="Byte" Nullable="false" />

更改 Type-属性为布尔值。

我很确定您也可以在设计器中执行此操作,但如果您无法直接访问 .edmx,请告诉我,我们会找出解决办法。

Assuming that you have an .edmx-file you can modify. Open it in an XML-editor and search for the <edmx:ConceptualModels>-element. This should contain the definition of your entities, look for the <EntityType Name="Language">-element, which should declare something like this:

<Property Name="IsActive" Type="Byte" Nullable="false" />

Change the Type-attribute to Boolean.

I'm pretty sure that you could also do this in the designer, but if you don't have direct access to the .edmx let me know and we figure something out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文