Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created January 13, 2011 01:39
Show Gist options
  • Save jfromaniello/777257 to your computer and use it in GitHub Desktop.
Save jfromaniello/777257 to your computer and use it in GitHub Desktop.
//IDataErrorInfo as a Mixed in implementation.
[MixIn(typeof(DataErrorInfoImpl)]
public class Person
{
[Required]
public string FirstName{get;set;}
public string LastName {get;set;}
}
public class DataErrorInfoImpl : IDataErrorInfo
{
public string this[string columnName]()
{
// data annotations code to retrieve errors
}
public string Errors(){ //other code }
}
//produces:
public class Person
{
[Required]
public string FirstName{get;set;}
public string LastName {get;set;}
string IDataErrorInfo.this[string columnName]()
{
// data annotations code to retrieve errors
}
string IDataErrorInfo.Errors(){ //other code }
}
//Remove mixing attribute and reference from the assembly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment