jeudi 30 juin 2016

Finding method through reflection and return type

After having worked with reflection some and managed to get some data back from GetMethods I've finally hit a wall. I've tried to find any sources on this, but to no avail.

Basically I'm creating a RESTFUL Api in ASP.NET (MVC webapi) and using reflection to find the correct method of a DataComponent class that contains hundreds of views / stored procedures. I've gotten past the basic hurdles, but now when I'm finally attempting to use a parameter to find a specific SQL-view I seem to be getting an error:

Ambiguous match found.

I'm assuming this is because I'm attempting to find a single method through

MethodInfo theMethod = myType.GetMethod(toCheck);

But the result is two different methods.

According to my manager it's due to the fact that we are using two different views that return two different DataTypes (one a DataReader, the other a DataSet).

What I want to ask the HIVEMIND is how I can narrow down these two results to a single result either with the help of manually checking for the resulting returntype being DataSet or any other way?

Thanks





Aucun commentaire:

Enregistrer un commentaire