Windows 8 Metro LOB App .NET 4.5 Category Features with Web API, Entity Framework Code First, Nuget, JSON.NET & Async -Await
September 26, 2012 1 Comment
Since the Asynchrony power of .NET 4.5 , it reveals the capability of building Windows 8 Metro LOB apps with ASP.NET Web API service , Entity Framework Code first support in backend. The Windows 8 Metro Enterprise app blocks keeps running with ASP.NET Web API , MVC 4, WCF Data Services , Azure Mobile Services keeping on backend as data provider model either in JSON or Atom/XML/RSS format.
The Asynchorony pattern on .NET 4.5 keeps the understanding of TPL (Task Parallel Library) with tremendous explore on APM model architecture pattern on C# Async -Await protocols. The HTTP client asynchorony pattern is greatly demandable with async-await styles for any standard clients (Windows 8 Metro Line-Of – Business Apps with POC , Windows Phone etc) implementations keeping Web Service with dataaccess on backend.
Lets have a look on a smart Metro Enterprise app built on ASP.NET MVC 4 Web API services connecting SQL data access with entity frameworks code first approach.
- The app covers the entire .NET Framework 4.5 features from Code Contracts to Task Parallel Library (TPL)
- The app has ASP.NET MVC 4 Web API support as data access strategy with Entity Framework & Code First approach.
Code snippet for FeatureDataSource.cs:
public class FeatureDataSource
{
private static FeatureDataSource _sampleDataSource = newFeatureDataSource();
private ObservableCollection<FeatureDataItem> _items = newObservableCollection<FeatureDataItem>();
public ObservableCollection<FeatureDataItem> Items
{
get { returnthis._items; }
}
public FeatureDataSource()
{
this.Initialize();
}
public static IEnumerable<FeatureDataItem> Get()
{
return _sampleDataSource.Items;
}
public static FeatureDataItem Get(int id)
{
return _sampleDataSource.Items.FirstOrDefault(i => i.Id == id);
}
private async void Initialize()
{
using (var client = newWebBackendClient())
{
List<int> list = await client.Download<List<int>>(“/featuressummary”);
foreach (var i in list)
{
FeatureDataItem feature = await client.Download<FeatureDataItem>(“/featuressummary/” + i);
_items.Add(feature);
}
}
}
}
}
- The Asynchronous Programming Model (APM) has in-built support for Async -Await patterns for non-blocking thread operations & execution of Tasks. The Task Parallel Library is supervized with Data Parallelism & Task Parallelism which is basic coding snippet for Windows Clients HTTP operations (HttpClient,SyndicationClient, Async-Await) from Web API REST or WCF Data Services or Atom/RSS feeds.
- More on Asynchronous Programming Model (APM) pattern for Windows Client (Windows 8 Metro Enterprise Apps, Windows Phone), Windows Azure , Windows Server can be here.
- The Task Parallel Library (TPL) for .NET Framework can be diversified with Data Parallelism, Task Parallelism , Parallel LINQ (PLINQ) support majorly. The Windows 8 Metro Enterprise app blocks is patternized with TPL & Asynchronous platform.
- The Parallel Computing is based on Asynchronous Pattern of Async-Await protocols on HTTPClients , similar way it provides support for web access , image , URL, Web Sockets, Diagnostics API support while it connects with raw WCF services too.
- The Architecture of Task Parallel Library :
- More on Task Parallel Library (TPL) for .NET Framework 4.5 support can be found here.
The Windows 8 Metro LOB app can be found in Windows Store Samples
Pingback: Windows 8 Metro LOB App .NET 4.5 Category Features with Web API, Entity Framework Code First, Nuget, JSON.NET & Async -Await | Windows Azure by Design | Scoop.it