protected IServerBase GetServerForContext() { // get the server associated with the host. IServerBase server = HostForContext.Server; if (server == null) { throw new ServiceResultException(StatusCodes.BadInternalError, "The endpoint is not associated with a server instance."); } // check the server status. if (ServiceResult.IsBad(server.ServerError)) { throw new ServiceResultException(server.ServerError); } return(server); }
/// <summary> /// Checks the server interface version compatibility for the specified server. /// </summary> /// <returns> /// <c>true</c> if the server is compatible, otherwise <c>false</c>. /// </returns> /// <param name="server"> /// The <see cref="BangSharp.Server.IServerBase"/> to check. /// </param> public static bool IsServerCompatible(IServerBase server) { if(server.ServerInterfaceVersionMajor != InterfaceVersionMajor) return false; if(server.ServerInterfaceVersionMinor < InterfaceVersionMinor) return false; return true; }
/// <summary> /// Internal constructor to use when you write "new ServerBaseProxy" /// </summary> /// <param name="name"></param> public ServerBaseProxy(IServerBase hostedServer) { _hostedServer = hostedServer; }