Created
March 7, 2011 19:40
-
-
Save timgthomas/859070 to your computer and use it in GitHub Desktop.
Using a metadata class to provide attributes to properties in another part of the same (partial) class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MetadataType(typeof(PersonMetadata))] | |
public partial class Person | |
{ | |
public class PersonMetadata | |
{ | |
[Required] | |
public string Name { get; set; } | |
} | |
} | |
// Elsewhere (and inaccessible)... | |
public partial class Person | |
{ | |
public string Name { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment