I've got an extension for all entities:
public static class EntityBaseExtensions
{
public static T Clone<T>(this T item)
where T : EntityBase
{
return item.EntityClone<T>();
}
}
and
public virtual T EntityClone<T>() where T : EntityBase
{
return this.MemberwiseClone() as T;
}
but when i call it like:
var details = user.Details.Clone();
i get
Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
any ideas?
the solution is kinda weird:
public static T Clone<T>(this T item)
where T : SimpleEntityBase
{
return (T)item.EntityClone();
}
and
public virtual object EntityClone()
{
return this.MemberwiseClone();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With