This project has moved and is read-only. For the latest updates, please go here.

Feature: expose an interface for custom entity cloning.

Dec 2, 2014 at 6:58 PM
I'm using NMemory in IUnitOfWork+Repository pattern with custom entity model classes. Each model consists of typical db properties and some additional helper-reference type fields (like Lists or Dictionaries). To use NMemory in my project I had to comment VerifyType() method in Table'2.cs and also make some changes in EntityPropertyCloner.

I think it would be a good idea to expose some interface for custom entity cloning and inject it into the tables.
Dec 2, 2014 at 11:39 PM
Edited Dec 3, 2014 at 8:28 AM
You may able to do this right now by implementing a custom TableService and registering it in a custom ServiceProvider that is created by an overwritten ComponentFactory that can be used as Database constructor argument.

Auch, this might seem scary at first :)

I will try to make the cloner injectable. Let me know if you need something to be virtual.
Dec 3, 2014 at 5:29 PM
Edited Dec 3, 2014 at 5:30 PM
Thanks for quick reply :)

There will be a lot of code repeating in your scenario. I have to re-implement DefaultTable and service classes only because of changing cloning algorithm. It is just an architectural issue.

1, In my opinion "IEntityCloner<T, T>" can be injected in DefaultTable constructor.

2. There is also possibility to inject some global non-generic cloner into database object
interface IEntityCloner
    object Clone(object entity);
class MyEntityCloner : IEntityCloner
    public object Clone(object entity)
         if (entity is MyEntityModel)
Mar 20, 2015 at 8:03 PM
I added ability to override the entity cloning with a custom implementation of IEntityService. You can alter type verification here.