I am using interceptors to capture and enrich data (different interceptors) upon Save and SaveAsync with EF Core.
I have a new scenario where i need the data capture and/or enrich to be disabled only for the immediate execution.
Some cases i will disable one, others multiple.
Is there a best practice approach to doing this?
UPDATES re questions:
- Interceptors were implemented to remove the need to think about running this extra logic on every db save/saveasync call. 99.9% of time they are used, 0.1% is the scenario we need to cover now. Clearly separates the business logic from enrichment logic which is used for other reasons.
- Setting property per interceptor means if 2 save processes occur at same time, and the second one is the one thats needs property as false, the first one is impacted by it too
- I have evaluated property based, I am evaluating scoped, separate context hence now seeking general input in regards to best practices
Appreciate those that geniuinely are seeking to help but understanding and ask questions. For those basement dwelling mouthbreathers that are sending stupid messages, please go see a psychiatrist.