internal static InvokeInfo GetInvokeInfo(NamesPair pair) { var vkInfo = new InvokeInfo { ServiceTypeInfo = TypeList.FirstOrDefault( t => String.Compare(t.ServiceType.Name, pair.ServiceName, StringComparison.OrdinalIgnoreCase) == 0) }; if (vkInfo.ServiceTypeInfo == null) { return(null); } vkInfo.MethodAttrInfo = GetServiceMethod(vkInfo.ServiceTypeInfo, pair.MethodName); if (vkInfo.MethodAttrInfo == null) { return(null); } if (vkInfo.MethodAttrInfo.MethodInfo.IsStatic == false) { vkInfo.ServiceInstance = Activator.CreateInstance(vkInfo.ServiceTypeInfo.ServiceType); } return(vkInfo); }
public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { var np = new NamesPair { ServiceName = Match.Groups["name"].Value, MethodName = Match.Groups["method"].Value }; if (string.IsNullOrEmpty(np.ServiceName) || string.IsNullOrEmpty(np.MethodName)) { ExceptionHelper.Throw404Exception(context); } var vInfo = ReflectionHelper.GetInvokeInfo(np); if (vInfo == null) { ExceptionHelper.Throw404Exception(context); } var sinfo = new ServiceInfo(np, vInfo); if (sinfo.InvokeInfo == null) { ExceptionHelper.Throw404Exception(context); } switch (vInfo.ServiceTypeInfo.ServiceAttr.SessionMode) { case SessionMode.NotSupport: return(new ServiceHandler(sinfo)); case SessionMode.Support: return(new SessionHandler(sinfo)); default: throw new ArgumentOutOfRangeException(); } }
internal ServiceInfo(NamesPair pair, InvokeInfo vkInfo) { this.NamesPair = pair; this.InvokeInfo = vkInfo; }