Useful Windows Phone advice from Nick Randolph

Fellow MVP Nick Randolph (@BTRoam) publishes an excellent blog, Nick’s .NET Travels, often with articles that relate to SQL Server Compact and synchronization technologies, but also very useful articles for any Windows Phone developer, with a practical, hands-on approach. Highly recommended.

He has recently published the following articles:

Windows Phone LINQ to SQL and the INotifyPropertyChanged and INotifyPropertyChanging Interfaces

This article demonstrates the importance of implementing the INotifyPropertyChanging interface on your DataContext classes to improve memory management. As he points out, you should use SQLMetal to generate your DataContext, as this will avoid missing to implement these interfaces. Or even better use the SQL Server Compact Toolbox Visual Studio add-in, as it adds the following features on top of SQLMetal:

1. Removes unneeded/unsupported constructors

2. Adds any [Index] attributes to each table

3. Adds the CreateDatabaseIfExists method

4. Optionally splits the generated files into a file per table (in next version (2.4), currently available in beta)

Change Tracking with SQL Server Compact (LINQ to SQL) on Windows Phone

This article demonstrates how to get started using SQL Server Compact Change Tracking with a Windows Phone SQL Server Compact database, despite the fact that the Change Tracking APIs are not available on Windows Phone. He also gets thrown in how to use the Windows Phone SDK ISETool to move the database from the Phone (Emulator) to your local disk. Good stuff.

SQL Server Compact will be available for developers in upcoming Windows Phone “Mango” update

Just a quick note the let you know, that SQL Server Compact will be exposed to Windows Phone developers as announced at the MIX11 conference. It is already on the device, as I blogged about earlier. The Windows Phone Developer blog has an overview of what is included for developers in the update, expected to be available this year. The developer tools update will appear next month, and I will blog more details about the API and other findings. The database will not be exposed via ADO.NET, as System.Data is not available in Silverlight, but the database will be accessible via LINQ. More details to follow when the API is published, and I have had a play with the developer tools. This MIX11 presentation demonstrates some of the details of working with SQL Server Compact on Windows Phone via Linq and DataContext only.