hi,
I have an assembly with many classes in it.
and some of the methods in those classes have this attribute StoredProcedure
before them, which takes different values . (i basically use it to store
storedprocedure names that this function calls.)
[MyCompany1.Data.StoredProcedure("spGetCustomers")]
[MyCompany1.Data.StoredProcedure("spGetSales")]
public void GetCustomers()
{
....
}
[MyCompany1.Data.StoredProcedure("spGetTotalSales")]
public void GetTotalSales()
{
....
}
etc.
what i want to do is iterate all those methods that have this attribute
StoredProcedure
and find out the value (eg: spGetCustomers and spGetSales in the first
case.)
how do i do this.
I havent figured out how do iterate all the classes
and
how do i find out if a method uses that attribute.
//This simply lists all the methods.
Type type = (typeof(MyCompany1.Dal.DataAccessClass1));
MethodInfo[] methodInfo = type.GetMethods();
for(int i =0;i< methodInfo.Length; i++)
{
Console.WriteLine("Name = " + methodInfo[i].ToString());
}
am i on the right track?
thnx