Click here to Skip to main content
15,898,134 members

Dominic Burford - Professional Profile



Summary

Follow on Twitter LinkedIn      Blog RSS
6,554
Author
2,053
Authority
9,852
Debator
8
Editor
100
Enquirer
212
Organiser
2,954
Participant
I am a professional software engineer and technical architect with over twenty years commercial development experience with a strong focus on the design and development of web and mobile applications.

I have experience of architecting scalable, distributed, high volume web applications that are accessible from multiple devices due to their responsive web design, including architecting enterprise service-oriented solutions. I have also developed enterprise mobile applications using Xamarin and Telerik Platform.

I have extensive experience using .NET, ASP.NET, Windows and Web Services, WCF, SQL Server, LINQ and other Microsoft technologies. I am also familiar with HTML, Bootstrap, Javascript (inc. JQuery and Node.js), CSS, XML, JSON, Apache Cordova, KendoUI and many other web and mobile related technologies.

I am enthusiastic about Continuous Integration, Continuous Delivery and Application Life-cycle Management having configured such environments using CruiseControl.NET, TeamCity and Team Foundation Services. I enjoy working in Agile and Test Driven Development (TDD) environments.

Outside of work I have two beautiful daughters. I am also an avid cyclist who enjoys reading, listening to music and travelling.

 

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
GeneralBuilding ASP.NET Core 2.0 web applications Pin
Dominic Burford21-Mar-18 5:39
professionalDominic Burford21-Mar-18 5:39 
GeneralObtaining the authentication token returned from Azure AD B2C in ASP.NET Core 2.0 Pin
Dominic Burford16-Mar-18 2:03
professionalDominic Burford16-Mar-18 2:03 
GeneralVersioning a .NET Core 2.0 application Pin
Dominic Burford13-Mar-18 2:34
professionalDominic Burford13-Mar-18 2:34 
GeneralThe next generation technical stack Pin
Dominic Burford12-Mar-18 4:43
professionalDominic Burford12-Mar-18 4:43 
GeneralWriting flexible code Pin
Dominic Burford22-Jan-18 23:58
professionalDominic Burford22-Jan-18 23:58 
GeneralA cautionary tale of over-confidence in your own opinions Pin
Dominic Burford22-Dec-17 1:57
professionalDominic Burford22-Dec-17 1:57 
GeneralWhat lies ahead in 2018 Pin
Dominic Burford21-Dec-17 0:18
professionalDominic Burford21-Dec-17 0:18 
GeneralTemplated HTML emails using RazorEngine Pin
Dominic Burford30-Nov-17 4:49
professionalDominic Burford30-Nov-17 4:49 
Following on from my previous article[^] where I described how I used the Azure SendGrid service to send emails, I will now describe how I created the emails themselves. I wanted some way of templating the emails so that I could use a standard layout containing placeholders for information that I would supply at run-time.

In the old days of word-processing, this was called a mail merge. You have a templated document where data is then supplied to fill in the blanks. Instead of a Word document I had an HTML document, but the same principle applies. The HTML document contained placeholders where I would supply data at run-time. These templated HTML documents are called Razor documents.

Razor is a language that lets you create document templates mixing static markup and code. Typically, the static markup is HTML and the code is C# or VB.NET. These can be as simple or as complex as you need. You have the full power of the .NET framework at your disposal, alongside HTML markup and CSS styling, so you can really go to town and create some amazing looking content. A full description of Razor is beyond the scope of this document, but there are planty of resources where you can dig deeper into this technology.

When I initially began looking into using Razor, I wanted the ability to create certain templated layouts using HTML, and then at run-time I would provide data to the layouts. This would allow me to create an HTML document that I could then set as the body of the email.

For the purposes of this article I will use the trivial Razor document I created for my unit test fixtures.
@model Common.Models.EmailRequests.UnitTestModel

<h1>This is a Unit Test Email Razor Template</h1>
<h2>User Details</h2>
<h3>Name: @Model.Name</h3>
<h3>Company: @Model.Company</h3>
<h3>Telephone: @Model.Telephone</h3>

<h2>Car Details</h2>
<h3>Registration: @Model.Registration</h3>
<h3>Description: @Model.Description</h3>
And the corresponding model that is used to supply the data.
namespace Common.Models.EmailRequests
{
    public class UnitTestModel 
    {
        public string Registration { get; set; }
        public string Description { get; set; }
        public string Name { get; set; }
        public string Forename { get; set; }
        public string Surname { get; set; }
        public string Telephone { get; set; }
        public string Company { get; set; }
    }
}
All very simple and straight forward.

The next step then is to actually create a templated document containing real data. During my investigations I came across RazorEngine[^]. This is a templating engine built on Microsoft's Razor parsing engine and allows you to use Razor syntax to build dynamic templates. It gives you a layer of abstraction that makes using the Razor parsing engine extremely simple. It takes care of the necessary mundane chore of compiling and running your template. It can be installed into your Visual Studio project using the nuget package manager. Describing RazorEngine could take up an entire article on its own, so be sure to check out the linked Github page for further information about this excellent tool.

