2 using System.Collections.Generic;
7 namespace Sage.ES.S50.DataAccess.Models
15 internal class EntityAutomaticValues
19 object _entity = null;
23 public EntityAutomaticValues(
object obj)
28 public void SetValue(Property property)
30 PropertyInfo prop = _entity.GetType().GetProperty(property.ToString());
33 case Property.GUID_ID:
35 if (prop != null &&
string.IsNullOrWhiteSpace(Convert.ToString(prop.GetValue(_entity, null))))
37 prop.SetValue(_entity, Guid.NewGuid().ToString(), null);
40 case Property.MODIFIED:
41 case Property.CREATED:
44 prop.SetValue(_entity, DateTime.Now, null);
51 public object GetValue(Property property)
54 PropertyInfo prop = _entity.GetType().GetProperty(property.ToString());
57 value = prop.GetValue(_entity, null);