Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Designing Better Web APIs with Breeze Server

Breeze.js is a popular library that helps manage business data objects from rich JavaScript client applications.



Breeze.js is a fairly popular JavaScript library (in quite a long list) that helps you manage business data objects from rich JS client applications. The origins of the library first surfaced during the Silverlight days where it gained popularity in seamless integration with LINQ. Since the creators come from the .NET background, Breeze.js suitably provided a server side, where it enhanced the capabilities of HTTP services in the form of Web API.

The ASP.NET Web API is very powerful in creating HTTP Services. While using Web API you have two approaches for creating HTTP Services. The first approach is creating controllers for each Entity having four methods representing the CRUD operations using the HTTP verbs. This follows the RESTFul approach. Another option is to use OData services that allow clients to create their own queries and use Web API to execute them on the data store.

If you are building services using Web API which are idiosyncratic in nature, then you need to provide outside-the-band metadata information to your consumers about your API design. This is where Breeze Server can be very useful. You can use Breeze to design robust APIs and Breeze will create and expose metadata for your controller.

Install Breeze

To use Breeze Server, you need to use a couple of nuget packages as shown in the screen print below:

This is assuming that you will use Entity Framework as your data access layer. Alternatively you can also use it with NHibernate.

Configure Breeze

Now that you have installed Breeze, you can start configuring your Controller and API methods with Breeze. For every controller, you can use the BreezeController attribute to indicate a Breeze Controller class. Breeze also provides the EFContextProvider class that encapsulates EF DbContext into controlling the CRUD operation behaviour and providing the metadata for the operations.

In the next blog post we will see how the Web API controllers are manipulated by a Breeze Server implementation and explore its true power.

Sandeep Chanda is a Director of Solutions at Neudesic, a Microsoft National Systems Integrator and Gold Certified Partner. He has been working on several Microsoft Technologies (including but not limited to .NET, Azure, BizTalk, SharePoint and Dynamics CRM) for the past ten years, building large scale enterprise applications spanning multiple industries. He is a technology enthusiast and a speaker at various corporate events and public webinars. He has authored several articles on Microsoft Dynamics CRM 4.0 in DevX, and is the Author of the books Windows Identity Foundation Cookbook by PacktPub, and Beginning ASP.NET 4.5 Databases by Apress. Most recently he has been involved in evangelizing aspects of Application Lifecycle Management (ALM) and developer collaboration using Team Foundation Server 2012 and was the speaker on the subject at the Great Indian Developer Summit 2012. He is currently co-authoring a book on Dynamics CRM Marketing Automation with PacktPub. Sandeep holds an MS degree in Software Systems from BITS, Pilani and his areas of interest include Service Oriented Computing, Cross Platform Mobility, Pervasive Computing, Haptic Devices and Cloud Computing.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date