public void Init() { var registry = new StructureMap.Registry(); //registry.IncludeRegistry<PasswordManagerRegistry>(); _container = new Container(registry); }
private static Container ConfigureContainer() { var registry = new StructureMap.Registry(); registry.IncludeRegistry <RulesRegistry>(); registry.IncludeRegistry <ImportRegistry>(); registry.IncludeRegistry <DefaultRegistry>(); var container = new Container(registry); return(container); }
public void Start() { // I am namespacing one-off uses of the Shuttle.* framework to make it readily // apparent at what stages I am interacting with classes made available from the // use of the library. var structureMapRegistry = new StructureMap.Registry(); var structureMapComponentRegistry = new Shuttle.Core.StructureMap.StructureMapComponentRegistry(structureMapRegistry); Shuttle.Esb.ServiceBus.Register(structureMapComponentRegistry); this._serviceBus = Shuttle.Esb.ServiceBus.Create( new StructureMapComponentResolver( new Container(structureMapRegistry) ) ).Start(); }
public void ScanTypes(StructureMap.Graph.Scanning.TypeSet types, StructureMap.Registry registry) { }
private void GetStructureMapConfig(ConfigurationExpression cfg) { cfg.For <IWindowManager>().Use <WindowManager>().Singleton(); cfg.For <IEventAggregator>().Use <EventAggregator>().Singleton(); cfg.For <ILogger>().Singleton().Use <Logger>(); var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (exeDir != null) { var modDir = Path.Combine(exeDir, "Modules"); var registry = new Registry(); #region MediatR registry // ------- START MediatR Configure ----------------------- // INFO: Пока в этом сканере нет необходимости /* * // используем внешний mediator pattern * registry.Scan(scanner => * { * scanner.TheCallingAssembly(); * //scanner.Assembly(this.GetType().Assembly); // ? * scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<>)); // Handlers with no response * scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<,>)); // Handlers with a response * scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncRequestHandler<>)); // Async handlers with no response * scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncRequestHandler<,>)); // Async Handlers with a response * scanner.ConnectImplementationsToTypesClosing(typeof(INotificationHandler<>)); * scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncNotificationHandler<>)); * }); */ // Scan other assembly modules Regisry Types with DLL like name *Extension.dll registry.Scan(scanner => { if (Directory.Exists(modDir)) { // More examples Scan: // https://github.com/structuremap/structuremap/blob/master/src/StructureMap.Testing/Examples.cs scanner.AssembliesFromPath(modDir, assembly => assembly.GetName().Name.Contains("Extension")); } scanner.WithDefaultConventions(); // Если есть, автоматичесски запускать регистрацию классов производных от Registry scanner.LookForRegistries(); //canner.Convention<ViewRegistrationConvention>(); }); //registry.For<SingleInstanceFactory>().Use<SingleInstanceFactory>(ctx => t => ctx.GetInstance(t)); //registry.For<MultiInstanceFactory>().Use<MultiInstanceFactory>(ctx => t => ctx.GetAllInstances(t)); //registry.For<IMediator>().Use<Mediator>(); // ------- END MediatR Configure ----------------------- #endregion registry.IncludeRegistry <SheduleConfigRegistry>(); registry.IncludeRegistry <SystemTrayIconRegistry>(); cfg.AddRegistry(registry); } }
public PluginGraphBuilder Add(Registry registry) { _graph.ImportRegistry(registry); return(this); }
public Container(Registry registry) : this(registry.Build()) { }
public Container(Registry registry) : this(new PluginGraphBuilder().Add(registry).Build()) { }