|
|
Assemblies
To use Autofac, reference Autofac.dll in your project.
ContainerBuilder can be found in the Autofac.Builder namespace. Register your components with ContainerBuilder then Build() a Container from which you can use them:
var builder = new ContainerBuilder(); builder.Register<Foo>().As<IFoo>(); var container = builder.Build(); var foo = container.Resolve<IFoo>();
.NET 2.0 Support
.NET 2.0 versions using LinqBridge are packaged in a separate zip file available from the Downloads page. If you are targeting .NET 2.0, reference both Autofac.dll and LinqBridge.dll.
Resources
The best way to get started is to pick and mix some articles from the wiki. Component Creation is a good place to start, and you'll need to take a peek at Instance Scope.
Once you're familiar with Autofac, the Best Practices page can help you use it effectively in your applications. Some more advanced articles can be found On the Web.
Building from Source
The source code along with Visual Studio 2008 project files is available here. See the ASP.NET MVC Integration page about dependencies if you want to build that.
Releases of Autofac are created with the included NAnt script - to execute, cd to /src and run:
go.cmd integrate -D:Version=a.b.c.d
Where a.b.c.d is the four part version number you want to build. To build the .NET 2.0 version, insert net20 immediately before integrate on the command-line.
Binaries are output to /src/Build/Lib.
See the Autofac.build file for additional targets and options.
Sign in to add a comment
