Grpc.Core.Interceptors.ChannelExtensions.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class ChannelExtensions
  8. | gRPC for .NET </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class ChannelExtensions
  11. | gRPC for .NET ">
  12. <meta name="generator" content="docfx 2.36.0.0">
  13. <link rel="shortcut icon" href="../favicon.ico">
  14. <link rel="stylesheet" href="../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../styles/docfx.css">
  16. <link rel="stylesheet" href="../styles/main.css">
  17. <meta property="docfx:navrel" content="../toc.html">
  18. <meta property="docfx:tocrel" content="toc.html">
  19. <meta property="docfx:rel" content="../">
  20. </head>
  21. <body data-spy="scroll" data-target="#affix" data-offset="120">
  22. <div id="wrapper">
  23. <header>
  24. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  25. <div class="container">
  26. <div class="navbar-header">
  27. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  28. <span class="sr-only">Toggle navigation</span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="../index.html">
  34. <img id="logo" class="svg" src="../logo.svg" alt="">
  35. </a>
  36. </div>
  37. <div class="collapse navbar-collapse" id="navbar">
  38. <form class="navbar-form navbar-right" role="search" id="search">
  39. <div class="form-group">
  40. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  41. </div>
  42. </form>
  43. </div>
  44. </div>
  45. </nav>
  46. <div class="subnav navbar navbar-default">
  47. <div class="container hide-when-search" id="breadcrumb">
  48. <ul class="breadcrumb">
  49. <li></li>
  50. </ul>
  51. </div>
  52. </div>
  53. </header>
  54. <div class="container body-content">
  55. <div id="search-results">
  56. <div class="search-list"></div>
  57. <div class="sr-items">
  58. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  59. </div>
  60. <ul id="pagination"></ul>
  61. </div>
  62. </div>
  63. <div role="main" class="container body-content hide-when-search">
  64. <div class="sidenav hide-when-search">
  65. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  66. <div class="sidetoggle collapse" id="sidetoggle">
  67. <div id="sidetoc"></div>
  68. </div>
  69. </div>
  70. <div class="article row grid-right">
  71. <div class="col-md-10">
  72. <article class="content wrap" id="_content" data-uid="Grpc.Core.Interceptors.ChannelExtensions">
  73. <h1 id="Grpc_Core_Interceptors_ChannelExtensions" data-uid="Grpc.Core.Interceptors.ChannelExtensions" class="text-break">Class ChannelExtensions
  74. </h1>
  75. <div class="markdown level0 summary"><p>Provides extension methods to make it easy to register interceptors on Channel objects.</p>
  76. </div>
  77. <div class="markdown level0 conceptual"></div>
  78. <div class="inheritance">
  79. <h5>Inheritance</h5>
  80. <div class="level0"><span class="xref">System.Object</span></div>
  81. <div class="level1"><span class="xref">ChannelExtensions</span></div>
  82. </div>
  83. <h6><strong>Namespace</strong>: <a class="xref" href="Grpc.Core.Interceptors.html">Grpc.Core.Interceptors</a></h6>
  84. <h6><strong>Assembly</strong>: Grpc.Core.Api.dll</h6>
  85. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_syntax">Syntax</h5>
  86. <div class="codewrapper">
  87. <pre><code class="lang-csharp hljs">public static class ChannelExtensions : object</code></pre>
  88. </div>
  89. <h3 id="methods">Methods
  90. </h3>
  91. <a id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept*"></a>
  92. <h4 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Func_Grpc_Core_Metadata_Grpc_Core_Metadata__" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept(Grpc.Core.ChannelBase,Func{Grpc.Core.Metadata,Grpc.Core.Metadata})">Intercept(ChannelBase, Func&lt;Metadata, Metadata&gt;)</h4>
  93. <div class="markdown level1 summary"><p>Returns a <a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a> instance that intercepts
  94. the invoker with the given interceptor.</p>
  95. </div>
  96. <div class="markdown level1 conceptual"></div>
  97. <h5 class="decalaration">Declaration</h5>
  98. <div class="codewrapper">
  99. <pre><code class="lang-csharp hljs">public static CallInvoker Intercept(this ChannelBase channel, Func&lt;Metadata, Metadata&gt; interceptor)</code></pre>
  100. </div>
  101. <h5 class="parameters">Parameters</h5>
  102. <table class="table table-bordered table-striped table-condensed">
  103. <thead>
  104. <tr>
  105. <th>Type</th>
  106. <th>Name</th>
  107. <th>Description</th>
  108. </tr>
  109. </thead>
  110. <tbody>
  111. <tr>
  112. <td><a class="xref" href="Grpc.Core.ChannelBase.html">ChannelBase</a></td>
  113. <td><span class="parametername">channel</span></td>
  114. <td><p>The channel to intercept.</p>
  115. </td>
  116. </tr>
  117. <tr>
  118. <td><span class="xref">Func</span>&lt;<a class="xref" href="Grpc.Core.Metadata.html">Metadata</a>, <a class="xref" href="Grpc.Core.Metadata.html">Metadata</a>&gt;</td>
  119. <td><span class="parametername">interceptor</span></td>
  120. <td><p>An interceptor delegate that takes the request metadata to be sent with an outgoing call
  121. and returns a <a class="xref" href="Grpc.Core.Metadata.html">Metadata</a> instance that will replace the existing
  122. invocation metadata.</p>
  123. </td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. <h5 class="returns">Returns</h5>
  128. <table class="table table-bordered table-striped table-condensed">
  129. <thead>
  130. <tr>
  131. <th>Type</th>
  132. <th>Description</th>
  133. </tr>
  134. </thead>
  135. <tbody>
  136. <tr>
  137. <td><a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a></td>
  138. <td></td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Func_Grpc_Core_Metadata_Grpc_Core_Metadata___remarks">Remarks</h5>
  143. <div class="markdown level1 remarks"><p>Multiple interceptors can be added on top of each other by
  144. building a chain like &quot;channel.Intercept(c).Intercept(b).Intercept(a)&quot;. Note that
  145. in this case, the last interceptor added will be the first to take control.</p>
  146. </div>
  147. <a id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept*"></a>
  148. <h4 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Grpc_Core_Interceptors_Interceptor_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept(Grpc.Core.ChannelBase,Grpc.Core.Interceptors.Interceptor)">Intercept(ChannelBase, Interceptor)</h4>
  149. <div class="markdown level1 summary"><p>Returns a <a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a> instance that intercepts
  150. the channel with the given interceptor.</p>
  151. </div>
  152. <div class="markdown level1 conceptual"></div>
  153. <h5 class="decalaration">Declaration</h5>
  154. <div class="codewrapper">
  155. <pre><code class="lang-csharp hljs">public static CallInvoker Intercept(this ChannelBase channel, Interceptor interceptor)</code></pre>
  156. </div>
  157. <h5 class="parameters">Parameters</h5>
  158. <table class="table table-bordered table-striped table-condensed">
  159. <thead>
  160. <tr>
  161. <th>Type</th>
  162. <th>Name</th>
  163. <th>Description</th>
  164. </tr>
  165. </thead>
  166. <tbody>
  167. <tr>
  168. <td><a class="xref" href="Grpc.Core.ChannelBase.html">ChannelBase</a></td>
  169. <td><span class="parametername">channel</span></td>
  170. <td><p>The channel to intercept.</p>
  171. </td>
  172. </tr>
  173. <tr>
  174. <td><a class="xref" href="Grpc.Core.Interceptors.Interceptor.html">Interceptor</a></td>
  175. <td><span class="parametername">interceptor</span></td>
  176. <td><p>The interceptor to intercept the channel with.</p>
  177. </td>
  178. </tr>
  179. </tbody>
  180. </table>
  181. <h5 class="returns">Returns</h5>
  182. <table class="table table-bordered table-striped table-condensed">
  183. <thead>
  184. <tr>
  185. <th>Type</th>
  186. <th>Description</th>
  187. </tr>
  188. </thead>
  189. <tbody>
  190. <tr>
  191. <td><a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a></td>
  192. <td></td>
  193. </tr>
  194. </tbody>
  195. </table>
  196. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Grpc_Core_Interceptors_Interceptor__remarks">Remarks</h5>
  197. <div class="markdown level1 remarks"><p>Multiple interceptors can be added on top of each other by calling
  198. &quot;channel.Intercept(a, b, c)&quot;. The order of invocation will be &quot;a&quot;, &quot;b&quot;, and then &quot;c&quot;.
  199. Interceptors can be later added to an existing intercepted channel, effectively
  200. building a chain like &quot;channel.Intercept(c).Intercept(b).Intercept(a)&quot;. Note that
  201. in this case, the last interceptor added will be the first to take control.</p>
  202. </div>
  203. <a id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept*"></a>
  204. <h4 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Grpc_Core_Interceptors_Interceptor___" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept(Grpc.Core.ChannelBase,Grpc.Core.Interceptors.Interceptor[])">Intercept(ChannelBase, Interceptor[])</h4>
  205. <div class="markdown level1 summary"><p>Returns a <a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a> instance that intercepts
  206. the channel with the given interceptors.</p>
  207. </div>
  208. <div class="markdown level1 conceptual"></div>
  209. <h5 class="decalaration">Declaration</h5>
  210. <div class="codewrapper">
  211. <pre><code class="lang-csharp hljs">public static CallInvoker Intercept(this ChannelBase channel, params Interceptor[] interceptors)</code></pre>
  212. </div>
  213. <h5 class="parameters">Parameters</h5>
  214. <table class="table table-bordered table-striped table-condensed">
  215. <thead>
  216. <tr>
  217. <th>Type</th>
  218. <th>Name</th>
  219. <th>Description</th>
  220. </tr>
  221. </thead>
  222. <tbody>
  223. <tr>
  224. <td><a class="xref" href="Grpc.Core.ChannelBase.html">ChannelBase</a></td>
  225. <td><span class="parametername">channel</span></td>
  226. <td><p>The channel to intercept.</p>
  227. </td>
  228. </tr>
  229. <tr>
  230. <td><a class="xref" href="Grpc.Core.Interceptors.Interceptor.html">Interceptor</a>[]</td>
  231. <td><span class="parametername">interceptors</span></td>
  232. <td><p>An array of interceptors to intercept the channel with.
  233. Control is passed to the interceptors in the order specified.</p>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. <h5 class="returns">Returns</h5>
  239. <table class="table table-bordered table-striped table-condensed">
  240. <thead>
  241. <tr>
  242. <th>Type</th>
  243. <th>Description</th>
  244. </tr>
  245. </thead>
  246. <tbody>
  247. <tr>
  248. <td><a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a></td>
  249. <td></td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Grpc_Core_Interceptors_Interceptor____remarks">Remarks</h5>
  254. <div class="markdown level1 remarks"><p>Multiple interceptors can be added on top of each other by calling
  255. &quot;channel.Intercept(a, b, c)&quot;. The order of invocation will be &quot;a&quot;, &quot;b&quot;, and then &quot;c&quot;.
  256. Interceptors can be later added to an existing intercepted channel, effectively
  257. building a chain like &quot;channel.Intercept(c).Intercept(b).Intercept(a)&quot;. Note that
  258. in this case, the last interceptor added will be the first to take control.</p>
  259. </div>
  260. </article>
  261. </div>
  262. <div class="hidden-sm col-md-2" role="complementary">
  263. <div class="sideaffix">
  264. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  265. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  266. </nav>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <footer>
  272. <div class="grad-bottom"></div>
  273. <div class="footer">
  274. <div class="container">
  275. <span class="pull-right">
  276. <a href="#top">Back to top</a>
  277. </span>
  278. <span>Generated by <strong>DocFX</strong></span>
  279. </div>
  280. </div>
  281. </footer>
  282. </div>
  283. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  284. <script type="text/javascript" src="../styles/docfx.js"></script>
  285. <script type="text/javascript" src="../styles/main.js"></script>
  286. </body>
  287. </html>