I'm trying to pass a object type to a method. I'm doing this for my CRUDRepository that's inherited by others repositories, but i can't figure out how to know with type i'm handling.
For example:
public PageOf<Entity> GetPageOfEntity(int pageNumber, int pageSize)
{
// Here i need to work with the entity type to make calls to database
}
The Entity is a object that's inherited by other entities (user, products, etc) and this method is returning a paged result. I'm doing this to avoid creating a GetPageOf method for each entity that i've.
What's the proper way to pass to the method the object type that i want to deal in paged results?
Edit:
Here's a example of the Entity
public abstract class Entity
{
public virtual long Id { get; set; }
public virtual DateTime Created { get; set; }
}
And the user object:
public class User : Entity
{
public string FirstName { get; set; }
}
As i'm trying to write a single class to handle some crud operations, i need to know in the method what object i'm using (but i'm trying to now create one method for each object type)
Thanks