I have a Person class that inherits EntityBase:
public class Person : EntityBase
{
virtual public string FirstName { get; set; }
virtual public string LastName { get; set; }
virtual public IList<Asset> Assets { get; set; }
}
And
public class EntityBase : IEntity
{
public virtual long Id { get; protected set; }
public virtual string Error { get; protected set; }
}
I need to get list of properties of self Person class:
var entity = preUpdateEvent.Entity;
foreach (var item in entity.GetType().GetProperties()) //only FirstName & LastName
{
if (item.PropertyType == typeof(String))
item.SetValue(entity, "XXXXX" ,null);
}
Now GetProperties() is include : FirstName, LastName, Id, Error but I need only own Person properties namely : FirstName, LastName
How can I get the properties that are only defined on Person?
Use
The
DeclaredOnlyvalue is documented like this: