Skip to content

Instantly share code, notes, and snippets.

@rauhryan
Created March 10, 2010 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rauhryan/328500 to your computer and use it in GitHub Desktop.
Save rauhryan/328500 to your computer and use it in GitHub Desktop.
using FubuMVC.Core;
using StructureMap;
using VendorYellowPages.Core.Startable;
using VendorYellowPages.Infrastructure.NHibernate;
namespace VendorYellowPages.Web.Infrastructure
{
public static class StructureMapExtensions
{
public static void StartStartables(this IContainer container)
{
using (var nestedContainer = container.GetNestedContainer())
{
nestedContainer.ExecuteInTransaction<IContainer>(c => c.Model.GetAllPossible<IStartable>()
#if !DEBUG
.Where(x => !x.GetType().HasCustomAttribute<DebugOnlyAttribute>())
#endif
.Each(x => x.Start()));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment