public static void UseAutofac(this RocketApplicationCreationOptions options) { var builder = new ContainerBuilder(); options.Services.AddObjectAccessor(builder); options.Services.AddSingleton((IServiceProviderFactory <ContainerBuilder>) new RocketAutofacServiceProviderFactory(builder)); }
internal RocketApplicationBase( [NotNull] Type startupModuleType, [NotNull] IServiceCollection services, [CanBeNull] Action <RocketApplicationCreationOptions> optionsAction) { Check.NotNull(startupModuleType, nameof(startupModuleType)); Check.NotNull(services, nameof(services)); StartupModuleType = startupModuleType; Services = services; services.TryAddObjectAccessor <IServiceProvider> (); var options = new RocketApplicationCreationOptions(services); optionsAction?.Invoke(options); services.AddSingleton <IRocketApplication> (this); services.AddSingleton <IModuleContainer> (this); services.AddCoreServices(); services.AddCoreRocketServices(this, options); Modules = LoadModules(services, options); }
private IReadOnlyList <IRocketModuleDescriptor> LoadModules(IServiceCollection services, RocketApplicationCreationOptions options) { return(services .GetSingletonInstance <IModuleLoader> () .LoadModules( services, StartupModuleType, options.PlugInSources )); }