Mastering WCF RIA Services

clock November 19, 2009 16:10 by author jamesstill

You don't have to use EF with RIA Services. Dinesh Kulkarni demonstrated how to implement a DomainService class using NHibernate.

Kulkarni emphasizes that WCF RIA Services is a prescriptive pattern and that they designed it to be DAL agnostic. Sounds like the Ruby philosophy...

For your DomainService implementation you can add an attribute for an update method to declaritively require that the user be in a certain role:

[RequiresAuthentication]
[RequiresRole("Administrator")]
public void UpdateFoo(SomeEntity entity) {
   
}

This is useful if you want end users to be able to query data without yet logging in but then they have to log in to makes updates.

Best practices to use RIA Services effectively:
 
Do:

* require authentication / roles
* use https in IIS
* utilize query composition (filter, sort, page)
* consider custom update
* factor into multiple DomainService classes and libraries, especially for large apps
* handle errors server-side
* use declarative validation

Don't:

* deploy with anonymous access
* expose non-essential entities/operations
* allow free-form access to data (malicious user problem)
* don't throw everything into one big DomainService class

Unfortunately we ran out of time and he was unable to demonstrate the NHibernate plumbing.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Brad Abrams on RIA Services with EF

clock November 19, 2009 06:26 by author jamesstill

Abrams basically walked through a typical RIA Services app and most of it is familiar to anyone who has studied the RIA Services documentation and walkthrough. However there were several new things specific to VS2010 and the new bits.

RIA Services is now built on top of WCF. Yep, it's a first-class citizen on the stack right next to Workflow Services and Data Services. Brad Abrams said his goal with RIA was to force n-tier dev and to get people into the 21st century. :) That's why (and I'm translating here, he didn't say this) RIA is a prescriptive framework following the 80/20 rule rather than something totally open ended like the vanilla ASP.NET web project template.

The project template is now out of the box in VS2010/.NET 4.0. Also, there's a design view for XAML now. In fact, all the SL controls are on the toolbox and you don't have to edit the XAML at all. My first impulse is one of repulsion -- however, I realize that this is a great time saver for doing a first cut on layout and wiring up controls. You can always go into the XAML and tweak it later.

with a DataGrid and Pager control RIA does not go grab all nn number of rows from the database and bind it to the grid like in early ASP.NET. It takes advantage of LINQ and gets only the rows for the current page. That data is cached locally so if user clicks back arrow to go back to page 1 it's there.

No more XAML exploring. VS2010 has a Document Outline toolbar that shows a visual representation
of the nodes and their hierarchy.

No more rebuilding the RIA Service in order to push the gs file down to the SL client. Changes are reflected right away.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


WCF 4

clock November 19, 2009 06:23 by author jamesstill

You no longer need to describe in detail all of the configuration for endpoints, bindings and protocols. For example, if you wipe out your web.config then basicHttp protocol is used by default. Also, and this is obscure, by default WCF 4 will act as a protocol bridge. If the client request is SOAP 1.1 but the back end service is SOAP 1.2 the bridge will transform the message automatically, which is transparent both to the client and service. In effect then the client can be an old skool app speaking SOAP 1.1 in http and the back end service can be SOAP 1.2 in tcp and no additional endpoints need to be configured. You do need to create a RoutingService to support routing behavior.

Something called "ETW" (also built into Azure AppFabric) is the new direction for instrumentation for IIS, ASP.NET, and WPF as well as apps running in the Azure cloud. For the purposes of WCF 4, it will be possible to instrument the whole call stack and pinpoint exactly which service and contract implementation is the bottleneck.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


VS2010 and MS Deploy

clock November 19, 2009 06:21 by author jamesstill

VS2010 along with the existing project templates for SQL Server 2005/8 will now allow you to configure a complete build package that targets any environment as well as the database. Vishal Joshi did a demo at PDC that was pretty sweet. His blog is http://bit.ly/vijoshi and he has a lot of notes on known issues, release notes, and links to documentation. No longer will it be necessary to get the DBA and the sys admin to coordinate the push to staging or prod.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Silverlight 4 Beta Announced

clock November 18, 2009 05:09 by author jamesstill

Just when I was getting used to SL 3, Scott Guthrie announced today at PDC that SL 4 Beta is now available at silverlight.net. Among the new features he demonstrated:

  • native printing support
  • system clipboard
  • rich-text formatting
  • right-click context menus
  • mousewheel support

He also mentioned that SL 4 "has" MVVM. Hm. Like a project template similar to RIA Services? Or they built it on that pattern? Not sure what he meant. Speaking of RIA it is now a first class citizen in TFS 2010. Also, they made improvements to it and made it a native WCF service. That's pretty sweet. It enables something I've been wanting, namely, the ability to employ service orientation for the middle tier and abstract that away from the caller. If RIA Services is a WCF service then SL can call it, an ASP.NET web page can call it, a mobile device, a portal page, and so on. I hate the idea of middle tier plumbing being compiled over and over again in local APPBASE dirs for each of these clients.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Windows 7 Development

clock November 18, 2009 03:11 by author jamesstill

"Building Windows is like building a movie theatre." Microsoft provides the seats, lobby, screen, and so on and we provide the movie. Windows 7 development: research showed that 55% of Windows 7 beta testers had 1024 x 768 screen resolutions. Really?

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Microsoft PDC09 Keynote Address

clock November 17, 2009 05:09 by author jamesstill

Microsoft announced the new bits at PDC keynote today. The theme? Cloud, cloud, and more cloud. The Azure platform goes into production on Jan 1. In beta through the next several months are new cloud platform tools: AppFabric (previously code named "Dublin") and Endpoint. From what I understand AppFabric provides a unified hosting environment for WCF and Workflow, SQL Azure database caching, and can be configured right in IIS. Endpoint seems to be a discovery service for web services all over the world. You can search it and get all the information you need to consume that data in your application. It probably uses the REST protocol. Microsoft showed a pretty cool demo with the NASA web service that involved showing 3D landscapes of pictures taken by the Mars Rover. You could do a serious mashup in a .NET app with Endpoint.

The CIO of the U.S. government gave a little pep talk about cloud computing. He said the Obama Administration is committed to the cloud and is actively migrating to it now. Honestly, will Multnomah County really spend $3.5 million to build a new DC? Next year, Azure will offer totally configurable VMs in any flavor you want. We could run all of the county DC virtualized on Azure. New apps would plug right in to the cloud environment and legacy stuff could be put on configurable virtual servers in WinOS 2003, 2008, whatever.

Oh and Visual Studio 2010 with .NET Framework 4.0 will be released sometime in Q1 or Q2. The beta is out now and there was some cool stuff in it. You can drag a code pane over to your other monitor, debugging is beefed up, and unit tests write themselves at run time. Other stuff but it went pretty fast.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


About

SquareWidget LLC is an Oregon-based software development company that specializes in handcrafted .NET software solutions.

Search

Archive

Categories


Sign in