I have a generic function as below:
public async Task<List<T>> GetAllPagedAsync<T>(int limit, int offset, string tableName, int month, int year)
{
return await _dapperRepository.GetAllAsync<T>($"Select * From {tableName} Where Month(CreatedDate) = {month} And Year(CreatedDate) = {year} Limit {limit} Offset {offset}");
}
Instead of giving the type directly to the function, I want to fetch the type with a class name and give it to the function like this:
string className = FetchClassName();
GetAllPagedAsync<className>(limit,offset,tableName,month,year);
Because in the structure I set up here, I will get the class name from appsettings.