
As my continued facination with all things SQL Server Modeling related, I was tasked with writing a short article on the introduction of the basics of SQL Server Modeling for the developer. The result is the article "The Busy Developer's Guide to SQL Server Modeling" that was released on MSDN today. It is short so you can get the big details without investing a month learning the technology. Let me know what you think!

This weekend i am headed to Vegas for a week of designer/developer love. I plan to spend a lot of time in the phone sessions as well as in the Commons visiting with people.
This year's MIX has be really excited about both Silverlight 4's continued maturation as well as the XNA/Silverlight 4 story on the phone. I really want to connect with designers who have spent a year with Sketchflow and see how the tool is working in their 'day jobs'.
Not coincidently I am also speaking at MIX this year. My talks are:
Debugging Microsoft Silverlight Applications
Time: Tuesday at 1:30 PM
Location: Lagoon B
Building Silverlight apps is one thing, but what happens when you get stuck? That's where debugging comes into the picture. In this mini-talk, Shawn shows you how to do simple debugging of Silverlight code, debug data binding/validation problems, and how to debug Windows Communication Foundation (WCF) Services.
This is a twenty-five minute talk where I hope to help you figure out some of the debugging mysteries of Silverlight.
Securing Microsoft Silverlight Applications
Time: Tuesday at 3:00 PM
Location: Lagoon F
Come hear how to protect Silverlight applications from common threats including securing your application from intruders, eavesdroppers and users as well as protecting your code, your data and your servers from attacks. Also, hear about the key security vectors that must be considered when using Silverlight such as securing applications that often live outside firewalls.
The Rest of the Time
During the rest of the conference I will be around and at as many parties as possible...it is Vegas after all. If you want to find me, either follow my tweets, my FourSquare checkins or my Glympses (see my Twitter feed for Glympse notifications).
Last fall I visited 0redev in Sweden and gave a "What's New in Silverlight 3" talk. THey've just released the video if you interested in wathcing it:
Shawn Wildermuth - What's New in Silverlight 3 from Øredev on Vimeo.
Now that Silverlight 3 is available, learning all the new features can be a chore. In this talk I will walk through all the new features and show you the most compelling pieces from both Silverlight 3 and Blend 3.

Erik Mork, Brian Henderson and Kelly White are doing a weekly podcast on what is new in the Silverlight community each week. This week they discuss the upcoming rumors about MIX and the plethora of CodeCamps coming up. Check it out (and subscribe):
http://www.sparklingclient.com/silverlight_augmented_reality_and_mix_rumors/

