1. Run
1.1. Resolve in one place
1.2. scoping and releasing
1.2.1. implicit (Autofac - lifetimescope.Dispose)
1.2.2. explicit (Windsor - container.Release)
1.2.3. container owns the components - container cleans up after them
1.3. factories for deferred resolve
1.3.1. as alternative to ServiceLocator
1.3.2. explicitly release what you explicitly resolve via the factory
1.3.2.1. be aware of lifestyle/lifetime - know when you can relax this rule
1.4. lifetime layering
1.4.1. shortlived component can depend on long lived components directly
1.4.2. long lived components can depend on short lived components via (long lived) factory
1.4.2.1. release then after you use them
1.4.2.1.1. Windsor: factory.IDontNeedThisAnymore
1.4.2.1.2. Autofac: use Owned<T>
1.5. zombie objects (memory leaks)
1.5.1. components need to be released (directly or indirectly)
2. Development
2.1. LEGO analogy has it backwards
2.1.1. it's not putting bricks together where the fun is - it's building the bricks
2.2. When it's OK to use "new"
2.2.1. what makes a component
2.3. be tidy and consistent
2.3.1. make structure of your project work for you - conventions, conventions, conventions
2.4. Container is not a magic wand or replacement for good design
2.4.1. SOLID
2.4.2. Hollywood principle
2.4.3. DRY
2.5. IoC and Service Locator
2.5.1. Avoid SL
2.5.1.1. Breaks the abstraction
2.5.1.2. Hides dependencies
2.5.1.3. Makes things hard to test
2.5.1.4. Encourages bad behaviour
2.5.2. Avoid abstracting the container (CLS)
2.5.2.1. Has all advantages of SL which it is
2.5.2.2. Lowest common denominator - you give up 95% of container's power
2.6. Be aware of your container's capabilities and utilize them
2.6.1. Features (AOP, startable, strongly typed configuration)
2.6.1.1. the code you don't have to write
2.6.2. Integration with other frameworks/libraries (WCF, NHibernate, log4net)
2.6.2.1. simplifies the code, adds features
3. Start
3.1. registration
3.1.1. XML
3.1.1.1. use mostly for configuration
3.1.2. in code (one by one)
3.1.3. via conventions
3.1.3.1. this should be the default and most common one
3.1.4. you can (and likely will) mix and match all of them
3.1.5. partition registration (installers/modules/registries)
3.1.5.1. one installer per one kind of components
3.1.5.1.1. controllers, repositories
3.1.5.1.2. installer per external framework: NHibernateInstaller
3.1.5.1.3. Name it in such a way it's obvious what it's responsible for
3.1.5.2. Keep all installers in your root project
3.1.5.2.1. that's most likely the only project that will have reference to your IoC container's assembly anyway
3.1.5.2.2. exception - extensions which will have their own installers most likely
3.2. All registration and configuration should happen in one place container.Install
3.2.1. right after you create your container
3.3. one container instance
3.3.1. created at applications start
4. Close
4.1. Call at the end of the app (container.Dispose)
4.2. gracefully shut down entire container
4.3. releases all components (incl. transient)
5. Testing
5.1. registration
5.1.1. right types are registered
5.1.1.1. as right servces
5.1.1.2. properly configured
5.1.2. can be resolved properly