Skip to content

Instantly share code, notes, and snippets.

@timgthomas
Created March 7, 2011 19:40
Show Gist options
  • Save timgthomas/859070 to your computer and use it in GitHub Desktop.
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
[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