Skip to content

Commit 24fd284

Browse files
committed
Documentation Update for 4.5.1
1 parent 7453373 commit 24fd284

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

autofactory/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ <h1>Auto-factories <a href="https://github.com/structuremap/structuremap/blob/ma
9595
with implementation
9696
<pre><code class="language-csharp">&#xD;&#xA;public class DummyService : IDummyService&#xD;&#xA;{&#xD;&#xA; public string Name { get; set; }&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;</code></pre>
9797
<p>Now you declare an interface for your factory:</p>
98-
<p class="bg-warning" style="padding:10px"><b>Missing code sample &#x27;ISimpleDummyFactory&#x27;</b><small> -- Wait for dotnet stdocs to catch up reading samples or CTRL&#x2B;SHIFT&#x2B;R to force refresh</small></p>
98+
<pre><code class="language-csharp">&#xD;&#xA;public interface ISimpleDummyFactory&#xD;&#xA;{&#xD;&#xA; IDummyService CreateDummyService();&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;</code></pre>
9999
<p>All you need to do is to call <code>CreateFactory</code> when configuring the container as shown below:</p>
100-
<p class="bg-warning" style="padding:10px"><b>Missing code sample &#x27;simple-factory&#x27;</b><small> -- Wait for dotnet stdocs to catch up reading samples or CTRL&#x2B;SHIFT&#x2B;R to force refresh</small></p>
100+
<pre><code class="language-csharp">&#xD;&#xA;[Fact]&#xD;&#xA;public void Simple_factory_creation()&#xD;&#xA;{&#xD;&#xA; var container = new Container(cfg =&gt;&#xD;&#xA; {&#xD;&#xA; cfg.For&lt;IDummyService&gt;().Use&lt;DummyService&gt;();&#xD;&#xA; cfg.For&lt;ISimpleDummyFactory&gt;().CreateFactory();&#xD;&#xA; });&#xD;&#xA;&#xD;&#xA; var factory = container.GetInstance&lt;ISimpleDummyFactory&gt;();&#xD;&#xA;&#xD;&#xA; var component = factory.CreateDummyService();&#xD;&#xA;&#xD;&#xA; component.ShouldNotBeNull();&#xD;&#xA; component.ShouldBeOfType&lt;DummyService&gt;();&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;</code></pre>
101101
<h2 id="default-convention">Default convention</h2>
102102
<p>As for now, Auto-factories support two types of methods:</p>
103103
<ol>

glossary/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ <h1>Glossary <a href="https://github.com/structuremap/structuremap/blob/master/d
9292
<p>There are some terms that reoccur throughout the documentation and show up in the StructureMap API. Understanding these terms and how they relate to StructureMap isn't a prerequisite to using StructureMap, but it helps.</p>
9393
<h2 id="container">Container</h2>
9494
<p>Tools like StructureMap are generally known as <em>Inversion of Control (IoC) Containers</em> or <em>Dependency Injection (DI) Containers</em>. In the Java world they are also known as <em>Lightweight Containers</em> to differentiate them from the older <em>EJB Containers</em>.</p>
95-
<p>A container is a tool that can help you composing object graphs and managing their scope (lifecycle). Altough you can do Inversion of Control and Dependecy Injection manually, using tools like StructureMap makes you far more productive and succesfull in doing so.</p>
95+
<p>A container is a tool that can help you composing object graphs and managing their scope (lifecycle). Altough you can do Inversion of Control and Dependency Injection manually, using tools like StructureMap makes you far more productive and succesfull in doing so.</p>
9696
<p>Obviously there is more to a container than resolving services and managing their scope, but in the core that's just what it is. Before you can do so you need to tell StructureMap, the container, how it must compose those objects graphs and what their lifecycle is. This is called registration and can be done in various mixed ways. The strongly recommend way would be using the <a href="/registration/registry-dsl">Registry DSL</a>. In your registration you're basically mapping abstractions to concrete types and defining their lifecycle.</p>
9797
<p>A simple example of a container using the <a href="/registration/registry-dsl">Registry DSL</a>:</p>
9898
<pre><code class="language-csharp">&#xD;&#xA;public class FooBarRegistry : Registry&#xD;&#xA;{&#xD;&#xA; public FooBarRegistry()&#xD;&#xA; {&#xD;&#xA; For&lt;IFoo&gt;().Use&lt;Foo&gt;();&#xD;&#xA; For&lt;IBar&gt;().Use&lt;Bar&gt;();&#xD;&#xA; }&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;</code></pre>

0 commit comments

Comments
 (0)