/// <summary>Visit a query component.</summary> /// <param name="component">Component to be visited.</param> public virtual void VisitComponent(IQueryComponent component) { Type componentType = GetType(); MethodInfo componentMethodInfo = null; while ((componentType != typeof(object)) && (componentMethodInfo == null)) { componentMethodInfo = componentType.GetMethod("Visit" + component.GetType().Name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); componentType = componentType.BaseType; } if (componentMethodInfo != null) { componentMethodInfo.Invoke(this, new object[] { component }); } }
/// <summary>Visit a query component.</summary> /// <param name="component">Component to be visited.</param> public virtual void VisitComponent(IQueryComponent component) { Type componentType = GetType(); MethodInfo componentMethodInfo = null; while ((componentType != typeof(object)) && (componentMethodInfo == null)) { componentMethodInfo = componentType.GetMethod("Visit" + component.GetType().Name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); componentType = componentType.GetTypeInfo().BaseType; } if (componentMethodInfo != null) { componentMethodInfo.Invoke(this, new object[] { component }); } }
/// <summary>Gets a query component navigator attribute for given query component.</summary> /// <param name="queryComponent">Query component to be inspected.</param> /// <returns><see cref="QueryComponentNavigatorAttribute" /> or null.</returns> internal static QueryComponentNavigatorAttribute GetQueryComponentNavigatorAttribute(this IQueryComponent queryComponent) { return((QueryComponentNavigatorAttribute)queryComponent.GetType().GetTypeInfo().GetCustomAttributes(typeof(QueryComponentNavigatorAttribute), true).FirstOrDefault()); }