I have a generic method. I do not know what the type will be at the time of writing this function. It will change based on application which is why I need it to return generic. I would just return a json string, however I am using petapocos which has a fetch method and I have to specify type in order to get anything from the database.
For Example
C# method
public IEnumerable<T> GetItems<T>(string type)
{
return DatabaseContext.Database.Fetch<T>("SELECT * FROM " + type)
}
Any Idea how I can get the ajax method to send over a specific type?
Currently I am sending type over as a string which works for the SQL query, but won't allow me to specify type for the Fetch method.