public static IPublication <TPublishedBy> PopulatePublication <TPublishedBy>
            (this IPublication <TPublishedBy> publication, IClockService clock)
            where TPublishedBy : IEquatable <TPublishedBy>
        {
            publication.PopulateCreation(clock);

            publication.PublishedTime      = publication.CreatedTime;
            publication.PublishedTimeTicks = publication.CreatedTimeTicks;

            return(publication);
        }
예제 #2
0
    /// <summary>
    /// 填充创建属性。
    /// </summary>
    /// <typeparam name="TPublishedBy">指定的创建者类型(提供对整数、字符串、GUID 等类型的支持)。</typeparam>
    /// <param name="publication">给定的 <see cref="IPublication{TPublishedBy}"/>。</param>
    /// <param name="newPublishedBy">给定的新创建者。</param>
    /// <param name="newPublishedTime">给定的新创建日期。</param>
    /// <returns>返回 <see cref="IPublication{TPublishedBy}"/>。</returns>
    public static IPublication <TPublishedBy> PopulatePublication <TPublishedBy>(this IPublication <TPublishedBy> publication,
                                                                                 TPublishedBy?newPublishedBy, DateTimeOffset newPublishedTime)
        where TPublishedBy : IEquatable <TPublishedBy>
    {
        publication.PopulateCreation <TPublishedBy>(newPublishedBy, newPublishedTime);

        publication.PublishedTime      = newPublishedTime;
        publication.PublishedTimeTicks = publication.PublishedTime.Ticks;
        publication.PublishedBy        = newPublishedBy;

        return(publication);
    }