|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>Class EnumerableResolutionAdapter<T> | Screenplay </title> |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 7 | + <meta name="title" content="Class EnumerableResolutionAdapter<T> | Screenplay "> |
| 8 | + |
| 9 | + <meta name="description" content="Adapter class which - when added to DI - permits the BoDi DI container to resolve arbitrary of service instances."> |
| 10 | + <link rel="icon" href="../favicon.ico"> |
| 11 | + <link rel="stylesheet" href="../public/docfx.min.css"> |
| 12 | + <link rel="stylesheet" href="../public/main.css"> |
| 13 | + <meta name="docfx:navrel" content="../toc.html"> |
| 14 | + <meta name="docfx:tocrel" content="toc.html"> |
| 15 | + |
| 16 | + <meta name="docfx:rel" content="../"> |
| 17 | + |
| 18 | + |
| 19 | + <meta name="docfx:docurl" content="https://github.com/csf-dev/CSF.Screenplay/new/master/apiSpec/new?filename=CSF_Screenplay_EnumerableResolutionAdapter_1.md&value=---%0Auid%3A%20CSF.Screenplay.EnumerableResolutionAdapter%601%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A"> |
| 20 | + <meta name="loc:inThisArticle" content="In this article"> |
| 21 | + <meta name="loc:searchResultsCount" content="{count} results for "{query}""> |
| 22 | + <meta name="loc:searchNoResults" content="No results for "{query}""> |
| 23 | + <meta name="loc:tocFilter" content="Filter by title"> |
| 24 | + <meta name="loc:nextArticle" content="Next"> |
| 25 | + <meta name="loc:prevArticle" content="Previous"> |
| 26 | + <meta name="loc:themeLight" content="Light"> |
| 27 | + <meta name="loc:themeDark" content="Dark"> |
| 28 | + <meta name="loc:themeAuto" content="Auto"> |
| 29 | + <meta name="loc:changeTheme" content="Change theme"> |
| 30 | + <meta name="loc:copy" content="Copy"> |
| 31 | + <meta name="loc:downloadPdf" content="Download PDF"> |
| 32 | + |
| 33 | + <script type="module" src="./../public/docfx.min.js"></script> |
| 34 | + |
| 35 | + <script> |
| 36 | + const theme = localStorage.getItem('theme') || 'auto' |
| 37 | + document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme) |
| 38 | + </script> |
| 39 | + |
| 40 | + </head> |
| 41 | + |
| 42 | + <body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference"> |
| 43 | + <header class="bg-body border-bottom"> |
| 44 | + <nav id="autocollapse" class="navbar navbar-expand-md" role="navigation"> |
| 45 | + <div class="container-xxl flex-nowrap"> |
| 46 | + <a class="navbar-brand" href="../index.html"> |
| 47 | + <img id="logo" class="svg" src="../logo.svg" alt="CSF.Screenplay"> |
| 48 | + CSF.Screenplay |
| 49 | + </a> |
| 50 | + <button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation"> |
| 51 | + <i class="bi bi-three-dots"></i> |
| 52 | + </button> |
| 53 | + <div class="collapse navbar-collapse" id="navpanel"> |
| 54 | + <div id="navbar"> |
| 55 | + <form class="search" role="search" id="search"> |
| 56 | + <i class="bi bi-search"></i> |
| 57 | + <input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search"> |
| 58 | + </form> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + </div> |
| 62 | + </nav> |
| 63 | + </header> |
| 64 | + |
| 65 | + <main class="container-xxl"> |
| 66 | + <div class="toc-offcanvas"> |
| 67 | + <div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel"> |
| 68 | + <div class="offcanvas-header"> |
| 69 | + <h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5> |
| 70 | + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button> |
| 71 | + </div> |
| 72 | + <div class="offcanvas-body"> |
| 73 | + <nav class="toc" id="toc"></nav> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + |
| 78 | + <div class="content"> |
| 79 | + <div class="actionbar"> |
| 80 | + <button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents"> |
| 81 | + <i class="bi bi-list"></i> |
| 82 | + </button> |
| 83 | + |
| 84 | + <nav id="breadcrumb"></nav> |
| 85 | + </div> |
| 86 | + |
| 87 | + <article data-uid="CSF.Screenplay.EnumerableResolutionAdapter`1"> |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + <h1 id="CSF_Screenplay_EnumerableResolutionAdapter_1" data-uid="CSF.Screenplay.EnumerableResolutionAdapter`1" class="text-break"> |
| 92 | +Class EnumerableResolutionAdapter<T> <a class="header-action link-secondary" title="View source" href="https://github.com/csf-dev/CSF.Screenplay/blob/master/CSF.Screenplay.Reqnroll/EnumerableResolutionAdapter.cs/#L34"><i class="bi bi-code-slash"></i></a> |
| 93 | + </h1> |
| 94 | + |
| 95 | + <div class="facts text-secondary"> |
| 96 | + <dl><dt>Namespace</dt><dd><a class="xref" href="CSF.html">CSF</a>.<a class="xref" href="CSF.Screenplay.html">Screenplay</a></dd></dl> |
| 97 | + <dl><dt>Assembly</dt><dd>CSF.Screenplay.ReqnrollPlugin.dll</dd></dl> |
| 98 | + </div> |
| 99 | + |
| 100 | + <div class="markdown summary"><p>Adapter class which - when added to DI - permits the BoDi DI container to resolve arbitrary <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable<T></a> of |
| 101 | +service instances.</p> |
| 102 | +</div> |
| 103 | + <div class="markdown conceptual"></div> |
| 104 | + |
| 105 | + <div class="codewrapper"> |
| 106 | + <pre><code class="lang-csharp hljs">public class EnumerableResolutionAdapter<T> : IEnumerable<T>, IEnumerable where T : class</code></pre> |
| 107 | + </div> |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + <h4 class="section">Type Parameters</h4> |
| 112 | + <dl class="parameters"> |
| 113 | + <dt><code>T</code></dt> |
| 114 | + <dd></dd> |
| 115 | + </dl> |
| 116 | + |
| 117 | + <dl class="typelist inheritance"> |
| 118 | + <dt>Inheritance</dt> |
| 119 | + <dd> |
| 120 | + <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div> |
| 121 | + <div><span class="xref">EnumerableResolutionAdapter<T></span></div> |
| 122 | + </dd> |
| 123 | + </dl> |
| 124 | + |
| 125 | + <dl class="typelist implements"> |
| 126 | + <dt>Implements</dt> |
| 127 | + <dd> |
| 128 | + <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></div> |
| 129 | + <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.ienumerable">IEnumerable</a></div> |
| 130 | + </dd> |
| 131 | + </dl> |
| 132 | + |
| 133 | + |
| 134 | + <dl class="typelist inheritedMembers"> |
| 135 | + <dt>Inherited Members</dt> |
| 136 | + <dd> |
| 137 | + <div> |
| 138 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a> |
| 139 | + </div> |
| 140 | + <div> |
| 141 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a> |
| 142 | + </div> |
| 143 | + <div> |
| 144 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a> |
| 145 | + </div> |
| 146 | + <div> |
| 147 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a> |
| 148 | + </div> |
| 149 | + <div> |
| 150 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a> |
| 151 | + </div> |
| 152 | + <div> |
| 153 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a> |
| 154 | + </div> |
| 155 | + <div> |
| 156 | + <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a> |
| 157 | + </div> |
| 158 | + </dd></dl> |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | + <h2 id="CSF_Screenplay_EnumerableResolutionAdapter_1_remarks">Remarks</h2> |
| 164 | + <div class="markdown level0 remarks"><p> |
| 165 | +The BoDi DI container which is included in Reqnroll/SpecFlow does not fully support the functionality of Microsoft's DI standard. |
| 166 | +Notably, it cannot natively resolve an <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable<T></a>, where type T is a service type which may have multiple implementations |
| 167 | +added to/registered with the container. |
| 168 | +BoDi does have conceptually identical functionality, in its <a class="xref" href="https://github.com/reqnroll/Reqnroll/blob/master/Reqnroll/BoDi/IObjectContainer.cs">ResolveAll<T>()</a> function. |
| 169 | +</p> |
| 170 | +<p> |
| 171 | +The purpose of this type is to provide a mechanism by which BoDi may resolve enumerables of service types. |
| 172 | +This class wraps an instance of <a class="xref" href="https://github.com/reqnroll/Reqnroll/blob/master/Reqnroll/BoDi/IObjectContainer.cs">IObjectContainer</a> and - in its <a class="xref" href="CSF.Screenplay.EnumerableResolutionAdapter-1.html#CSF_Screenplay_EnumerableResolutionAdapter_1_GetEnumerator">GetEnumerator()</a> method - redirects to the |
| 173 | +<a class="xref" href="https://github.com/reqnroll/Reqnroll/blob/master/Reqnroll/BoDi/IObjectContainer.cs">ResolveAll<T>()</a> method. |
| 174 | +</p> |
| 175 | +<p> |
| 176 | +The limitation of this type (as a workaround) is that this type must be added to the container manually for each <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable<T></a> |
| 177 | +type which could be resolved from the container. |
| 178 | +</p> |
| 179 | +</div> |
| 180 | + |
| 181 | + |
| 182 | + <h2 class="section" id="constructors">Constructors |
| 183 | +</h2> |
| 184 | + |
| 185 | + |
| 186 | + <a id="CSF_Screenplay_EnumerableResolutionAdapter_1__ctor_" data-uid="CSF.Screenplay.EnumerableResolutionAdapter`1.#ctor*"></a> |
| 187 | + |
| 188 | + <h3 id="CSF_Screenplay_EnumerableResolutionAdapter_1__ctor_Reqnroll_BoDi_IObjectContainer_" data-uid="CSF.Screenplay.EnumerableResolutionAdapter`1.#ctor(Reqnroll.BoDi.IObjectContainer)"> |
| 189 | + EnumerableResolutionAdapter(IObjectContainer) |
| 190 | + <a class="header-action link-secondary" title="View source" href="https://github.com/csf-dev/CSF.Screenplay/blob/master/CSF.Screenplay.Reqnroll/EnumerableResolutionAdapter.cs/#L52"><i class="bi bi-code-slash"></i></a> |
| 191 | + </h3> |
| 192 | + |
| 193 | + <div class="markdown level1 summary"><p>Initializes a new instance of <a class="xref" href="CSF.Screenplay.EnumerableResolutionAdapter-1.html">EnumerableResolutionAdapter<T></a>.</p> |
| 194 | +</div> |
| 195 | + <div class="markdown level1 conceptual"></div> |
| 196 | + |
| 197 | + <div class="codewrapper"> |
| 198 | + <pre><code class="lang-csharp hljs">public EnumerableResolutionAdapter(IObjectContainer container)</code></pre> |
| 199 | + </div> |
| 200 | + |
| 201 | + <h4 class="section">Parameters</h4> |
| 202 | + <dl class="parameters"> |
| 203 | + <dt><code>container</code> <a class="xref" href="https://github.com/reqnroll/Reqnroll/blob/master/Reqnroll/BoDi/IObjectContainer.cs">IObjectContainer</a></dt> |
| 204 | + <dd><p>The BoDi object container.</p> |
| 205 | +</dd> |
| 206 | + </dl> |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + <h4 class="section">Exceptions</h4> |
| 217 | + <dl class="parameters"> |
| 218 | + <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt> |
| 219 | + <dd><p><code class="paramref">container</code> is <code>null</code>.</p> |
| 220 | +</dd> |
| 221 | + </dl> |
| 222 | + |
| 223 | + |
| 224 | + |
| 225 | + <h2 class="section" id="methods">Methods |
| 226 | +</h2> |
| 227 | + |
| 228 | + |
| 229 | + <a id="CSF_Screenplay_EnumerableResolutionAdapter_1_GetEnumerator_" data-uid="CSF.Screenplay.EnumerableResolutionAdapter`1.GetEnumerator*"></a> |
| 230 | + |
| 231 | + <h3 id="CSF_Screenplay_EnumerableResolutionAdapter_1_GetEnumerator" data-uid="CSF.Screenplay.EnumerableResolutionAdapter`1.GetEnumerator"> |
| 232 | + GetEnumerator() |
| 233 | + <a class="header-action link-secondary" title="View source" href="https://github.com/csf-dev/CSF.Screenplay/blob/master/CSF.Screenplay.Reqnroll/EnumerableResolutionAdapter.cs/#L39"><i class="bi bi-code-slash"></i></a> |
| 234 | + </h3> |
| 235 | + |
| 236 | + <div class="markdown level1 summary"></div> |
| 237 | + <div class="markdown level1 conceptual"></div> |
| 238 | + |
| 239 | + <div class="codewrapper"> |
| 240 | + <pre><code class="lang-csharp hljs">public IEnumerator<T> GetEnumerator()</code></pre> |
| 241 | + </div> |
| 242 | + |
| 243 | + |
| 244 | + <h4 class="section">Returns</h4> |
| 245 | + <dl class="parameters"> |
| 246 | + <dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1">IEnumerator</a><T></dt> |
| 247 | + <dd></dd> |
| 248 | + </dl> |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
| 256 | + |
| 257 | + |
| 258 | + |
| 259 | + |
| 260 | + |
| 261 | +</article> |
| 262 | + |
| 263 | + <div class="contribution d-print-none"> |
| 264 | + <a href="https://github.com/csf-dev/CSF.Screenplay/blob/master/CSF.Screenplay.Reqnroll/EnumerableResolutionAdapter.cs/#L34" class="edit-link">Edit this page</a> |
| 265 | + </div> |
| 266 | + |
| 267 | + |
| 268 | + </div> |
| 269 | + |
| 270 | + <div class="affix"> |
| 271 | + <nav id="affix"></nav> |
| 272 | + </div> |
| 273 | + </main> |
| 274 | + |
| 275 | + <div class="container-xxl search-results" id="search-results"></div> |
| 276 | + |
| 277 | + <footer class="border-top text-secondary"> |
| 278 | + <div class="container-xxl"> |
| 279 | + <div class="flex-fill"> |
| 280 | + <span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span> |
| 281 | + </div> |
| 282 | + </div> |
| 283 | + </footer> |
| 284 | + </body> |
| 285 | +</html> |
0 commit comments