Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mookid8000/Rebus
Browse files Browse the repository at this point in the history
  • Loading branch information
mookid8000 committed Oct 9, 2012
2 parents 6d1e636 + 5a12fdc commit 32070e4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Rebus.Autofac/AutofacContainerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void SaveBusInstances(IBus bus, IAdvancedBus advancedBus)
var builder = new ContainerBuilder();
builder.RegisterInstance(bus).As<IBus>();
builder.RegisterInstance(advancedBus).As<IAdvancedBus>();
builder.Register(a => MessageContext.GetCurrent()).InstancePerDependency();
builder.Update(container);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Rebus.Castle.Windsor/WindsorContainerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void SaveBusInstances(IBus bus, IAdvancedBus advancedBus)
.Instance(advancedBus),

Component.For<IMessageContext>()
.UsingFactoryMethod(k => MessageContext.GetCurrent()),
.UsingFactoryMethod(k => MessageContext.GetCurrent())
.LifestyleTransient(),

Component.For<InstanceDisposer>()
);
Expand Down
1 change: 1 addition & 0 deletions src/Rebus.Ninject/NinjectContainerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void SaveBusInstances(IBus bus, IAdvancedBus advancedBus)
{
kernel.Bind<IBus>().ToConstant(bus).InSingletonScope().Named("bus");
kernel.Bind<IAdvancedBus>().ToConstant(advancedBus).InSingletonScope().Named("advancedBus");
kernel.Bind<IMessageContext>().ToMethod(k => MessageContext.GetCurrent()).InTransientScope().Named("messageContext");

// We need to ensure that the kernel have resolved the interfaces once to make it control their lifetime
kernel.Get<IBus>();
Expand Down
1 change: 1 addition & 0 deletions src/Rebus.StructureMap/StructureMapContainerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void SaveBusInstances(IBus bus, IAdvancedBus advancedBus)
{
x.For<IBus>().Singleton().Add(bus);
x.For<IAdvancedBus>().Singleton().Add(advancedBus);
x.For<IMessageContext>().Transient().Use(MessageContext.GetCurrent);
});
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Rebus.Unity/UnityContainerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void SaveBusInstances(IBus bus, IAdvancedBus advancedBus)
{
unityContainer.RegisterInstance(typeof(IBus), bus);
unityContainer.RegisterInstance(typeof(IAdvancedBus), advancedBus);
unityContainer.RegisterType<IMessageContext>(new InjectionFactory(c => MessageContext.GetCurrent()));
}
}
}
10 changes: 8 additions & 2 deletions src/Rebus/Configuration/BuiltinContainerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ public class BuiltinContainerAdapter : IContainerAdapter, IDisposable
{
readonly SimpleHandlerActivator handlerActivator = new SimpleHandlerActivator();

public IBus Bus { get; set; }
/// <summary>
/// Use this property to access the bus instance
/// </summary>
public IBus Bus { get; internal set; }

public IAdvancedBus AdvancedBus { get; set; }
/// <summary>
/// Use this property to access the advanced bus, which is an ordinary bus plus some advanced operations
/// </summary>
public IAdvancedBus AdvancedBus { get; internal set; }

/// <summary>
/// Registers the given handler type. It is assumed that the type registered has a public
Expand Down

0 comments on commit 32070e4

Please sign in to comment.