Example #1
0
 public static FubuApplication StructureMapObjectFactory(this IContainerFacilityExpression expression, Action <IInitializationExpression> structureMapBootstrapper)
 {
     return(expression.StructureMap(() =>
     {
         ObjectFactory.Initialize(structureMapBootstrapper);
         return ObjectFactory.Container;
     }));
 }
Example #2
0
        /// <summary>
        /// Uses the StructureMap container built by the specified lambda as the application container. Use this overload if the StructureMap registration
        /// depends on the Bottle scanning (PackageRegistry.PackageAssemblies).
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="createContainer"></param>
        /// <returns></returns>
        public static FubuApplication StructureMap(this IContainerFacilityExpression expression, Func <IContainer> createContainer)
        {
            return(expression.ContainerFacility(() =>
            {
                var container = createContainer();

                return new StructureMapContainerFacility(container);
            }));
        }
 public static FubuApplication Autofac(this IContainerFacilityExpression expression, Func<IComponentContext> createContext)
 {
     return expression.ContainerFacility(
         () =>
         {
             IComponentContext context = createContext();
             return new AutofacContainerFacility(context);
         });
 }
 public static FubuApplication Autofac(this IContainerFacilityExpression expression)
 {
     return expression.Autofac(
         () =>
         {
             var builder = new ContainerBuilder();
             return builder.Build();
         });
 }
        public static FubuApplication StructureMap(this IContainerFacilityExpression expression, Func <IContainer> createContainer)
        {
            return(expression.ContainerFacility(() =>
            {
                var container = createContainer();

                // TODO -- why is this necessary at all?
                ServiceLocator.SetLocatorProvider(() => new StructureMapServiceLocator(ObjectFactory.Container));

                return new StructureMapContainerFacility(container);
            }));
        }
Example #6
0
 /// <summary>
 /// Applies the given StructureMap container as the root container for this FubuMVC application
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="container"></param>
 /// <returns></returns>
 public static FubuApplication StructureMap(this IContainerFacilityExpression expression, IContainer container)
 {
     return(expression.StructureMap(() => container));
 }
Example #7
0
 /// <summary>
 /// Applies a new StructureMap container to the FubuMVC application
 /// </summary>
 /// <param name="expression"></param>
 /// <returns></returns>
 public static FubuApplication StructureMap(this IContainerFacilityExpression expression)
 {
     return(expression.StructureMap(new Container()));
 }
Example #8
0
 /// <summary>
 /// Apply a new StructureMap container for the application using the specified StructureMap Registry
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="expression"></param>
 /// <returns></returns>
 public static FubuApplication StructureMap <T>(this IContainerFacilityExpression expression)
     where T : Registry, new()
 {
     return(expression.StructureMap(() => new Container(new T())));
 }
Example #9
0
 public static FubuApplication StructureMapObjectFactory(this IContainerFacilityExpression expression)
 {
     return(expression.StructureMap(() => ObjectFactory.Container));
 }
 public static FubuApplication Autofac(this IContainerFacilityExpression expression, IComponentContext context)
 {
     return expression.Autofac(() => context);
 }
Example #11
0
 public static FubuApplication Windsor(this IContainerFacilityExpression expression, IWindsorContainer container)
 {
     return(expression.ContainerFacility(new WindsorContainerFacility(container)));
 }