Fixing CreateMemember and CreateContent to raise events and logging only when we persist the objs not when we only create them

This commit is contained in:
Elitsa Marinovska
2021-02-01 16:07:42 +01:00
parent 6df67cd93e
commit 5cd28c8711
4 changed files with 140 additions and 88 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
@@ -39,6 +39,21 @@ namespace Umbraco.Core.Models
: this(name, parent, contentType, new PropertyCollection(), culture)
{ }
/// <summary>
/// Constructor for creating a Content object
/// </summary>
/// <param name="name">Name of the content</param>
/// <param name="parent">Parent <see cref="IContent"/> object</param>
/// <param name="contentType">ContentType for the current Content object</param>
/// <param name="userId">The identifier of the user creating the Content object</param>
/// <param name="culture">An optional culture.</param>
public Content(string name, IContent parent, IContentType contentType, int userId, string culture = null)
: this(name, parent, contentType, new PropertyCollection(), culture)
{
CreatorId = userId;
WriterId = userId;
}
/// <summary>
/// Constructor for creating a Content object
/// </summary>
@@ -66,6 +81,21 @@ namespace Umbraco.Core.Models
: this(name, parentId, contentType, new PropertyCollection(), culture)
{ }
/// <summary>
/// Constructor for creating a Content object
/// </summary>
/// <param name="name">Name of the content</param>
/// <param name="parentId">Id of the Parent content</param>
/// <param name="contentType">ContentType for the current Content object</param>
/// <param name="userId">The identifier of the user creating the Content object</param>
/// <param name="culture">An optional culture.</param>
public Content(string name, int parentId, IContentType contentType, int userId, string culture = null)
: this(name, parentId, contentType, new PropertyCollection(), culture)
{
CreatorId = userId;
WriterId = userId;
}
/// <summary>
/// Constructor for creating a Content object
/// </summary>