I wrote the following function which uses RazorEngine to create a fully populated Razor document using the specified Razor template and model.
/// <summary>
/// Generate an HTML document from the specified Razor template and model.
/// </summary>
/// <param name="rootpath">The path to the folder containing the Razor templates</param>
/// <param name="templatename">The name of the Razor template (.cshtml)</param>
/// <param name="templatekey">The template key used for caching Razor templates which is essential for improved performance</param>
/// <param name="model">The model containing the information to be supplied to the Razor template</param>
/// <returns></returns>
public string RunCompile(string rootpath, string templatename, string templatekey, object model)
{
    string result = string.Empty;

    if (string.IsNullOrEmpty(rootpath) || string.IsNullOrEmpty(templatename) || model == null) return result;

    string templateFilePath = Path.Combine(rootpath, templatename);

    if (File.Exists(templateFilePath))
    {
        string template = File.ReadAllText(templateFilePath);

        if (string.IsNullOrEmpty(templatekey))
        {
            templatekey = Guid.NewGuid().ToString();
        }
        result = Engine.Razor.RunCompile(template, templatekey, null, model);
    }
    return result;
}
The above function returns a string containing the HTML markup for a fully transformed Razor document. Here's an example of what is returned.
<h1>This is a Unit Test Email</h1>
<h2>User Details</h2>
<h1>Name: Mr Unit Test</h1>
<h1>Company: Unit Test Company</h1>
<h1>Telephone: 01536536536</h1>

<h2>Car Details</h2>
<h1>Registration: UT01UNIT</h1>
<h1>Description: Ford Mustang</h1>
This then becomes the body of the email.

An excellent article that I found very useful was this one[^]. Pay particular attention to Chapter 3 where the author describes the performance gains when caching is implemented. To load a Razor template, as with loading any resource, takes up valuable resources. It can be a relatively slow process if you always load up your templates from disk every time. Far better therefore to cache your Razor templates so that they can be loaded far quicker.

Although I have only described a very simple Razor template and model, the same principles can be applied to far more complex templates. RazorEngine really does take the hard work out of manipulating the Razor parsing engine and if considering using the Razor parsing engine then I would definitely suggest using RazorEngine.

I have now implemented a fully functioning HTML templating engine complete with massively scalable email to send out those emails thanks to Azure SendGrid and Razor.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare

Home | LinkedIn | Google+ | Twitter

GeneralSending emails using Azure Sendgrid service Pin
Dominic Burford29-Nov-17 11:18
professionalDominic Burford29-Nov-17 11:18 
GeneralBuilding native enterprise apps is (probably) the wrong approach Pin
Dominic Burford28-Nov-17 1:05
professionalDominic Burford28-Nov-17 1:05 
GeneralAppropriate vs Consistent Pin
Dominic Burford9-Nov-17 3:24
professionalDominic Burford9-Nov-17 3:24 
GeneralCreating Generic RESTful API Services Pin
Dominic Burford20-Oct-17 5:01
professionalDominic Burford20-Oct-17 5:01 
GeneralIs your software team a democracy or a dictatorship? Pin
Dominic Burford16-Oct-17 21:44
professionalDominic Burford16-Oct-17 21:44 
GeneralSimplifying updating data Pin
Dominic Burford21-Sep-17 22:46
professionalDominic Burford21-Sep-17 22:46 
GeneralWhen 100% code coverage is not always enough Pin
Dominic Burford21-Jul-17 5:11
professionalDominic Burford21-Jul-17 5:11 
GeneralThat's the app in the app stores Pin
Dominic Burford18-Jul-17 5:00
professionalDominic Burford18-Jul-17 5:00 
GeneralDefensive Programming Pin
Dominic Burford28-Jun-17 7:23
professionalDominic Burford28-Jun-17 7:23 
GeneralMy first year - How time flies Pin
Dominic Burford19-Jun-17 1:40
professionalDominic Burford19-Jun-17 1:40 
GeneralShould software architects write code? Pin
Dominic Burford16-Jun-17 4:22
professionalDominic Burford16-Jun-17 4:22 
GeneralEnsuring your data is safe with Azure SQL Database Pin
Dominic Burford2-Jun-17 2:24
professionalDominic Burford2-Jun-17 2:24 
GeneralWhat makes a Senior Software Engineer? Pin
Dominic Burford30-May-17 21:53
professionalDominic Burford30-May-17 21:53 
GeneralMore Software Interview Skills 101 Pin
Dominic Burford25-May-17 6:03
professionalDominic Burford25-May-17 6:03 
GeneralSoftware Interview Skills 101 Pin
Dominic Burford12-May-17 5:44
professionalDominic Burford12-May-17 5:44 
GeneralBeat the Thrashing Pin
Dominic Burford5-May-17 6:03
professionalDominic Burford5-May-17 6:03 
GeneralWorking with Azure Blob Storage Pin
Dominic Burford27-Apr-17 2:29
professionalDominic Burford27-Apr-17 2:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.