简体   繁体   中英

entity framework 4.1 code generation, problems with generated code

When I update my Entity model my code generated classes (ie. Model.tt) are rebuild, this is expected. But lets say I want to have this

[DisplayFormat(DataFormatString = "{0:dd MMM yyyy}")]

above some datetime property.

My id is to have a class to inhered the base class via

public class ChildClass : BaseClass
{
    [DisplayFormat(DataFormatString = "{0:dd MMM yyyy}")]
    public override DateTime? Day
    {
        get { return base.Day; }
        set{ base.Day = value; }
    }
}

Maybe there is another way to do this, but can I make the code generated class have all (or some) properties virtual ?

cheers sushiBite

而不是使用override关键字,我使用了new ,因此不需要具有虚拟属性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM