怎么不先坚持房地产EF4 code? [英] How not persist property EF4 code first?

查看:187
本文介绍了怎么不先坚持房地产EF4 code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使非坚持使用codefirst EF4属性?

How do I make non persisted properties using codefirst EF4?

MS说,有一个StoreIgnore属性,但我不能找到它。

MS says there is a StoreIgnore Attribute, but I cannot find it.

<一个href="http://blogs.msdn.com/b/efdesign/archive/2010/03/30/data-annotations-in-the-entity-framework-and-$c$c-first.aspx">http://blogs.msdn.com/b/efdesign/archive/2010/03/30/data-annotations-in-the-entity-framework-and-$c$c-first.aspx

有没有办法使用EntityConfiguration来设置呢?

Is there a way to set this up using EntityConfiguration?

推荐答案

在EF code-首先CTP5,您可以使用 [NotMapped] 注释。

In EF Code-First CTP5, you can use the [NotMapped] annotation.

using System.ComponentModel.DataAnnotations;
public class Song
{
    public int Id { get; set; }
    public string Title { get; set; }

    [NotMapped]
    public int Track { get; set; }

这篇关于怎么不先坚持房地产EF4 code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