Skip to content

Instantly share code, notes, and snippets.

@jcreamer898
Created November 25, 2013 20:27
Show Gist options
  • Save jcreamer898/7648272 to your computer and use it in GitHub Desktop.
Save jcreamer898/7648272 to your computer and use it in GitHub Desktop.
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