我对 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'.
据我了解,在关联 edm 和 object 的数据类型方面存在一些缺失/p>
但我在数据库表中创建了一个位类型的列,并且在 langauge.cs
我声明了
public bool IsActive { get; set; }
任何需要的细节我都可以在这里发布
编辑:
当我在 google 周围时,我在 stackoverflow 上发现了这个问题
et-model-property-to-boolean-in-entity-framework这将 Byte 更改为 Boolean 以映射 tinyint
但在我的情况下,我在数据库中也有一点。
最佳答案
假设您有一个可以修改的 .edmx 文件。在 XML 编辑器中打开它并搜索 <edmx:ConceptualModels>
-元素。这应该包含您的实体的定义,查找 <EntityType Name="Language">
-element,它应该声明如下内容:
<Property Name="IsActive" Type="Byte" Nullable="false" />
更改Type
-归属于 Boolean
.
我很确定您也可以在设计器中执行此操作,但如果您无法直接访问 .edmx,请告诉我,我们会想办法。
关于entity-framework - 指定的成员映射无效。在数据库中添加新列时 ADO.net Entity Framework 中的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7593588/