Entity framework 扩展实体框架模型

Entity framework 扩展实体框架模型,entity-framework,forms,asp.net-mvc-2,model,Entity Framework,Forms,Asp.net Mvc 2,Model,我想扩展一个带有临时属性的实体框架模型。 我只需要mvc格式的。我不需要将它保存在数据库中 如何操作?为要扩展的实体创建分部类 e、 g 此属性将被取消映射,您可以在运行查询或具体化后用数据填充它 或 为您的实体创建一个包装器类,该类同时公开未映射属性和映射属性(视图中需要的属性) //must be in the same namespace as the Customer entity in the model public partial class Customer { pub

我想扩展一个带有临时属性的实体框架模型。 我只需要mvc格式的。我不需要将它保存在数据库中


如何操作?

为要扩展的实体创建分部类

e、 g

此属性将被取消映射,您可以在运行查询或具体化后用数据填充它

为您的实体创建一个包装器类,该类同时公开未映射属性和映射属性(视图中需要的属性)

//must be in the same namespace as the Customer entity in the model
public partial class Customer
{
     public string MyProperty{get;set;}
}