entity-framework - 指定的成员映射无效。在数据库中添加新列时 ADO.net Entity Framework 中的错误?

标签 entity-framework ado.net 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'.

据我了解,在关联 edmobject 的数据类型方面存在一些缺失/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/

相关文章:

c# - 如何首先在 EF6 代码中设置一个唯一的属性

c# - SQLite 未在 MonoDroid 和 MonoTouch 上正确存储 GUID 值

entity-framework-4 - 如何向 NOPCommerce v2.4 添加新表

c# - 执行标量 : "Connection not initialized"

c# - 如何在更改数据库后保存数据集?

c# - System.Web.Routing.UrlRoutingModule 没有实现 IHttpHandlerFactory 或 IHttpHandler

nopcommerce 3.5 通用 URL 引擎

c# - 使用 OData QueryableAttribute 修改从 ASP.NET Web API 返回的响应内容

sql-server - 包含来自SQL Azure的具有较大NVARCHAR值的列的查询速度很慢

c# - Entity Framework 在调用 savechanges 时复制