metadatatype

When using Data Annotations with MVC, Pro and Cons of using an interface vs. a MetadataType

If you read this article on Validation with the Data Annotation Validators, it shows that you can use the MetadataType attribute to add validation attributes to properties on partial classes. You use this when working with ORMs like LINQ to SQL, Entity Framework, or Subsonic. Then you can use the "automagic" client and server side vali...

.NET 4 RTM MetadataType attribute ignored when using Validator

I am using VS 2010 RTM and trying to perform some basic validation on a simple type using MetadataTypeAttribute. When I put the validation attribute on the main class, everything works. However, when I put it on the metadata class, it seems to be ignored. I must be missing something trivial, but I've been stuck on this for a while now. ...

Metadatatypes with self-validation using validation application block

Is it possible to use the selfvalidation attribute with my validations located in a metadatatype? I'm using Enterprise Library 5's Validation Application Block. ...

Is there a way to instruct ASP.NET MVC about some class metadata other than putting the MetadataTypeAttribute directly on the class?

Here's a sample of how it works now: [MetadataType(typeof(PersonMetadata))] public class Person { public string Name { get; set; } public int Age { get; set; } } public class PersonMetadata { [Required] public string Name { get; set; } [Range(0,150] public int Age { get; set; } } However I don't want the Metad...