public ModuleConfigServiceContext( IServiceCollection services, IMiCakeModuleCollection miCakeModules, MiCakeApplicationOptions miCakeApplication) { Services = services; MiCakeModules = miCakeModules; MiCakeApplicationOptions = miCakeApplication; }
public ModuleBearingContext( IServiceProvider serviceProvider, IMiCakeModuleCollection miCakeModules, MiCakeApplicationOptions applicationOptions ) { ServiceProvider = serviceProvider; MiCakeModules = miCakeModules; MiCakeApplicationOptions = applicationOptions; }
/// <summary> /// Add MiCake Core Service /// </summary> /// <param name="services"><see cref="IServiceCollection"/></param> /// <param name="entryModule">Entry point module</param> /// <param name="configOptions">The config for MiCake application</param> /// <param name="needNewScope">New use new service scope to resolve micake core service</param> /// <returns><see cref="IMiCakeBuilder"/></returns> public static IMiCakeBuilder AddMiCake( this IServiceCollection services, Type entryModule, Action <MiCakeApplicationOptions> configOptions, bool needNewScope = false) { MiCakeApplicationOptions options = new MiCakeApplicationOptions(); configOptions?.Invoke(options); return(new DefaultMiCakeBuilderProvider(services, entryModule, options, needNewScope).GetMiCakeBuilder()); }
public void ApplicationOptions_AppointOptions_ShouldNotNull() { Assembly[] assemblies = { GetType().Assembly }; MiCakeApplicationOptions options = new MiCakeApplicationOptions() { DomainLayerAssemblies = assemblies }; MiCakeApplication miCakeApplication = new MiCakeApplication(Services, options, false); Services.AddSingleton <IMiCakeApplication>(miCakeApplication); miCakeApplication.SetEntry(typeof(MiCakeCoreTestModule)); miCakeApplication.Initialize(); var resolvedOptions = Services.BuildServiceProvider().GetService <IOptions <MiCakeApplicationOptions> >(); Assert.NotNull(resolvedOptions); }