Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:18:47+00:00 2026-05-13T06:18:47+00:00

CodeCampServer source code contains a generic StaticFactory . I’m surmising that this is a

  • 0

CodeCampServer source code contains a generic StaticFactory.

I’m surmising that this is a key piece of the mechanism for how the framework plays well with Dependency Injection.

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.

I’ve not been able to find any documentation for this…

Is there a good explanation in the book? (I’m awaiting delivery from Amazon…)

…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…)?

Update

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 chapter 23).

By default the use of this factory throws an exception:

“the knowledge of how to create the
repository doesn’t reside with the
factory. This factory merely
represents the capability to return
the repository”

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.

“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”

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).

Update 2

Mr Palermo blogged some more about this particular style of Abstract Factory (see the implementaion of OrderShipperFactory).

I could also just consider ‘Manual Dependency Injection’ (Uncle Bob).

Update 3 – March 2016

There’s another example of it here, 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 Composition Root (i.e. at Application Start-up)

I discovered this in Jeffrey’s article “Onion Architecture: Part 4 – After Four Years“

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:18:48+00:00Added an answer on May 13, 2026 at 6:18 am

    Good question. I don’t like it either. It should really be named “StartupFactoryConfiguration”, but it is on the refactor list.

    We played around with that idea as a way to set up DI for places that were not under constructor injection via the container.

    It will go away. I don’t know what the anti-pattern is (what name?), but StaticFactory will die.


    Now it has been renamed as of this morning. It is now AbstractFactoryBase. It is an implementation of the Abstract Factory pattern: http://en.wikipedia.org/wiki/Abstract_factory_pattern

    The implementation of the factory is to end up calling an IoC contrainer, but it allows access from a place in code without an assembly reference to the IoC container assembly.

    Regards,
    Jeffrey Palermo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 304k
  • Answers 304k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's actually very important to dispose Directory Services objects -… May 13, 2026 at 8:51 pm
  • Editorial Team
    Editorial Team added an answer A lot of this depends on how much is involved… May 13, 2026 at 8:51 pm
  • Editorial Team
    Editorial Team added an answer You could take a look at iterative deepening depth first… May 13, 2026 at 8:51 pm

Related Questions

Here's the current layout: Solution: Core Domain Interfaces DataAccess Providers Session Service UI UnitTests
I'm struggling to find a good reference application for ASP.NET MVC. By reference, I
So I'm embarking on an ASP.NET MVC project and while the experience has been
It looks like there are (at least) two options for getting nant to use

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.