Sphyrnidae Common Library
2.0.1
Shared Utilities/Library
|
This Nuget package contains numerous helper methods and common functionality useful in any application. To install, you can search Nuget for Sphyrnidae.Common - (Gnu General Public License). The source code is open-sourced, and is located in GitHub: https://github.com/dbartels13/Common This documentation will guide you through all of the utilities available in this package.
API Setup: How to setup your API project
To learn about the Authentication and Authorization (JWT-based) go here
All of the functionality in this library can be broken down into the following categories:
These methods can be directly called without any interface registration. As such, all customization in the behavior of these methods is done via method overloads. All calls to uses these classes/methods are either extension methods, or at static in nature.
Active Directory: Methods for accessing active directory (not currently supported)
BinaryList: Fast searching of a list
Compression: Shrinking a string (eg. serialized object)
Dynamic Sql: Helper for building a complex sql statement
Extension Methods: All kinds of extension methods
Named Locker: Allows items to be locked on a name instead of the same global object
Path and Url Builder: Methods for building URL's or Paths
Retry: Executes something repeatedly until no exception is thrown
SafeTry: Wrapper around try/catch statements, with some automated exception handling
Serialize: Performs de/serialization of either XML or JSON string/objects
Service Locator: Allows injection of any service by injecting a single service instead
These pieces of functionality are abstracted into an interface. From there, a default implementation is usually provided. A mock implementation is also provided. If the default implementation is abstract in nature, there may be a child class which does the rest of the implementation. Lastly, there could be a wrapper class around the interface. This wrapper class is sometimes done for ease-of-use, but is also done if there is specific functionality that should be done for every possible implementation (eg. it wraps the interface call in some helper code)
The following are all base classes available for your consumption. These should always be inherited from because they provide some automatic "wiring" up of things like logging.
It's important to know the naming conventions used for designing your API's. This basically assumes that you have a layered architecture with each layer having a defined responsibility and inputs/outputs. Here are the layers that are portrayed by these base classes: