G
Guest
Consider the following (which may be bad architecturally speaking, but please
humor me):
public class DomainObject
{
public static void DeleteByID(int id)
{
// Type currentType = ????;
DataLayer.DeleteByID(currentType, id);
}
}
public class Order : Domain Object
{
}
If I call Order.DeleteByID(), how can I tell that it was the Order class
that was called? Because it's a static method, I can't use "this". If I use
Reflection, I can use MethodBase.GetCurrentMethod().DeclaringType, but this
gives me "DomainObject". Is there any way I can get "Order" (the inheriting
class type)?
Many Thanks,
DrJazz
humor me):
public class DomainObject
{
public static void DeleteByID(int id)
{
// Type currentType = ????;
DataLayer.DeleteByID(currentType, id);
}
}
public class Order : Domain Object
{
}
If I call Order.DeleteByID(), how can I tell that it was the Order class
that was called? Because it's a static method, I can't use "this". If I use
Reflection, I can use MethodBase.GetCurrentMethod().DeclaringType, but this
gives me "DomainObject". Is there any way I can get "Order" (the inheriting
class type)?
Many Thanks,
DrJazz