I've been using this package in my project and have come across a specific need. Currently, the package automatically removes all primary keys when cloning an entity. While this is the desired behavior in most cases, in some scenarios, it would be useful to keep certain primary keys intact.
Proposed Feature:
I propose adding an optional options parameter that would allow the users to configure:
Whether to remove primary keys or not (Boolean).
Whether to remove properties based on their value generation strategy using the ValueGenerated enum.
public class CloneOptions
{
public bool RemovePrimaryKeys { get; set; } = true;
public ValueGenerated? RemoveBasedOnValueGenerated { get; set; }
}
Example Usage:
var options = new CloneOptions
{
RemovePrimaryKeys = false,
RemoveBasedOnValueGenerated = ValueGenerated.OnAdd
};
var clonedEntity = await context.CloneAsync(options, 123);
Why this feature would be useful:
This feature would make the package more flexible for a wider range of use-cases. Sometimes, not all primary keys should be treated equally, and having this granular control can be extremely beneficial.
If you find this feature useful, I'd be happy to submit a PR to implement it.
Hello 👋,
I've been using this package in my project and have come across a specific need. Currently, the package automatically removes all primary keys when cloning an entity. While this is the desired behavior in most cases, in some scenarios, it would be useful to keep certain primary keys intact.
Proposed Feature:
I propose adding an optional
options
parameter that would allow the users to configure:Example Usage:
Why this feature would be useful:
This feature would make the package more flexible for a wider range of use-cases. Sometimes, not all primary keys should be treated equally, and having this granular control can be extremely beneficial.
If you find this feature useful, I'd be happy to submit a PR to implement it.