Add clone method to EntityExtensions
This commit is contained in:
parent
9209bada7a
commit
339dc635e5
@ -85,6 +85,14 @@ public static class EntitiesExtensions
|
||||
return Serializer.Merge(newEntity, existing, modifier, new StateModifier { State = state }, sources);
|
||||
}
|
||||
|
||||
public static TEntity Clone<TEntity>(this TEntity existing)
|
||||
where TEntity : IEntity
|
||||
{
|
||||
var newEntity = Activator.CreateInstance<TEntity>();
|
||||
|
||||
return Serializer.Merge(newEntity, existing);
|
||||
}
|
||||
|
||||
public static async Task<ImmutableList<TSource>> AsEntities<TSource>(this IQueryable<TSource> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (source is null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user