实体框架4.0:添加缩放属性给出错误(属性未映射:11009)? [英] Entity Framework 4.0: Adding scaler property gives error (property it not mapped: 11009)?
问题描述
我想在我的一个模型(表)中添加一个新的属性。基本上它是一个数据库中不存在的属性,但是我需要将其添加到我的模型中,以便自定义生成工具(自身跟踪实体生成器)将在自定义生成的文件中创建属性。
I wanted to add a new property to one of my model (table). Basically its a property that doesn't exist in the database but i need to add it to my model so that the custom generation tool (self tracking entity generator) will create the the property inside the the custom generated file.
我添加了一个缩放属性,它的一个字符串,并称为testme,但它给我以下错误,任何人知道我如何解决这个问题?
I added a scaler property, its a string and called testme but it gives me the following error, Anybody know how i can fix this?
错误2538错误11009:未映射属性'testme'。
Error 2538 Error 11009: Property 'testme' is not mapped.
我很困惑,为什么我需要将其映射到表...它的表中不存在的字段...
I am confused why do i need to map it to a table... its a field that doesn't exist in the table ...
任何帮助非常感谢
谢谢
推荐答案
通常,您将未映射的属性添加到部分类,而不是通过模型。也就是说,使用酌情权;未映射的属性可能会令人困惑,因为它们大多不能用于LINQ to Entities查询。
Generally, you add un-mapped properties to a partial class instead of via the model. That said, use discretion; un-mapped properties can be confusing, since they mostly can't be used in LINQ to Entities queries.
这篇关于实体框架4.0:添加缩放属性给出错误(属性未映射:11009)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!