示例#1
0
        /// <summary>Creates a new object adapter with the specified router proxy. Calling this method is equivalent
        /// to setting the name.Router property and then calling <see cref="CreateObjectAdapter(string)"/>.</summary>
        /// <param name="name">The object adapter name. Cannot be empty.</param>
        /// <param name="router">The proxy to the router.</param>
        /// <returns>The new object adapter.</returns>
        public ObjectAdapter CreateObjectAdapterWithRouter(string name, IRouterPrx router)
        {
            if (name.Length == 0)
            {
                throw new ArgumentException("the empty string is not a valid object adapter name", nameof(name));
            }

            // We set the proxy properties here, although we still use the proxy supplied.
            Dictionary <string, string> properties = router.ToProperty($"{name}.Router");

            foreach (KeyValuePair <string, string> entry in properties)
            {
                SetProperty(entry.Key, entry.Value);
            }

            return(AddObjectAdapter(name, router));
        }
示例#2
0
        /// <summary>Creates a new object adapter with the specified router proxy. Calling this method is equivalent to
        /// setting the name.Router property and then calling
        /// <see cref="CreateObjectAdapterAsync(string, bool, TaskScheduler?, CancellationToken)"/>.</summary>
        /// <param name="name">The object adapter name. Cannot be empty.</param>
        /// <param name="router">The proxy to the router.</param>
        /// <param name="serializeDispatch">Indicates whether or not this object adapter serializes the dispatching of
        /// of requests received over the same connection.</param>
        /// <param name="taskScheduler">The optional task scheduler to use for dispatching requests.</param>
        /// <param name="cancel">The cancellation token.</param>
        /// <returns>A value task holding the new object adapter.</returns>
        public ValueTask <ObjectAdapter> CreateObjectAdapterWithRouterAsync(
            string name,
            IRouterPrx router,
            bool serializeDispatch      = false,
            TaskScheduler?taskScheduler = null,
            CancellationToken cancel    = default)
        {
            if (name.Length == 0)
            {
                throw new ArgumentException("the empty string is not a valid object adapter name", nameof(name));
            }

            // We set the proxy properties here, although we still use the proxy supplied.
            Dictionary <string, string> properties = router.ToProperty($"{name}.Router");

            foreach (KeyValuePair <string, string> entry in properties)
            {
                SetProperty(entry.Key, entry.Value);
            }

            return(CreateObjectAdapterAsync(name, serializeDispatch, taskScheduler, router, cancel));
        }