在数据库中添加新列时,ADO.net Entity Framework中指定的成员映射是无效的.

rah*_*rma 3 ado.net entity-framework nopcommerce

我是ADo.net entity框架的新手,我收到以下错误

 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'.
Run Code Online (Sandbox Code Playgroud)

据我所知,有一些与edmobject的数据类型相关的缺失

但是我在数据库表中创建了一个列类型,在langauge.csi中声明了属性

   public bool IsActive { get; set; }
Run Code Online (Sandbox Code Playgroud)

我可以在这里发布所需的任何细节

编辑:

因为我谷歌周围我在stackoverflow上发现了这个问题

et-model-property-to-boolean-in-entity-framework,它将Byte更改为Boolean以映射tinyint

但在我的情况下,我在数据库中也有点.

J. *_*hon 9

假设您有一个.edmx文件,您可以修改.在XML编辑器中打开它并搜索<edmx:ConceptualModels>-element.这应该包含你的实体的定义,寻找<EntityType Name="Language">-element,它应该声明如下:

<Property Name="IsActive" Type="Byte" Nullable="false" />
Run Code Online (Sandbox Code Playgroud)

Type-attribute 更改为Boolean.

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