Exemplo n.º 1
0
        public bool TryAdd(object service, out PathString servicePathBase)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            if (!(service is StatelessService) && !(service is StatefulService))
            {
                throw new ArgumentException(null, nameof(service));
            }

            servicePathBase = ServicePathBase.New();

            return(ImmutableInterlocked.TryAdd(ref _entries, servicePathBase, service));
        }
Exemplo n.º 2
0
        public bool TryGet(PathString path, out PathString servicePathBase, out PathString remainingPath, out object service)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            servicePathBase = null;
            remainingPath   = null;
            service         = null;

            if (!ServicePathBase.TryGet(path, out servicePathBase, out remainingPath))
            {
                return(false);
            }

            if (!_entries.TryGetValue(servicePathBase, out service))
            {
                return(false);
            }

            return(true);
        }