Metadata Generator template with Self validation

Jul 31, 2012 at 5:13 PM


Nice template thank you. I was wondering if there's a way to include selfvalidation within the classes it generates? like the underlined?

something like below? Obviously writing manually would be painful correct? 

	public partial class ApplicationUserCredential
		internal sealed class ApplicationUserCredentialMetadata

            public static void SelfValidator(ApplicationUserCredential instance, ValidationResults results)
                // TODO: Your validation here.

			[Required(ErrorMessage="Application User Credential is required")]
    		public Int32 ApplicationUserCredentialID { get; set; }

			[Required(ErrorMessage="Application User is required")]
    		public Int32 ApplicationUserID { get; set; }

			[Required(ErrorMessage="User Login Domain is required")]
    		public String UserLoginDomain { get; set; }

			[Required(ErrorMessage="User Login Name is required")]
    		public String UserLoginName { get; set; }

			[Required(ErrorMessage="Last Update User is required")]
    		public String LastUpdateUser { get; set; }

    		public DateTime LastUpdateDateTime { get; set; }

    		public EntityCollection ApplicationUser { get; set; }


Can you please help?

I'm trying to have self validation like this link