Created
March 10, 2010 22:10
-
-
Save rauhryan/328500 to your computer and use it in GitHub Desktop.
This file contains 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
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