Esempio n. 1
0
        /// <summary>
        /// call OnProxyCreated for each this.handlers
        /// </summary>
        /// <param name="args">ProxyCreatedArgs</param>
        private void OnClientCreated(ClientCreatedArgs args)
        {
            var op       = this.options.Get(args.Name);
            var handlers = op.ODataHandlers;

            foreach (IODataClientHandler handler in handlers)
            {
                var odataVersion = args.ODataClient.MaxProtocolVersion;
                Log.OnClientCreatedHandler(this.logger, odataVersion, handler.GetType().FullName, args.Name, null);
                handler.OnClientCreated(args);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// create a connection to an OData service, specifying a named HTTP client
        /// </summary>
        /// <typeparam name="T">The client type.</typeparam>
        /// <param name="serviceRoot">An absolute URI that identifies the root of a data service.</param>
        /// <param name="name">the logic name of the client to use, including both HttpClient and ODataClient.</param>
        /// <returns>The client type instance.</returns>
        public T CreateClient <T>(Uri serviceRoot, string name) where T : DataServiceContext
        {
            // default to highest protocol version client support.
            var odataVersion = ODataProtocolVersion.V401;

            Log.BeforeCreateClient(this.logger, odataVersion, name, null);

            T container = this.activator.CreateClient <T>(serviceRoot);

            var args = new ClientCreatedArgs(name, container);

            this.OnClientCreated(args);
            return(container);
        }
Esempio n. 3
0
 public void OnClientCreated(ClientCreatedArgs args)
 {
     this.action(args.ODataClient);
 }
 public void OnClientCreated(ClientCreatedArgs clientArgs)
 {
     clientArgs.ODataClient.Configurations.RequestPipeline.OnMessageCreating = (args) => new HttpClientRequestMessage(this.HttpClientFactory.CreateClient(clientArgs.Name), args, clientArgs.ODataClient.Configurations);
 }