joelweiss/ChangeTracking

Support for Dictionary

Opened this issue · 4 comments

I read though the issues that have been logged already and caught one or two spots where you've mentioned the library doesn't support tracking Dictionary types. One of the teams I work on uses Dictionary's regularly and it's the only hold up from using what you've built. Out of curiosity, is there a reason that support couldn't be added?

I can not remember off the top of my head if there was in issue implementing support for IDictionary, but I haven't found the need.

We use IDictionary often because of the performance benefits and it would be difficult to convert all of them to arrays, IList, etc. just for tracking changes; especially since we have a lot of existing data. Would you be opposed to adding support? I could also take a look at contributing the changes.

Actually, it looks like you've already done most of the work if we consider objects like Tuple or KeyValuePair as well. We could create something like a ChangeTrackingMultipleGenericTypesInterceptor to follow the pattern you're implementing and then leverage that Dictionary implements IEnumerable<KeyValuePair<TKey,TValue>>. I think it could be handled at a high level and then your other interceptors could be reused for everything that's nested.

I am not opposed to adding support, but I do not have time at the moment.