public WSServiceEntry CreateServiceEntry(Type service) { WSServiceEntry result = null; var routeTemplate = service.GetCustomAttribute <ServiceBundleAttribute>(); var behaviorContract = service.GetCustomAttribute <BehaviorContractAttribute>(); var objInstance = _serviceProvider.GetInstances(service); var behavior = objInstance as WSBehavior; var path = RoutePatternParser.Parse(routeTemplate.RouteTemplate, service.Name); if (path.Length > 0 && path[0] != '/') { path = $"/{path}"; } if (behavior != null) { behavior.Protocol = behaviorContract?.Protocol; result = new WSServiceEntry { Behavior = behavior, Type = behavior.GetType(), Path = path, }; } return(result); }
public WSServiceEntry CreateServiceEntry(Type service) { WSServiceEntry result = null; var routeTemplate = service.GetCustomAttribute <ServiceBundleAttribute>(); var behaviorContract = service.GetCustomAttribute <BehaviorContractAttribute>(); var objInstance = _serviceProvider.GetInstances(service); var behavior = objInstance as WebSocketBehavior; var path = RoutePatternParser.Parse(routeTemplate.RouteTemplate, service.Name); if (path.Length > 0 && path[0] != '/') { path = $"/{path}"; } if (behavior != null) { result = new WSServiceEntry { Behavior = behavior, Type = behavior.GetType(), Path = path, FuncBehavior = () => { return(GetWebSocketBehavior(service, _options?.Behavior, behaviorContract)); } } } ; return(result); }