I am using .net 3.5 framework sp1 and VS 2008 sp1. I have created an edmx model. I couldn't create a transient (which is not persisted to the database) property .
我正在使用.net 3.5框架sp1和VS 2008 sp1。我创建了一个edmx模型。我无法创建瞬态(不会持久保存到数据库)属性。
Any ideas?
2 个解决方案
#1
You can add properties to a partial class for the type you are interested in adding transient properties to - see here.
您可以为要添加瞬态属性的类型的部分类添加属性 - 请参阅此处。
#2
The Entity Data Model doesn't currently support the idea of transient properties. However as Christopher pointed out, you can create a CLR properties in a partial class, that doesn't map to an Entity property.
实体数据模型目前不支持瞬态属性的概念。但是正如Christopher指出的那样,您可以在分部类中创建CLR属性,而不会映射到Entity属性。
This will work fine, but bear in mind all references to that property in LINQ to Entity queries will result in exceptions.
这样可以正常工作,但请记住LINQ to Entity查询中对该属性的所有引用都将导致异常。
#1
You can add properties to a partial class for the type you are interested in adding transient properties to - see here.
您可以为要添加瞬态属性的类型的部分类添加属性 - 请参阅此处。
#2
The Entity Data Model doesn't currently support the idea of transient properties. However as Christopher pointed out, you can create a CLR properties in a partial class, that doesn't map to an Entity property.
实体数据模型目前不支持瞬态属性的概念。但是正如Christopher指出的那样,您可以在分部类中创建CLR属性,而不会映射到Entity属性。
This will work fine, but bear in mind all references to that property in LINQ to Entity queries will result in exceptions.
这样可以正常工作,但请记住LINQ to Entity查询中对该属性的所有引用都将导致异常。