1: public partial class GeneratedClass
2: {
3: // some code here
4: }
If your generated class is a partial class and you're trying to add class-level metadata, simply create another partial class and add the property as follows:
1: [MyClassMetadata]
2: public partial class GeneratedClass
3: {
4: }
On the other hand, if you want to add metadata to a property, you can use the MetadataType attribute as follows. Again, create a second partial class to do this.
1: [MetadataType(typeof(GeneratedClassValidation))]
2: public partial class GeneratedClass()
3: {
4: }
5: public class GeneratedClassValidation
6: {
7: [MyPropertyAttribute]
8: public string MyProperty { get; set; }
9: }
Hey guys good article.
ReplyDeleteWebsite Development Company in Bangalore