I just got back from the west coast and while there I had the opportunity to speak at the Portland Silverlight Users Group. It was a Q&A session and I had a lot of fun answering those questions. Other than questions I couldn't share information about, the most common questions were about hwo to implement MVVM. I decided to do my 45 minute walkthrough of MVVM and built a simple editor using MVVM. For all of you at the meeting that wanted the source, you can find it here:
http://wildermuth.com/downloads/PortlandGameEditor.zip
I can't wait to be asked back!
I'd recently been asked by Chris Sells to help him with a simple WCF Data Services/jQuery example so I thought I'd share it via my blog as well. The basic idea is to use jQuery's AJAX functionality to retrieve JSON instead of the usual OData and consume it on a web page.
The example I decided on using is to expose the XBox database with paging. I am not doing any of the niceties like getting result counts to show a real navigation bar. Instead this is quick and dirty to simply do "next" and "prev" and use WCF Data Service's URI API to retrieve data.
Like most of my XBox examples, I am using the Entity Framework to simply expose three entities types (Games, Genres and Ratings). Then I utilize a WCF Data Service to expose these types for consumption via REST. My HTML is simple:
<h2>
XBox Games</h2>
<div>
<a href="#" id="PrevPage">Prev</a>
<a href="#" id="NextPage">Next</a>
</div>
<div id="gameTable" />
The gameTable will simply be filled with a simple TABLE element for our data. So to the jQuery we go. I am using plain jQuery 1.3.2 (though plugins could be used to simplify some of this code, I choose to just do it raw for simplicity).
First I set up a couple of variables to hold our paging information:
// globals for paging
var page = 0;
var pagesize = 25;
Next I handle the document's ready function to do some work when the initial page load is complete:
// Loads once the document has completed loading
$(document).ready(function () {
// Set up paging buttons
$('#PrevPage').click(function (evt) {
// Stop the navigation from happening
evt.preventDefault();
if (page > 0) {
page--;
loadData();
}
});
$('#NextPage').click(function (evt) {
evt.preventDefault();
page++;
loadData();
});
// Load the initial data
loadData();
});
When setting up the paging buttins, I use the '#PrevPage' and '#NextPage' CSS selectors to find items named PrevPage and NextPage and wire up the event to cause the page changes to happen. The 'evt.preventDefault()' call stops the buttons from trying to navigate since we're using them as buttons. FInally once we change the current page value, we call loadData (or in the initial case, call loadData with the default values).
function loadData() {
var url = "/GameService.svc/Games?$orderby=Name" +
"&$skip=" + (page * pagesize) +
"&$top=" + pagesize;
$.ajax({
type: "GET",
url: url,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
loadTable(msg.d);
}
});
}
In the loadData function, I first create the URL by using the Data Service/OData URL API to retrieve games by Name while using the global values to retrieve a page of data at a time (see the $skip and $top parameters). Once the URL is defined, jQuery's ajax function executes the URL and returns in the success function in which we call loadTable to create the table for us. Since the returned JSON is contained in a 'd' element for security, we de-reference the 'd' element before we sent it into the loadTable function.
function loadTable(results) {
var table = '<table><thead><tr><th>Name</th>' +
'<th>Publisher</th><th>Box</th></thead><tbody>';
for (var post in results) {
var row = '<tr>';
row += '<td>' + results[post].Name + '</td>';
row += '<td>' + results[post].Publisher + '</a></td>';
row += '<td><img src="' + results[post].ImageUrl +
'" style="width: 100px; height=150px" /></td>';
row += '</tr>';
table += row;
}
table += '</tbody></table>';
$('#gameTable').html(table);
}
Finally in loadTable some simple HTML construction goes on to create a table with our results. The for loop returns a iterator for each row in the collection which we can use to retrieve the individual item (see results[post].Name as an example). Once the table is built, it replaces the contents of the element named gameTable with the new table.
Because WCF Data Services will return JSON as well, you can use it to do AJAX work just as effectively as Silverlight can consume it for rich client work. You can get the code here:
http://wildermuth.com/downloads/DataServiceJQuery.zip
I've said much about my opinion of Silverlight data access. Currently this is Web Services, WCF Data Services and WCF RIA Services. Let's talk about Data Services and RIA Services and how they are related:
WCF Data Services
Data Services are a good story in Silverlight, but only as of version 2.0 of the protocol. For those users of version 1.0, using Data Services was painful as automatic tracking did not exist yet. Data Services can create not only the data contract classes, but a context object that will do tracking and batching for you. The basic story of how Data Services works is that it takes a context object from a LINQ provider and exposes all the IQueryable endpoints as REST resources that can be queried. This works well in creating a place to execute queries and post/put/delete changes. While Data Services' URI API is another skill that could be learned, the Silverlight (and .NET) client library allows you to just issue LINQ queries to the data service. In addition, the ability to create client-designed graphs (e.g. embed relationships for eager loading) and navigate relationships to the server presents a good API for a data-centric application today.
The method for connecting to a data service is via a "Add Service Reference..." which means that it is easy to have data services projects that are outside a particular solution file. This is critical for when you are building very large projects.
One of my favorite things about Data Services today is the ability to create tracked projections from the Silverlight client:
var qry = from g in ctx.Games
where g.ReleaseDate <= cutoffDate
orderby g.ReleaseDate
select new
{
Name = g.Name,
Id = g.Id,
ReleaseDate = g.ReleaseDate
};
This projection (which minimizes the data being sent over the wire from a Games entity), can be tracked like any other entity. This is a big boon for Silverlight clients where we want to reduce the surface area of the data being sent over the wire.
WCF Data Services' standard wire protocol is OData (which is a variant of ATOM). This means that tools like PivotTable, code-name Dallas and others can co-mingle data with other systems that are supporting OData like SharePoint, WebSphere, OpenGovernment project and SQL Azure table storage.
Some of the problems with Data Services include the fact that Service Operations are not part of the Silverlight proxy (and are not completely supported by the client library); any validation attributes of model information (like string length) are left on the client; and having to wrap your collections as DataServiceCollections to support tracking.
While I think Data Services still represents a major case for Silverlight usage, it still has a way to go before I am completely satisfied.
WCF RIA Services
WCF RIA Services takes a different approach to data access the resembles a mix of Data Services and Web Services. In RIA Services a server project is set up to expose data across the wire, but instead of Data Services' approach of exposing queryable end-points, it creates methods on the server which can be executed to retrieve, update, insert and delete data. These methods can be crafted to take specific parameters which takes some of the responsibility for what to query out of the hands of the developer (which may be fine in some cases). RIA Services does take model constraints and validation attributes and generate them in the client, which is a big win. Also, RIA Services is like Data Services in that you can still do basic sorting, filtering and paging via the service.
The way that RIA Services is wired up to a project (via a Shared Code folder that is generated as the server-side project changes) is sexy, but for large projects the need to keep the RIA Services' project in the same solution (or use a project file hack to get it working) becomes an issue.
RIA Services is really built for the RIA Services' DomainContext to be the center of the application (which you can see when you look at demos utilizing their Data Source object that automatically wires up data as XAML elements). While you can write a loosely coupled application, it takes planning and is not the natural design of the API.
Other issue I have is with the design of the Load API where the attempt is made to hide the asynchronicity of the call. The problem is that when errors happen on the load operation, it is hard to capture the error (other than letting it be cause as a top-level exception) so that most users will need to provide a callback which is just like having a full asynchronous operation. No better than before but the principle of least surprise isn't followed.
Finally, in comparison with Data Services, RIA Services has a lot of the same features but is missing the ability to do projections, client-defined eager loading and loading properties (e.g. relationships).
What does all this mean?
So here we sit as Silverlight developers and we are being asked by Microsoft to choose of the three major options for data access. The problem is that none of them are perfect by any stretch of the imagination. I would think that Data Services and RIA Services are both great solutions but they are both missing features the others have. In some ways the generation of these two projects has caused a lot of confusion as to which is the prescribed method for doing data access in Silverlight. It reminds me of the Entity Framework vs. LINQ to SQL debacle.
But where do we go from here? I'd like to implore Microsoft to fast-track the work needed to provide parity in these products. That means build the underpinnings of both projects from the same underlying platform. That way the features of each platform could be included in the other. The features do not become the discrimator but instead it is the style of data access. We want and need the missing features on both platforms:
- "Add Service Reference..." Linkage to support large development projects.
- Exposure and code-generation of any EDMX constraints and Validation attributes.
- Projection and tracked minimizing projection support.
- Full eager loading and navigation support.
- Operations and Endpoints have the same level of support in the generated code.
- Obvious and simple communication APIs to prevent the library from surprising us with error propagation.
...One More Thing
I also have the request that for the next development cycle that we provide secondary methods for communicating validation information than just validation attributes. Validation attributes cause our server-side POCO classes to be not really POCO (since they have to have a reference to the validation assembly). As well as most cases require us to use the painful and hacky MetadataClass method of creating a class to *only* hold these attributes. You don't have to get rid of the attributes, just let us feed them to the model in other ways (open the hooks, we'll decide how to communicate it; whether it be a DSL, XML file, database, etc.).
Your Job
As a reader of this blog, I'd like to ask you a favor. Respond to this blog entry. I want to make sure my frustration with the two data access stacks is not just my annoyance but is causing confusion and pain to you my readers. If you agree, just comment (it can be just saying "I agree") so I can make sure the Data team at Microsoft understands how it impacts Silverlight (and others) development efforts. Thanks!

