Namespace Estrelica.Utility
Classes
Wraps a load delegate in order to defer an expensive load operation until we know it's actually needed (via a call from somewhere else to GetEnumerator()). Ensures that the load method will never be called more than once by holding a local reference to the loaded enumeration for return to future calls to GetEnumerator(), and by substituting an empty T[] result if the loadDelegate happens to return null. Note that this requires the loadDelegate to be parameterless since it cannot be expected to handle different parameters over time. |
Helper methods for working with Guid. |
This exception will be created -- but NOT THROWN -- by the Estrelica.Archer.Utility classes (e.g. APIFacade, DatabaseFacade, etc.) whenever a recoverable exception occurs and the operation is retried. If the caller has registered an ExceptionNotifier (Action<HandledException>) with the class instance (either directly or via a builder), the callback will be invoked with this exception (containing a message about what happened and the exception that occurred as InnerException) so they can log it if desired. |
This class is intended to wrap Dictionary<string,V> objects that are to be serialized, specifically with the Newtonsoft Json serializer (this may apply to other serializers too, but I haven't tested any others to see how they behave). The reason this is needed is because the Newtonsoft serializer emits its JSON based on the order that the KVPs of a dictionary are returned via the dictionary's GetEnumerator() method. This order is typically the same as the order in which objects were added to the dictionary, but that order may change as values are updated or removed, when the GC runs, etc. Regardless, the point is that the order is unpredictable and entirely non-deterministic. This means that two dictionaries having exactly the same key/value pairs added to them may not get serialized identically, making it impossible to compare their JSON representations for object equality later (e.g. if they're stored in a db somewhere). This class addresses this problem by ensuring that every call to GetEnumerator() receives the KVPs ordered by the string key. It will also detect if any of the values in those KVPs are IDictionary<string,V>, and if so, will wrap them with another JsonDictionary<V> before returning, so that sub-dictionaries will also be serialized consistently. |