diff --git a/src/Connected.Entities/EntitiesExtensions.cs b/src/Connected.Entities/EntitiesExtensions.cs index fca3f4a..8be8e28 100644 --- a/src/Connected.Entities/EntitiesExtensions.cs +++ b/src/Connected.Entities/EntitiesExtensions.cs @@ -85,6 +85,14 @@ public static class EntitiesExtensions return Serializer.Merge(newEntity, existing, modifier, new StateModifier { State = state }, sources); } + public static TEntity Clone(this TEntity existing) + where TEntity : IEntity + { + var newEntity = Activator.CreateInstance(); + + return Serializer.Merge(newEntity, existing); + } + public static async Task> AsEntities(this IQueryable source, CancellationToken cancellationToken = default) { if (source is null)