Created
September 13, 2011 10:13
-
-
Save stefansedich/1213534 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void Main(string[] args) | |
| { | |
| var builder = new ContainerBuilder(); | |
| // Register our service bus, this could probably be a module. | |
| builder.Register(c => | |
| ServiceBusFactory.New(sbc => | |
| { | |
| var scope = c.Resolve<ILifetimeScope>(); | |
| //other configuration options | |
| sbc.Subscribe(sbsc => sbsc.LoadFrom(scope)); | |
| }) | |
| ).SingleInstance(); | |
| // Register your consumers, you should probably use a module for this. | |
| builder.RegisterType<YourConsumer>().As<IConsumer>(); | |
| // Create the container | |
| var container = builder.Build(); | |
| } | |
| * We recommend that most of this type of code be placed in an Autofac Module. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment