Rico Suter's blog.
 

Articles

EF & WCF: Serialize not loaded collection navigation properties as null rather than an empty collection

Sometimes a web service client wants to know if a collection navigation property (a navigation property with “many” references) of a received entity object has been loaded on the server (e.g. by using Entity Framework’s Include method). By default, not loaded collection navigation properties are serialized as empty collections (not null). This is why the client cannot differentiate between a not loaded property and an empty collection. In one of my projects, I needed to have this information to know if a property is already loaded or has to be lazy loaded using an additional web service call.
Read More ›

Sketchagram diagram editor for Windows 8 released

The first version of Sketchagram has been released to the Windows 8 App Store.
Read More ›

WinRT: Access string resources in a stongly typed way (C#)

In WinRT/C# projects the .resx resource file is not available anymore. The new resource type is .resw which is directly supported by the XAML framework. The drawback of this new file format is that it does not automatically generate a code-behind C# class with a property for each key-value resource pair. The problem is that it is not possible to access these strings in a strongly typed manner. The only way to load resource strings is to load them by specifying the resource key as a string. The problem with this solution is that typing errors are not detected by the compiler but on application runtime.
Read More ›

WinRT: Navigate to the previous page by pressing the back key

If you are developing Metro applications, it is evident to not only have a good tablet experience but also a a good desktop (mouse and keyboard) experience. This is why I implemented a simple solution to navigate to the previous page if the user presses the back key. A lot of standard applications in Windows 8 support this feature already and I hope a lot of new applications will support it as well.
Read More ›

Using Entity Framework Code-First proxies with WCF web services

This blog post demonstrates how to set up a WCF web service together with lazy loading Entity Framework entities. The entities will be developed using a code first approach and their metadata is defined using the fluent API. To use all these features you need to install the newest Entity Framework (version 4.3.1 as of now) as a NuGet package (search for “Entity Framework“).
Read More ›

Implement secure WCF web services to use with Windows Phone and Metro style apps

The first part of this blog post demonstrates how to implement a WCF web service with username/password authentication and role based authorization. The web service can be used in Windows Phone applications and Windows 8 applications and it is even possible to use it with other libraries or frameworks. The second part explains how to set up the development environment to test the web service and the client application locally.
Read More ›

XBMC remote for Windows Phone

I’d like to introduce my XBMC remote app for Windows Phone: It is called “XBMC remote” and can be downloaded from the Windows Phone Marketplace. XBMC is a media center software designed to use with a TV and can be downloaded and used for free. The application only works with the newest XBMC release, XBMC 11 Eden. With the “XBMC remote” app you can browse your recently added media, albums, artists, music videos, movies and TV series:
Read More ›

Jumpy ListBox while scrolling in Windows Phone 7.5

I recently discovered a bug in the ListBox control for Windows Phone 7.5. In a long list of items (virtualizing list, items with different heights), the list sometimes begins to get jumpy and the list cannot be scrolled to the end. To reproduce the problem, open a long list of items, scroll a little bit, stop the scrolling and tap on an item. Now if you start scrolling again the list begins to get jumpy…
Read More ›

Create Task-based method from “legacy” callback method

In my projects I have a lot of asynchronous methods with a callback as parameter which is called when the operation has completed. I asked myself how to port these methods to support the new async / await keywords and if possible allow me to use the class with older frameworks which do not support this new functionality. The samples in this article use the Http classes from my library project MyToolkit.
Read More ›

Retrieve Entity Framework DbContext from a proxy object

There are some situations where you need to get the DbContext from a proxy object generated by the Entity Framework (current version: 4.5). Every generated proxy object holds a reference to the ObjectContext it belongs to. The problem is, that the ObjectContext does not have any information or reference to the corresponding DbContext. My solution is to maintain a static list with a ObjectContext-DbContext-Mapping:
Read More ›