Grpc.Core.Interceptors.ChannelExtensions.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 C# </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class ChannelExtensions
  11. | gRPC C# ">
  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. <div class="inheritedMembers">
  84. <h5>Inherited Members</h5>
  85. <div>
  86. <span class="xref">System.Object.Equals(System.Object)</span>
  87. </div>
  88. <div>
  89. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  90. </div>
  91. <div>
  92. <span class="xref">System.Object.GetHashCode()</span>
  93. </div>
  94. <div>
  95. <span class="xref">System.Object.GetType()</span>
  96. </div>
  97. <div>
  98. <span class="xref">System.Object.MemberwiseClone()</span>
  99. </div>
  100. <div>
  101. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  102. </div>
  103. <div>
  104. <span class="xref">System.Object.ToString()</span>
  105. </div>
  106. </div>
  107. <h6><strong>Namespace</strong>: <a class="xref" href="Grpc.Core.Interceptors.html">Grpc.Core.Interceptors</a></h6>
  108. <h6><strong>Assembly</strong>: Grpc.Core.Api.dll</h6>
  109. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_syntax">Syntax</h5>
  110. <div class="codewrapper">
  111. <pre><code class="lang-csharp hljs">public static class ChannelExtensions</code></pre>
  112. </div>
  113. <h3 id="methods">Methods
  114. </h3>
  115. <a id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept*"></a>
  116. <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>
  117. <div class="markdown level1 summary"><p>Returns a <a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a> instance that intercepts
  118. the channel with the given interceptor.</p>
  119. </div>
  120. <div class="markdown level1 conceptual"></div>
  121. <h5 class="decalaration">Declaration</h5>
  122. <div class="codewrapper">
  123. <pre><code class="lang-csharp hljs">public static CallInvoker Intercept(this ChannelBase channel, Interceptor interceptor)</code></pre>
  124. </div>
  125. <h5 class="parameters">Parameters</h5>
  126. <table class="table table-bordered table-striped table-condensed">
  127. <thead>
  128. <tr>
  129. <th>Type</th>
  130. <th>Name</th>
  131. <th>Description</th>
  132. </tr>
  133. </thead>
  134. <tbody>
  135. <tr>
  136. <td><a class="xref" href="Grpc.Core.ChannelBase.html">ChannelBase</a></td>
  137. <td><span class="parametername">channel</span></td>
  138. <td><p>The channel to intercept.</p>
  139. </td>
  140. </tr>
  141. <tr>
  142. <td><a class="xref" href="Grpc.Core.Interceptors.Interceptor.html">Interceptor</a></td>
  143. <td><span class="parametername">interceptor</span></td>
  144. <td><p>The interceptor to intercept the channel with.</p>
  145. </td>
  146. </tr>
  147. </tbody>
  148. </table>
  149. <h5 class="returns">Returns</h5>
  150. <table class="table table-bordered table-striped table-condensed">
  151. <thead>
  152. <tr>
  153. <th>Type</th>
  154. <th>Description</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. <tr>
  159. <td><a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a></td>
  160. <td></td>
  161. </tr>
  162. </tbody>
  163. </table>
  164. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Grpc_Core_Interceptors_Interceptor__remarks">Remarks</h5>
  165. <div class="markdown level1 remarks"><p>Multiple interceptors can be added on top of each other by calling
  166. &quot;channel.Intercept(a, b, c)&quot;. The order of invocation will be &quot;a&quot;, &quot;b&quot;, and then &quot;c&quot;.
  167. Interceptors can be later added to an existing intercepted channel, effectively
  168. building a chain like &quot;channel.Intercept(c).Intercept(b).Intercept(a)&quot;. Note that
  169. in this case, the last interceptor added will be the first to take control.</p>
  170. </div>
  171. <a id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept*"></a>
  172. <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>
  173. <div class="markdown level1 summary"><p>Returns a <a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a> instance that intercepts
  174. the channel with the given interceptors.</p>
  175. </div>
  176. <div class="markdown level1 conceptual"></div>
  177. <h5 class="decalaration">Declaration</h5>
  178. <div class="codewrapper">
  179. <pre><code class="lang-csharp hljs">public static CallInvoker Intercept(this ChannelBase channel, params Interceptor[] interceptors)</code></pre>
  180. </div>
  181. <h5 class="parameters">Parameters</h5>
  182. <table class="table table-bordered table-striped table-condensed">
  183. <thead>
  184. <tr>
  185. <th>Type</th>
  186. <th>Name</th>
  187. <th>Description</th>
  188. </tr>
  189. </thead>
  190. <tbody>
  191. <tr>
  192. <td><a class="xref" href="Grpc.Core.ChannelBase.html">ChannelBase</a></td>
  193. <td><span class="parametername">channel</span></td>
  194. <td><p>The channel to intercept.</p>
  195. </td>
  196. </tr>
  197. <tr>
  198. <td><a class="xref" href="Grpc.Core.Interceptors.Interceptor.html">Interceptor</a>[]</td>
  199. <td><span class="parametername">interceptors</span></td>
  200. <td><p>An array of interceptors to intercept the channel with.
  201. Control is passed to the interceptors in the order specified.</p>
  202. </td>
  203. </tr>
  204. </tbody>
  205. </table>
  206. <h5 class="returns">Returns</h5>
  207. <table class="table table-bordered table-striped table-condensed">
  208. <thead>
  209. <tr>
  210. <th>Type</th>
  211. <th>Description</th>
  212. </tr>
  213. </thead>
  214. <tbody>
  215. <tr>
  216. <td><a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a></td>
  217. <td></td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_Grpc_Core_Interceptors_Interceptor____remarks">Remarks</h5>
  222. <div class="markdown level1 remarks"><p>Multiple interceptors can be added on top of each other by calling
  223. &quot;channel.Intercept(a, b, c)&quot;. The order of invocation will be &quot;a&quot;, &quot;b&quot;, and then &quot;c&quot;.
  224. Interceptors can be later added to an existing intercepted channel, effectively
  225. building a chain like &quot;channel.Intercept(c).Intercept(b).Intercept(a)&quot;. Note that
  226. in this case, the last interceptor added will be the first to take control.</p>
  227. </div>
  228. <a id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept*"></a>
  229. <h4 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_System_Func_Grpc_Core_Metadata_Grpc_Core_Metadata__" data-uid="Grpc.Core.Interceptors.ChannelExtensions.Intercept(Grpc.Core.ChannelBase,System.Func{Grpc.Core.Metadata,Grpc.Core.Metadata})">Intercept(ChannelBase, Func&lt;Metadata, Metadata&gt;)</h4>
  230. <div class="markdown level1 summary"><p>Returns a <a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a> instance that intercepts
  231. the invoker with the given interceptor.</p>
  232. </div>
  233. <div class="markdown level1 conceptual"></div>
  234. <h5 class="decalaration">Declaration</h5>
  235. <div class="codewrapper">
  236. <pre><code class="lang-csharp hljs">public static CallInvoker Intercept(this ChannelBase channel, Func&lt;Metadata, Metadata&gt; interceptor)</code></pre>
  237. </div>
  238. <h5 class="parameters">Parameters</h5>
  239. <table class="table table-bordered table-striped table-condensed">
  240. <thead>
  241. <tr>
  242. <th>Type</th>
  243. <th>Name</th>
  244. <th>Description</th>
  245. </tr>
  246. </thead>
  247. <tbody>
  248. <tr>
  249. <td><a class="xref" href="Grpc.Core.ChannelBase.html">ChannelBase</a></td>
  250. <td><span class="parametername">channel</span></td>
  251. <td><p>The channel to intercept.</p>
  252. </td>
  253. </tr>
  254. <tr>
  255. <td><span class="xref">System.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>
  256. <td><span class="parametername">interceptor</span></td>
  257. <td><p>An interceptor delegate that takes the request metadata to be sent with an outgoing call
  258. and returns a <a class="xref" href="Grpc.Core.Metadata.html">Metadata</a> instance that will replace the existing
  259. invocation metadata.</p>
  260. </td>
  261. </tr>
  262. </tbody>
  263. </table>
  264. <h5 class="returns">Returns</h5>
  265. <table class="table table-bordered table-striped table-condensed">
  266. <thead>
  267. <tr>
  268. <th>Type</th>
  269. <th>Description</th>
  270. </tr>
  271. </thead>
  272. <tbody>
  273. <tr>
  274. <td><a class="xref" href="Grpc.Core.CallInvoker.html">CallInvoker</a></td>
  275. <td></td>
  276. </tr>
  277. </tbody>
  278. </table>
  279. <h5 id="Grpc_Core_Interceptors_ChannelExtensions_Intercept_Grpc_Core_ChannelBase_System_Func_Grpc_Core_Metadata_Grpc_Core_Metadata___remarks">Remarks</h5>
  280. <div class="markdown level1 remarks"><p>Multiple interceptors can be added on top of each other by
  281. building a chain like &quot;channel.Intercept(c).Intercept(b).Intercept(a)&quot;. Note that
  282. in this case, the last interceptor added will be the first to take control.</p>
  283. </div>
  284. </article>
  285. </div>
  286. <div class="hidden-sm col-md-2" role="complementary">
  287. <div class="sideaffix">
  288. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  289. <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
  290. </nav>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. <footer>
  296. <div class="grad-bottom"></div>
  297. <div class="footer">
  298. <div class="container">
  299. <span class="pull-right">
  300. <a href="#top">Back to top</a>
  301. </span>
  302. <span>Generated by <strong>DocFX</strong></span>
  303. </div>
  304. </div>
  305. </footer>
  306. </div>
  307. <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
  308. <script type="text/javascript" src="../styles/docfx.js"></script>
  309. <script type="text/javascript" src="../styles/main.js"></script>
  310. </body>
  311. </html>