public static IServiceCollection AddUmbracoHeadlessContentDelivery(this IServiceCollection services, UmbracoConfig umbracoConfig) { services.TryAddSingleton(string.IsNullOrEmpty(umbracoConfig.ApiKey) ? new ContentDeliveryService(umbracoConfig.ProjectAlias) : new ContentDeliveryService(umbracoConfig.ProjectAlias, umbracoConfig.ApiKey)); return(services); }
public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); var umbracoConfig = new UmbracoConfig(); Configuration.GetSection(nameof(UmbracoConfig)).Bind(umbracoConfig); services.AddStazorPagesHeartcore(_webHostEnvironment, umbracoConfig, new TypeResolver()); }
public static ArticulateOptions ArticulateOptions(this UmbracoConfig umbracoConfig) { LazyInitializer.EnsureInitialized(ref _options, () => Options.ArticulateOptions.Default); return(_options); }
/// <summary> /// Gets configuration for personalisation groups. /// </summary> /// <param name="umbracoConfig">The umbraco configuration.</param> /// <returns>The personalisation groups configuration.</returns> /// <remarks> /// Getting the personalisation groups configuration freezes its state, and /// any attempt at modifying the configuration will be ignored. /// </remarks> public static PersonalisationGroupsConfig PersonalisationGroups(this UmbracoConfig umbracoConfig) { LazyInitializer.EnsureInitialized(ref _config, () => PersonalisationGroupsConfig.Value); return(_config); }
/// <summary> /// Gets configuration for Phone Manager. /// </summary> /// <param name="umbracoConfig">The umbraco configuration.</param> /// <returns>The Phone Manager configuration.</returns> /// <remarks> /// Getting the personalisation groups configuration freezes its state, and /// any attempt at modifying the configuration will be ignored. /// </remarks> public static AppSettingsConfig PhoneManager(this UmbracoConfig umbracoConfig) { LazyInitializer.EnsureInitialized(ref _config, () => AppSettingsConfig.Value); return(_config); }
/// <summary> /// Gets the models builder configuration. /// </summary> /// <param name="umbracoConfig">The umbraco configuration.</param> /// <returns>The models builder configuration.</returns> /// <remarks>Getting the models builder configuration freezes its state, /// and any attempt at modifying the configuration using the Setup method /// will be ignored.</remarks> public static Config ModelsBuilder(this UmbracoConfig umbracoConfig) { // capture the current Config2.Default value, cannot change anymore LazyInitializer.EnsureInitialized(ref _config, () => Config.Value); return(_config); }
public static IServiceCollection AddStazorPagesHeartcore(this IServiceCollection services, IWebHostEnvironment env, UmbracoConfig config, ITypeResolver typeResolver) { services.AddUmbracoHeadlessContentDelivery(config); services.AddSingleton <ITypeResolver>(typeResolver); services.AddSingleton <IContentService, HeartcoreContentService>(); services.AddSingleton <HeartcoreCache>(); services.AddStazorPages(env); return(services); }