public static WebAttributeInfo GetWebAttributeInfo (this OperationDescription od)
{
#if NET_2_1
var mi = od.BeginMethod ?? od.SyncMethod;
var atts = mi.GetCustomAttributes (typeof (WebGetAttribute), true);
if (atts.Length == 1)
return ((WebGetAttribute) atts [0]).Info;
atts = mi.GetCustomAttributes (typeof (WebInvokeAttribute), true);
if (atts.Length == 1)
return ((WebInvokeAttribute) atts [0]).Info;
return null;
#else
foreach (IOperationBehavior ob in od.Behaviors) {
WebAttributeInfo info = null;
var wg = ob as WebGetAttribute;
if (wg != null)
return wg.Info;
var wi = ob as WebInvokeAttribute;
if (wi != null)
return wi.Info;
}
return new WebGetAttribute ().Info; // blank one
#endif
}
}