I have a class which is marked with a custom attribute, like this:
public class OrderLine : Entity { ... [Parent] public Order Order { get; set; } public Address ShippingAddress{ get; set; } ... }
I want to write a generic method, where I need to get the Property on a Entity which is marked with the Parent attribute.
Here is my Attribute:
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] public class ParentAttribute : Attribute { }
How do I write this?
Use Type.GetProperties() and PropertyInfo.GetValue()