Welcome!

Open Source Cloud Authors: Elizabeth White, Zakia Bouachraoui, Liz McMillan, Pat Romanski, Yeshim Deniz

Related Topics: Open Source Cloud, Microsoft Cloud, Machine Learning

Open Source Cloud: Article

Silverlight and Astoria - First Impressions

In short, an Astoria service is a WCF service that sits on top of an Entity Model that allows you to hit services with URLs

Kevin Hoffman's Blog

As you know, Silverlight is a new RIA enabling technology from Microsoft. Slightly less publicized but no less impactful is another technology from Microsoft - Astoria. Astoria is a tool that combines the power of the ADO.NET Entity Framework with the new enhanced power of RESTful POX services using WCF. In short, an Astoria service is a WCF service that sits on top of an Entity Model that allows you to hit services with URLs that look something like this:

http://server/service.svc/Customers/Orders[TotalAmount>25.50]

This will return a bunch of XML corresponding to all of the customer orders that have a total amount greater than $25.50. The syntax / query format of the URL itself is one of the things that makes the Astoria service so unbelievably powerful. You can sort, filter, limit, and paginate all from the URL itself, making client implementations incredibly easy, and incredibly well-suited to lightweight GUI frameworks like AJAX or Silverlight.

To keep it short and simple, here's what I did (using the "Orcas" beta 1 w/Silverlight toolkit installed AND Astoria toolkit installed):

  1. Create a new ASP.NET Web Application. Warning!! - I couldn't get this to work unless I created this using File -> New -> Project -> ASP.NET Web Application. For some reason, the current beta of Silverlight/Astoria have compatibility issues with File -> New -> Website.
  2. Right-click the ASP.NET Web Application and choose "Add new item", then pick "ADO.NET Entity Data Model". In my case, I generated it from an existing database that had a couple of sample tables, including a Ledger table containing transactions.
  3. Right-click the ASP.NET project and choose "Add new item". Pick "Web Data Service". Make sure it has the word data in it, otherwise you're going to get a vanilla Web Service and not an Astoria Web Service. There's a huge difference.
  4. Double-click your .svc.cs file and change the TODO item from a TODO comment to the actual classname of the object context created in step 2. In my case, this was FinanceManager.FinanceModel.
  5. Right-click the solution and choose "Add new Project", select "Silverlight Project".
  6. At this point, you should have a solution with a Silverlight project (make sure this builds), and a file-based ASP.NET web application that contains an entity data model. You should also have an Astoria service sitting on top of your EDM. To test things out before integrating Silverlight, build and run your app and hit the Astoria service, e.g. http://server/service.svc/tablename. You should get some XML showing you the contents of the table. If not, something went horribly wrong :) :)
  7. Now right-click the ASP.NET file-based web application and choose "Add Silverlight link". This will set your solution up so that your Silverlight app's DLL and any dependent DLLs will be copied to the client binary output directory of the ASP.NET application. You are not done!
  8. Drag a copy of silverlight.js from your Silverlight app to the ASP.NET app (you'll see why this is crucial shortly)
  9. Drag your TestPage.html file from the Silverlight app to your ASP.NET app. The reason you need to do this is because you will now be launching your Silverlight app from the ASP.NET app, not from the original Silverlight app location. This is because Silverlight cannot currently make cross-domain networking calls and you need to communicate using the BrowserWebHttpRequest object with the Astoria service.
  10. Now add some GUI to your Silverlight app, make a button responder, do some asynchronous stuff - all goodies you can find quick and dirty samples for elsewhere. Use the XmlReader object to consume the raw (no envelopes!! Down with WSDL!!) XML produced by the Astoria service.

In the end, I ended up with some "smoke test" (read: not yet pretty-fied) GUI that grabs Ledger entities from the Astoria service and uses the "ListBox" sample control from the SDK to do the rendering.

The transaction ID numbers and transactions actually came from my financial ledger service, which is an Astoria service sitting on top of an Entity Data Model.  

More to come!!

tags:    
links: digg this  del.icio.us  technorati  reddit

More Stories By Kevin Hoffman

Kevin Hoffman, editor-in-chief of SYS-CON's iPhone Developer's Journal, has been programming since he was 10 and has written everything from DOS shareware to n-tier, enterprise web applications in VB, C++, Delphi, and C. Hoffman is coauthor of Professional .NET Framework (Wrox Press) and co-author with Robert Foster of Microsoft SharePoint 2007 Development Unleashed. He authors The .NET Addict's Blog at .NET Developer's Journal.

Comments (1)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected pat...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.
The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
DSR is a supplier of project management, consultancy services and IT solutions that increase effectiveness of a company's operations in the production sector. The company combines in-depth knowledge of international companies with expert knowledge utilising IT tools that support manufacturing and distribution processes. DSR ensures optimization and integration of internal processes which is necessary for companies to grow rapidly. The rapid growth is possible thanks, to specialized services an...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...