If you need to add attributes on properties in a generated class, you can do this by using following pattern.
[MetadataType(typeof(TimeFrame_Extension))] public partial class TimeFrame { } public class TimeFrame_Extension { [XmlIgnore] public string From { get; set; } [XmlIgnore] public string To { get; set; } }
source : http://ardalis.com/adding-attributes-to-generated-classes