Skip to content

Instantly share code, notes, and snippets.

Sébastien Sougnez ssougnez

Block or report user

Report or block ssougnez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wp-handle-document-events-differently-with-udocumenteventhandler-02.cs
public class DocumentEventHandlerRegistration : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Saving += ContentService_Saving;
ContentService.Saved += ContentService_Saved;
ContentService.Publishing += ContentService_Publishing;
}
private void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
View wp-handle-document-events-differently-with-udocumenteventhandler-01.cs
public class DocumentEventHandlerRegistration : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Saving += ContentService_Saving;
}
private void ContentService_Saving(IContentService sender, SaveEventArgs<IContent> e)
{
if (e.SavedEntities.FirstOrDefault().ContentType.Alias == "documentTypeA")
View wp-add-automapper-profile-with-umbraco-02.cs
public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
{
var profiles = GetType()
.Assembly
.GetTypes()
.Where(t => t.BaseType == typeof(Profile))
.Select(t => Activator.CreateInstance(t) as Profile);
foreach (var profile in profiles)
{
View wp-add-automapper-profile-with-umbraco-01.cs
public class AutoMapperHandler : MapperConfiguration
{
public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
{
config.AddProfile(new NewsProfile());
}
}
View wp-read-the-app-settings-with-asp-net-core-05.cs
[Route("api/[controller]")]
[ApiController]
public class MyController : Controller
{
private readonly AppSettings appSettings;
public MyController(IOptions<AppSettings> appSettings)
{
this.appSettings = appSettings.Value;
}
View wp-read-the-app-settings-with-asp-net-core-03.cs
public class AppSettings
{
public string RemoteUrl { get; set; }
public string FunkyParam { get; set; }
}
View wp-read-the-app-settings-with-asp-net-core-02.json
{
"AppSettings": {
"RemoteUrl": "http://foo:8080/",
"FunkyParam": "FunkyValue"
}
}
View wp-automate-umbraco-deployment-with-powershell-21.xml
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="umbracoDbDSN"
connectionString=""
providerName=""
xdt:Transform="SetAttributes"
xdt:Locator="Match(name)" />
</connectionStrings>
You can’t perform that action at this time.