takenet/elephant

Question: How do you retrieve the key value pair in a different event once it is saved?

tmosson1 opened this issue · 2 comments

So I am struggling to find in the tests and samples on how to do this.

My application is a C# winform application in .NET Framework 4.8.

So I am storing image viewer settings in the form using Takenet.Elephant.Memory.

So after the ISetMap is set when the image is loaded in the viewer, I want to be able to retrieve information specific to the user like the cursor handle, zoom factor, etc. on another event (i.e. button click event).

All the examples create the ISetMap and get the contents all in the same execution.

How can I retrieve the ISetMap on a button click event so I can set or get values on the image viewer settings?

Hello @tmosson1.

On your event handler, if you have a reference to the ISetMap instance and to the key in which you stored the relevant settings, you just need to call GetValueOrDefaultAsync or GetValueOrEmptyAsync.

Elephant is meant for use cases that involve abstracting storage & data structures over different database systems, such as Redis and Sql Server. However, based on your description - especially since you only mention that you're using our in-memory implementations - it seems that you would be better off using the .NET base library collections, such as Dictionary<TKey, TValue> and/or HashSet<T>. If that's the case, your question would be better answered on Stack Overflow.

If, however, you do have an use case that would necessitate Elephant, feel free to post code so that we can better help you.

Closing since there has been no activity for three months.