This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IConfigurationSection mySettingsSection = builder.Configuration.GetSection("MySettings"); | |
builder.Services.Configure<MySettings>(mySettingsSection); | |
services.PostConfigure<MySettings>(options => | |
{ | |
if(!options.MyOptions.Any(x => x.Alias == "itemOne")) | |
{ | |
options.MyOptions.Add(new MyOption { Alias = "itemOne", Value = 0 }); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MySettings | |
{ | |
public List<MyOption> MyOptions { get; set; } = new List<MyOption> | |
{ | |
new MyOption { Alias = "itemOne", Value = 0 }, | |
new MyOption { Alias = "itemTwo", Value = 0 }, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"MySettings": { | |
"MyOptions": [ | |
{ | |
"Alias": "itemOne", | |
"Value": 1, | |
}, | |
{ | |
"Alias": "itemTwo", | |
"Value": 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MySettings | |
{ | |
public List<MyOption> MyOptions { get; set; } | |
} | |
public class MyOption | |
{ | |
public string Alias { get; set; } | |
public int Value { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Umbraco.Cms.Core.Events; | |
using Umbraco.Cms.Core.Models; | |
using Umbraco.Cms.Core.Notifications; | |
using Umbraco.Cms.Core.Services; | |
using Umbraco.Cms.Core.Sync; | |
namespace Umbraco.Deploy.OnPrem.TestSite.Business | |
{ | |
public class DictionaryCacheRefresherNotificationHandler : INotificationHandler<DictionaryCacheRefresherNotification> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Umbraco.Core.Services | |
@using Umbraco.Core | |
@using Umbraco.Core.Deploy | |
@inherits Umbraco.Web.Mvc.UmbracoViewPage | |
@using Umbraco.Web.Models | |
@{ | |
Layout = "Master.cshtml"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@* | |
Demonstration of using the Umbraco Forms 13 API for retrieving the definition of a form, rendering it and posting an entry. | |
It's based off an Umbraco content item with a property with alias "Form", of type "Form Picker". | |
*@ | |
@using Microsoft.AspNetCore.Antiforgery | |
@using Microsoft.Extensions.Options; | |
@using Umbraco.Cms.Web.Common.PublishedModels; | |
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.AJaxformPage> | |
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddUmbraco(_env, _config) | |
.AddBackOffice() | |
.AddWebsite() | |
.AddComposers() | |
.Build(); | |
services.AddMyLibrary(); | |
services.ConfigureOptions<MyConfigureOptions>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Options; | |
using Umbraco.Cms.Web.Common.ApplicationBuilder; | |
namespace MyApp | |
{ | |
public class MyConfigureOptions : IConfigureOptions<UmbracoPipelineOptions> | |
{ | |
public void Configure(UmbracoPipelineOptions options) | |
{ | |
options.AddFilter(new MyPipelineFilter()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Builder; | |
using Umbraco.Cms.Web.Common.ApplicationBuilder; | |
namespace MyApp | |
{ | |
public class MyPipelineFilter : UmbracoPipelineFilter | |
{ | |
public MyPipelineFilter() : base(nameof(MyPipelineFilter)) | |
{ | |
PostPipeline = app => |