Exemplo n.º 1
0
        internal Result UnregisterService(ServiceName serviceName)
        {
            Result rc = ValidateServiceName(serviceName);

            if (rc.IsFailure())
            {
                return(rc);
            }

            if (!Services.Remove(serviceName, out object service))
            {
                return(ResultSm.NotRegistered.Log());
            }

            if (service is IDisposable disposable)
            {
                disposable.Dispose();
            }

            return(Result.Success);
        }
Exemplo n.º 2
0
        internal Result UnregisterService(ServiceName serviceName)
        {
            Result rc = ValidateServiceName(serviceName);

            if (rc.IsFailure())
            {
                return(rc);
            }

            if (!Services.Remove(serviceName, out IServiceObject service))
            {
                return(ResultSm.NotRegistered.Log());
            }

            // ReSharper disable once SuspiciousTypeConversion.Global
            if (service is IDisposable disposable)
            {
                disposable.Dispose();
            }

            return(Result.Success);
        }
Exemplo n.º 3
0
 public Result UnregisterService(ReadOnlySpan <char> name)
 {
     return(Server.UnregisterService(ServiceName.Encode(name)));
 }
Exemplo n.º 4
0
 public Result RegisterService(IServiceObject serviceObject, ReadOnlySpan <char> name)
 {
     return(Server.RegisterService(serviceObject, ServiceName.Encode(name)));
 }