blob: b4c26f414953bee91f183f9dc0770c3fc2bfb290 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Integration.Observables;
/// <summary>
/// Contains <see cref="ObservableEntityBase"/> extension methods.
/// </summary>
public static class ObservableEntityExtensions
{
/// <summary>
/// Performs a shallow cloning of this entity.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="entity">The entity.</param>
/// <returns></returns>
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;
}
}
|