Suppose I have the following code:
public List<string> GetTest([Service] IRepository<MyModel> repository, List<FilterDef> filter)
{
var fbuilder = create_filter<MyModel>(filter);
return null;
}
Where is defined as:
public interface IRepository<T> where T :class
and
FilterBuilder<T> create_filter<T>(List<FilterDef> filter)
I would like to keep this generic and pass T from my repository to the create_filter method. I came accros another post and figured out how to resolve T:
Type genericType = repository.GetType().GetGenericArguments()[0];
However, now I am stuck how to pass on T to the create_filter method since T must be resolved before runtime.