指定的成员映射无效。在数据库中添加新列时,ADO.net 实体框架中出现错误?
我对 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有一个可以修改的 .edmx 文件。在 XML 编辑器中打开它并搜索
元素。其中应包含实体的定义,查找
元素,该元素应声明如下内容:更改
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:Change the
Type
-attribute toBoolean
.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.