c# - MetadataTypeAttribute not adorning additional attributes to properties -
i have code generated class has set of attributes on properties. add additional attributes these properties cannot on code generated class. therefore make use of metadatatypeattribute adorn additional attributes auxiliary class;
// code generated class - can't touch public partial class myclass { public mytype myproperty { get; set; } } // partial class allowing extended attributes [metadatatype(typeof(myclass_additionalattributes))] public partial class myclass { } // defines attributes appended // properties match in partial class public class myclass_additionalattributes { // not serialise myproperty property [xmlignore] public mytype myproperty; } however, not work. using .net reflector, xmlignoreattribute not adorned myclass.myproperty property. can see doing wrong?
i had same problem (with scriptignore instead of xmlignore) , couldn't make work. in end made designer property private , defined public property in external partial class attributes wanted, getting , setting private one.
Comments
Post a Comment