# How to use AutoFactories in StructureMap

DevFeed: [How to use AutoFactories in StructureMap](<https://devfeed.tech/articles/how-to-use-autofactories-in-structuremap-33398.md>)

Original publisher: [Read original article](<https://timkellogg.me/blog/2012/06/12/AutoFactories-In-StructureMap>)

Published: 2012-06-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tim Kellogg](<https://devfeed.tech/sources/tim-kellogg.md>)

Topics: [IoC (Disambiguation)](<https://devfeed.tech/topics/ioc.md>), [Framework](<https://devfeed.tech/topics/framework.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Extension](<https://devfeed.tech/topics/extension.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [framework](<https://devfeed.tech/tags/framework.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>)

## AI overview

This tutorial explains how AutoFactories work in StructureMap. It describes them as interfaces whose implementations are generated by StructureMap, and presents their use in addressing circular dependencies in a plugin framework.

## Source excerpt

While watching the StructureMap discussion on google groups, a user wanted to do AutoFactories in StructureMap, something they were able to do in Castle.Windsor. I didn't know what they were so I had to look through the code plus documentation of the Castle.Windsor feature. It turns out that an AutoFactory is basically a specialized service locator that has no direct dependency on any kind of container. You write an interface that has methods to get instances from the container - but you let StructureMap generate the implementation of this interface. Sound funny? Let me show you...