ChangeTracking icon indicating copy to clipboard operation
ChangeTracking copied to clipboard

Support for Dictionary

Open officeSpacePirate opened this issue 3 years ago • 4 comments
trafficstars

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?

officeSpacePirate avatar Jun 02 '22 17:06 officeSpacePirate

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.

joelweiss avatar Jun 02 '22 22:06 joelweiss

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.

officeSpacePirate avatar Jun 06 '22 16:06 officeSpacePirate

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.

officeSpacePirate avatar Jun 06 '22 18:06 officeSpacePirate

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

joelweiss avatar Jun 07 '22 20:06 joelweiss