anakic/Jot

Forget

Closed this issue · 8 comments

Is there a functionality to forget all or certain settings. I want to implement something like "my.exe -ResetAll" to forget settings.

Sorry for the late reply.

To answer your question: not yet, no. Should not be difficult to implement, though.

I think it should be implemented on two levels:

  • at the IStore level for clearing specific object settings
  • at the IStoreFactory level for clearing settings for all objects

If you have time, I wouldn't mind if you made a pull request with this. If not, that's fine, I'll probably get to it eventually.

Is this feature implemented yet?

No, but I'll get to it in a few days. Will reply back here once it's done.

@swaroopsomanna Just got to this. Solved and pushed a new NuGet package. The tracker now has a Forget(object target) method for forgetting individual target settings and a ForgetAll() for forgetting all saved state. Let me know if this works as expectedfor you.

Will calling forget and forgetAll reset the property values to its factory defaults?

Forget just deletes the saved data. The defaults are specified in the configuration, e.g. if you want to track a Person object and you want their age to be -1 by default (in case no data for that person is saved) you would write tracker.Configure<Person>().Property(p => p.Age, -1).

In short, as long as you specify the default value for a property (factory settings), deleting the stored data will, in effect, reset to factory settings.

Ok I'll try it.
Thanks.

Closing this old issue. There are now Forget(object target) and ForgetAll() methods on the Tracker class.