I've given up on my old Windows Mobile phone and been looking around for a replacement. Now let me be clear, I can't have an iPhone because AT&T is clearly evil. So I decided to take the plunge on an Android phone. I've looked at a couple of the phones, but since I am on Verizon I grabbed the Motorola Droid. Its not bad for $199.
I don't intend to simply put some magic number rating of the phone, but I have some overall observations:
The Good
- The overall initial experience is excellent. I was wow'd from the minute I got the phone.
- I didn't read the manual (though I am not sure it would have helped), but the act of discovery worked really well. I had to get used to how the context menu and the back button worked (and no 'ok' buttons).
- The browser (though not tabbed) is excellent.
- Making phone calls is just great. No more worry about touching my ear to the phone and dialing just works the way I expected it to.
- Taking photos and videos are great. The phone has a better resolution than my point-n-shoot (though I am not sure it takes better pictures).
- I have been impressed by many of the Marketplace's apps. Though I am told not as slick as iPhone apps, I am very happy with most of the apps.
- The Marketplace's reviews and screenshots help a lot to find apps worth getting and their 24 hour return policy is nice. (Ahem...you listening Steam?)
- The GPS and Tower Location work great. It even worked inside my house.
- Google maps and turn by turn directions work well.
- Lots of apps I liked like TripIt, Seismic for Android, Evernote, Fish2Go, gStrings, Guitar Hero, Qik, Pandora, Shazam, YouTube and Steamy Window.
The Bad
- No integration with ActiveSync/Outlook at all. I found a great Sync2 app that would sync my contacts, but I still haven't had any luck syncing my calendar. And there is no sync of tasks whatsoever. I am told that the sync with Exchange is a lot better (I use Outlook but not Exchange). You kinda have to buy into the Google-verse to use the phone IMHO.
- The marketplace has issues. I initially could not download anything for about 1/2 day. I spent most of that time assuming it was my fault. Buying apps was even more painful as my google accounts are Google for Domains accounts. Through trial and error I found out that buying apps didn't work because I didn't have a gmail account. Once that was added, it just worked.
- The phone is very google-fied. You have to have a google account (e.g. gmail) for many of the features.
- No Flash, no Silverlight.
Mixed Bag
- Apps must be installed into internal memory (I think 256MB free), but has a 16GB SD card (upgradable) for other storage like pics.
- Like Windows Mobile, there are apps that run well on some phones and badly on others. You have to read the fine-print to see if the Droid is ok with an app (though Droid is one of the good ones most of the time).
Conclusion?
Since I just got the phone its hard to settle on a real conclusion. After a month with the phone I will have a better idea. Many of the location-aware functionality will either do well or badly in the coming weeks. I am hoping to really put the phone through its paces at the MVP Summit and at MIX. I'll let you know what I think after that.
I am going to be writing a book on Silverlight Architecture. I'd like to get my readers/followers to help me figure out what is most important to write about. Please take the following survey if you don't mind:
http://www.survsoft.com/esurv.php?s=27432&k=12845-0-28970

Since I am never at home anyway, I figured it would make sense to more conferences this year. I love doing talks at these conferences and getting the hard questions from attendees. If you're at any of these events, don't be shy about coming up and saying hi. I'll be at a number of events talking my favorite topics: Silverlight and Data!
Here are the upcoming events:
MIX10
March 15-17, 2010 - Las Vegas, NV
The Designer/Developer/Web conference put on by Microsoft. Always a good time! I will be presenting two talks this year:
- Securing Silverlight
- Debugging Silverlight
(Note that due to overlap between my MVVM Talk and Nikhil Kothari's MVVM talk, I have agreed to switch my talk to one on Silverlight Security).
TechDays Sweden
March 22-23, 2010 - Örebro, Sweden
No, I don't know swedish but I am looking forward to seeing my Svensk fans. Its a great conference with great speakers. I'll be doing one talk at the event:
DevConnections
April 12-14, 2010 - Las Vegas, NV
This is the event where Visual Studio 2010 will be launched. I will be doing a number of talks at this event:
- Building Behaviors for Silverlight 4
- Ninja Data Binding
- Validating Data in Silverlight
- Will It Blend?