Halide for ASP.NET/MVC
Simply include the git repo as a submodule in your solution, and add a project reference to it in any other projects. You can also place the project into your solution, but you'll lose the benefit of a single source for Halide updates.
Once you add the project to your solution, be sure to reference it in your code where applicable:
using Fynydd.Halide; using Fynydd.Halide.Constants;
or in Razor views...
@using Fynydd.Halide @using Fynydd.Halide.Constants
Classes and namespaces
Following are the namespaces and classes available in Halide. Classes and properties are documented and should provide Intellisense tips in Visual Studio.
This class has a lot of handy methods for base types, like strings, dates, and numerics. They're all little timesavers that we've used on real projects over the years. For example, there's a method to format a string using AP (Associated Press) title case, a better Trim() function, deep object copying, strip HTML, number formatters, and more.
Caching parts of pages and reusable data is key to a high performing website. This class has helpers for using, clearing, and expiring fragment cache items.
If you need to GZip compress/decompress data, helpers in this class will make it easy. When combined with features in the Storage class you can easily read and write compressed data to disk.
This class makes reading config file properties a single line of code. There's also a helper that uses XPath to retrieve config file data outside of the standard web.config and dependent files (like for reading Umbraco config files)
All Halide constants are kept here, so include this on pages that need them. This includes regular expressions that you can use in your own code.
This powerful class allows simple ways to read data from SQL Server and ODBC/ADO data sources. It leverages the IDisposable interface, so wrapping it in a using statement makes it even easier to use and eliminates the need to manually close a connection. This class also allows you to examine schema.
The Email class provides a way to send email in a variety of formats, with attachments, in a single line of code.
The methods in this class provide a way to easily get the host/domain, identify browsers, perform GET and POST operations on remotes, and even retrieve a remote file and save it to disk. Query string manipulation methods are also included.
This class of static methods provides simple, reliable ways for identifying types of data. You determine if data is currency, pure numeric, a date, a time, an email address, a U.S. state abbreviation, a telephone number, and a lot more. You can also leverage the library of regular expressions in the Constants class and validate formats using simple pattern matching methods like MatchesPattern().
This class provides a simple interface to the standard imaging support in .NET to resize and crop bitmap images server-side.
If you need to perform server-side REST calls, or even just ping a remote server, this class makes it simple. With it, you can perform GET, POST, PUT, PATCH, and DELETE requests.
This class features useful methods for checking for the existence of application keys and their safe removal. No more null checks.
Along with the DataReader class the SQL class provides simple methods for executing stored procedures, reading tables, and generating CSV data.
The temporal class provides easy ways to do complex date/time comparisons across minutes, weeks, quarters, and more. You can also easily format dates and times with simple commands, calculate age, convert date/times to other timezones, pause execution of the main thread, and more. There is also a stopwatch class that's useful for things like timing how long a process is taking.
Need help using this?
If you need help with this or any of our other open source projects, Fynydd can consult with you to get your project moving in the right direction. Just let us know by visiting our contact page where you can reach out or talk to us directly on our free slack community.