This is a talk I gave at the spring 2013 AngleBrackets/DevIntersection conference in Las Vegas.
HTML5 is all the rage these days but where do you look to find robust examples of using it along with jQuery, client-side templates, Ajax calls, data access technologies, and more? In this session, Dan Wahlin will walk through an application that demonstrates how key HTML5 technologies can be integrated and used to present data to users in different ways. Topics covered include exposing data to the client using RESTful services created using the new ASP.NET Web API, using Handlebars templates to render data, JavaScript techniques for structuring code, the role of HTML5 semantic tags, as well as how technologies such as the canvas, SVG, and video can be used. If you want to learn server-side as well as client-side techniques and strategies then this session is for you.
16.
public class Stock : Security
{
public decimal DayHigh { get; set; }
public decimal DayLow { get; set; }
public decimal Dividend { get; set; }
public decimal Open { get; set; }
public decimal Volume { get; set; }
//Code removed for brevity
}
17.
public class SecurityRepository :
RepositoryBase<AccountAtAGlance>, ISecurityRepository
{
public Security GetSecurity(string symbol) {...}
public List<TickerQuote> GetSecurityTickerQuotes() {...}
public OperationStatus UpdateSecurities() {...}
public OperationStatus InsertSecurityData() {...}
}
18. public class AccountRepository :
RepositoryBase<AccountAtAGlance>, IAccountRepository
{
public Customer GetCustomer(string custId)
{
using (var context = DataContext)
{
return context.Customers
.Include("BrokerageAccounts")
.Where(c => c.CustomerCode ==
custId).SingleOrDefault();
}
}
}
ASP.NET Web API provides a framework for buildingRESTful services that can cater to a variety of clients. You can think of it as a gateway into your business rules and data access classes that can serve up different data formats ranging from JSON to XML to custom formats.Standard ASP.NET MVC returns HTML from views on the server. With ASP.NET Web API, JSON data (and other types of data) can be returned to Ajax clients. By using it you can easily serialize model objects to JSON with a minimal amount of code. In this section you'll learn more about the ASP.NET Web API and how it is used in the Account at a Glance application.
Although templates can be embedded directly in a webpage, the Account at a Glance application stores the majority of the templates in separate HTML template files on the server and downloads them dynamically to minimize the initial size of the homepage. A script named scene.tile.binder.js is responsible for downloading templates, compiling them, and binding data into them.