<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace Umbraco.Core.Deploy
{
    /// <summary>
    /// Provides a base class to all artifacts.
    /// </summary>
    public abstract class ArtifactBase<TUdi> : IArtifact
        where TUdi : Udi
    {
        protected ArtifactBase(TUdi udi, IEnumerable<ArtifactDependency> dependencies = null)
        {
            if (udi == null)
                throw new ArgumentNullException("udi");
            Udi = udi;

            Dependencies = dependencies != null ? dependencies.OrderBy(x => x.Udi) : Enumerable.Empty<ArtifactDependency>();
            _checksum = new Lazy<string>(GetChecksum);
        }

        private readonly Lazy<string> _checksum;

        protected abstract string GetChecksum();

        #region Abstract implementation of IArtifactSignature

        Udi IArtifactSignature.Udi
        {
            get { return Udi; }
        }

        public TUdi Udi { get; set; }

        [JsonIgnore]
        public string Checksum
        {
            get { return _checksum.Value; }
        }

        public IEnumerable<ArtifactDependency> Dependencies { get; set; }

        #endregion
    }
}<commit_msg>when modifying dependencies after constructing an artifact they should also be ordered correctly.<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace Umbraco.Core.Deploy
{
    /// <summary>
    /// Provides a base class to all artifacts.
    /// </summary>
    public abstract class ArtifactBase<TUdi> : IArtifact
        where TUdi : Udi
    {
        protected ArtifactBase(TUdi udi, IEnumerable<ArtifactDependency> dependencies = null)
        {
            if (udi == null)
                throw new ArgumentNullException("udi");
            Udi = udi;

            Dependencies = dependencies ?? Enumerable.Empty<ArtifactDependency>();
            _checksum = new Lazy<string>(GetChecksum);
        }

        private readonly Lazy<string> _checksum;
        private IEnumerable<ArtifactDependency> _dependencies;

        protected abstract string GetChecksum();

        #region Abstract implementation of IArtifactSignature

        Udi IArtifactSignature.Udi
        {
            get { return Udi; }
        }

        public TUdi Udi { get; set; }

        [JsonIgnore]
        public string Checksum
        {
            get { return _checksum.Value; }
        }

        public IEnumerable<ArtifactDependency> Dependencies
        {
            get { return _dependencies; }
            set { _dependencies = value.OrderBy(x => x.Udi); }
        }

        #endregion
    }
}
{'fraction_non_alphanumeric': 0.08451228592702904, 'fraction_numerical': 0.0, 'mean_word_length': 2.1099537037037037, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5550040', 'n_tokens_mistral': 736, 'n_tokens_neox': 704, 'n_words': 189}