The Wayback Machine - https://web.archive.org/web/20200910035753/https://github.com/lorddev/utilities
Skip to content

Multipurpose universal utilities library so you don't have to write your own utils for every project. Includes extensions, encapsulation of logging and encryption, basic datareader-to-POCO mapping, a mailer throttle, and strongly-typed API callers.

master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

README.md

devlord utilities

A useful class library for universal utilities like encryption, sending emails, and consuming RESTful APIs.

Master Develop NuGet Slack
Build status Build status NuGet Package Join the team on Slack

To install Devlord.Utilities, run the following command in the Package Manager Console:

PM> Install-Package Devlord.Utilities

Feature Summary

  • .NET Core compatibility
  • System.Threading.Timers service clocks
  • Email throttling to help you avoid being suspended by your ISP
  • Generic HTTP API wrappers
  • Two-way AES encryption
  • "Micro-ORM" DataReader mapper for when using a full-featured ORM would be overkill

More details below, but for even more details, see the project wiki.

Service Timers

We've provided 3 types of timers for back-end services to execute operations

  • At a certain time
  • At a certain regular interval
  • Continuously, repeating an action as soon as the previous action is complete

ApiCall

The ApiCall class wraps the .NET HttpClient, and returns a deserialized object using Generics. It also features a Dictionary for query parameter input. The WebApiCall subclass will build your endpoint for ASP.NET MVC Web API based on the supplied controller, action, and id as input parameters.

Distance API

POCO classes for accessing the Google Maps distance API.

Usage with a custom JSON contract resolver that converts the Google JSON property names to POCO object properties.

    const string BaseUri = "https://maps.googleapis.com/maps/api/distancematrix/json";

    using (IApiCall client = new ApiCall(BaseUri,
            new JsonSerializerSettings { ContractResolver = new UnderscoreContractResolver() }))
    {
        client.QueryParams.Add("sensor", "false");
        client.QueryParams.Add("origins", "95969");
        client.QueryParams.Add("destinations", "95928");
        IApiResult<dynamic> result = client.Execute<DistanceResults>();
    }

DataManager

A handy generic DataManager abstract base class for your business layer that serves to enforce a CRUD contract between your business entities and your data layer. Useful for pagination as well.

Mailbot

A multithreaded SMTP queued mail sender, has a throttle based on Google Apps maximums for mail frequency sent by a single account.

Crypt

Bidirectional encryption methods useful for storing credit cards or encrypting passwords or API keys to save in a project's configuration files. (Not recommend for use with user's site credentials as those should use one-way encryption.)

RssConverter

This class makes it easy to download an RSS feed and parse it. It reads the data with LinqToXml and can output it in JSON format for easy portability. You can utilize the PostFilter delegate to filter the results even further. (Sorry, I can't remember what project I needed this for.)

DRMapper

Allows mapping of an IDataReader to POCO classes using reflection. It's faster than you might expect.

Pagination

    var query = from a in context.Addresses where a.IsActive select a;
    var results = query.GetPage(pageNumber, pageSize); 

Contributing

Yes, please!

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Contact lorddev on GitHub or @devlords on Twitter.

About

Multipurpose universal utilities library so you don't have to write your own utils for every project. Includes extensions, encapsulation of logging and encryption, basic datareader-to-POCO mapping, a mailer throttle, and strongly-typed API callers.

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.