aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ObservableEntityExtensions.cs
blob: b5b767d12cfb80e83be285d3e820bfacba6ed2f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.DAL.Observables;

public static class ObservableEntityExtensions
{
    public static T CloneEntity<T>(this T entity) where T : class, IObservableEntity
    {
        T cloned = entity.ShallowClone();
        cloned.ID = 0;
        cloned.Guid = Guid.NewGuid().ToString();
        cloned.LastUpdated = DateTime.UtcNow;
        return cloned;
    }
}