Support for methods from inherited contract interfaces

May 2, 2013 at 2:55 PM
Class ProxyGen, function GenerateProxy.

I have been testing some added code to support inherited contract interfaces and seems to work well.

In if clause
if (tContract.IsInterface && !tContract.ContainsGenericParameters && tContract.GetCustomAttributes(typeof(ServiceContractAttribute), true).Any() && !meths.Any(m => m.IsGenericMethod) && !tContract.GetInterfaces().Any())
I suppress
 && !tContract.GetInterfaces().Any()
And before, I add to meths collection the inherited interfaces methods.
I do this through a recursive function.

What do you think?
Have you added the "&& !tContract.GetInterfaces().Any()" clause for some particular reason?

Thank you in advance.
Coordinator
May 6, 2013 at 3:04 AM
I added the check because I didn't support a contract which implemented other interfaces. For example, suppose you have this:
public interface IParent
{
   int getA();
}

public interface IChild : IParent
{
   int getB();
}
Then my code would only generate an implementation of getB(), but not for getA(), since I was too lazy to implement a recursive traversal of the parent interfaces. However, if you say you've done that, I'll gladly accept a pull request ;-)