Note that there are some explanatory texts on larger screens.

plurals
  1. POIs the StaticFactory<T> in codecampserver a well known pattern?
    primarykey
    data
    text
    <p>CodeCampServer source code contains a generic <a href="http://www.google.com/codesearch/p?hl=en#TBxfyBBQA0E/trunk/src/Core/StaticFactory.cs" rel="nofollow noreferrer">StaticFactory</a>.</p> <p>I'm surmising that this is a key piece of the mechanism for how the framework plays well with Dependency Injection.</p> <p>Subclasses of which use it's DefaultUnconfiguredState to provide static access to, well, a Default Unconfigured State for themselves which the dependency resolution mechanism can replace with working stuff.</p> <p>I've not been able to find any documentation for this...</p> <p>Is there a good explanation in <a href="http://www.manning.com/palermo/" rel="nofollow noreferrer">the book</a>? (I'm awaiting delivery from Amazon...)</p> <p>...or can anyone else provide a good commentary on what this is and whether I'd be wise to adopt this pattern (if it is one...)?</p> <p><strong>Update</strong></p> <p>Since Jeffrey Palermo replied to this question I see that in the (work-in-progress) manuscript for MVC2 in Action this pattern/style is discussed and illustrated using a Factory that is used to locate a Repository in order to keep the domain layer ignorant of persistence concerns. (see <a href="http://groups.google.com/group/mvc2inaction-discuss/browse_thread/thread/134fa8c15ef87f2f" rel="nofollow noreferrer">chapter 23</a>).</p> <p>By default the use of this factory throws an exception:</p> <blockquote> <p>"the knowledge of how to create the repository doesn’t reside with the factory. This factory merely represents the capability to return the repository"</p> </blockquote> <p>The example could have used one of several mechanisms for initializing a concrete implementation of the repository interface. In the example in the book they elect not to use an IOC container for sake of simplicity and provide it explicitly in some start-up logic.</p> <blockquote> <p>"The important thing is that neither the Core project nor the UI project should reference the Infrastructure project or libraries that are purely infrastructural in nature. We have kept NHibernate completely off to the side so that the rest of the application doesn’t care how the data access is happening"</p> </blockquote> <p>A final point to note about the example code in this new chapter is that the Factory is no longer static (at least not as far as the externally facing interface is concerned).</p> <p><strong>Update 2</strong></p> <p>Mr Palermo blogged some more about <a href="http://jeffreypalermo.com/blog/constructor-over-injection-anti-pattern/" rel="nofollow noreferrer">this particular style of Abstract Factory</a> (see the implementaion of OrderShipperFactory).</p> <p>I could also <a href="http://blog.objectmentor.com/articles/2010/01/17/dependency-injection-inversion" rel="nofollow noreferrer">just consider 'Manual Dependency Injection'</a> (Uncle Bob).</p> <p><strong>Update 3 - March 2016</strong></p> <p>There's <a href="https://bitbucket.org/jeffreypalermo/onion-architecture/src/1df2608bc383f99871995207e58885ac65e8a04b/Core/VisitorRepositoryFactory.cs?at=default&amp;fileviewer=file-view-default" rel="nofollow noreferrer">another example of it here</a>, though Jeffrey is explicit about this being demo code, and the comment indicates that this would be configured in what Mark Seeman would call a <a href="http://blog.ploeh.dk/2011/07/28/CompositionRoot/" rel="nofollow noreferrer">Composition Root</a> (i.e. at Application Start-up)</p> <p>I discovered this in Jeffrey's article "<a href="http://jeffreypalermo.com/blog/onion-architecture-part-4-after-four-years/" rel="nofollow noreferrer">Onion Architecture: Part 4 - After Four Years</a>"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload