public void CreateModelBinder()
 {
     var container = new StructureMapContainer();
     IFeature coreServices = new Dolstagis.Web.Lifecycle.CoreServices();
     coreServices.ContainerBuilder.SetupApplication(container);
     binder = container.Get<ModelBinder>();
 }
示例#2
0
 public override IContainer CreateAndConfigureContainer(GetLoggerDelegate getLoggerDelegate, 
     IDictionary<Type, Func<IDataAccessContext, IDataContext>> createDataContexts)
 {
     structureMapContainer = Configure.CreateAndConfigureContainer(getLoggerDelegate,
         createDataContexts, container => container.Configure(c =>
             c.SetAllProperties(s => s.TypeMatches(type => container.Model.HasImplementationsFor(type)))),
         additionalRegistries.Concat(new[] { new CommonRegistry() }).ToArray());
     return structureMapContainer;
 }
示例#3
0
        private static void InicializadorInyectorDependencia()
        {
            var ioc = new StructureMapContainer();

            ioc.Configure();

            new StructureMapDependencyResolver(ObjectFactory.Container);
            new StructureMapFilterProvider(ObjectFactory.Container);
        }
    static IFetchDependencies create_container()
    {
      var structure_map_container = new Container(base_config);
      var container = new StructureMapContainer(structure_map_container);

      structure_map_container.Configure(x =>
      {
        x.ForSingletonOf<IFetchDependencies>().Add(context => container);
        x.ForSingletonOf<IContainer>().Add(context => structure_map_container);
      });

      return container;
    }
示例#5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var container = new StructureMapContainer();

            var config = Configuration.Default(container);

            GetAssemblies().ForEach(a => config.Register(a));

            config.DefaultShowAs("window").SetViewBinder(new WpfViewBinder());
            config.SetErrorPresenter<ErrorPresenter>();
            config.AddPresenter<WindowPresenter>();
            config.AddPresenter<MdiPresenter>();

            "open routelog".Send();
            "request login".Send();
        }
示例#6
0
文件: Program.cs 项目: wbinford/nu
        static void Start(IContainer container, Action<ExtensionInitializer> initializeAction)
        {
            _log.Debug("Parsing command line");

            IEnumerable<Command> commands = CommandLine.Parse<Command>(init =>
                {
                    var containerConfigurator = new StructureMapContainerConfigurator(container);
                    var containerAccess = new StructureMapContainer(container);

                    container.Configure(x =>
                        {
                            x.For<core.Container>().Singleton().Use(containerAccess);
                            x.For<ContainerConfigurator>().Singleton().Use(containerConfigurator);
                        });

                    var initializer = container.With(init).GetInstance<StructureMapExtensionInitializer>();

                    initializeAction(initializer);
                }).ToArray();

            if (commands.Any())
            {
                ExecuteCommands(commands);
            }
            else
            {
                _log.Warn("No commands specified");
            }
        }
示例#7
0
 static InversionControl()
 {
     Current = new StructureMapContainer();
 }