/// <summary> /// Loads found service and returns it /// </summary> /// <returns></returns> private IAuthentifiedService LoadService() { if (Config == null) { throw new HandlerException("No Service config value found", System.Net.HttpStatusCode.NotImplemented); } return(service = System.Activator.CreateInstance(Config.ServiceType) as IAuthentifiedService); }
private Route[] PrepareNLoadServiceRoutes(IAuthentifiedService service) { var type = service.GetType(); var methods = type.GetMethods(); var routes = new System.Collections.Generic.List <Route>(); foreach (var m in methods) { if (m.IsPublic && m.DeclaringType == type) { routes.Add(new Route(m, service)); } } return(router = routes.ToArray()); }