Created
November 25, 2013 20:27
-
-
Save jcreamer898/7648272 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class BaseDocument | |
{ | |
public Document Document { get; set; } | |
public BaseDocument() | |
{ | |
} | |
public BaseDocument(Document doc) | |
{ | |
Document = doc; | |
GetType().GetProperties().ToList().ForEach(prop => | |
{ | |
var value = GetDocumentValueForProperty(prop); | |
prop.SetValue(prop.Name, value); | |
}); | |
} | |
public object GetDocumentValueForProperty(PropertyInfo property) | |
{ | |
// Do any type conversions here | |
return Document.Get(property.Name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment