Hello, and thanks for any assistance
For:
public abstract class EntityBase
{
protected void Create(EntityBase c)
{
Log.Audit(c);
}
}
public class Customer : EntityBase
{
public void CreateCustomer(Customer c)
{
Create(c);
}
}
}
public class Car : EntityBase
{
public void CreateCar(Car c)
{
Create(c);
}
}
}
For the above example 1) How would you implement the method signature for: Log.Audit(c);
2) Inside the method Audit(c) we will need to cast c to it's appropriate type, and go through the entire object's properties for auditing purposes. How would this be accomplished. I'm thinking something like....
public Audit(T t)
{
switch (t.GetType())
{
case Customer:
//Audit Customer
Audit(<Customer> t);
break;
case Car:
//Audit Car
Audit(<Car> t);
}
}
Just a guess, any help would be great.
Note: If you can think of a better way of architecting this method, please let me know.
Thanks again. Steven