I was recently sent an 'ebook' of the Windows Phone 7.5 Data Cookbook by Ramsh Thalli.
It seems a good time to look at a book on data access for Windows Phone, as Mango introduced local database support using SQL Ce. The book covers:-
- Data binding, including element binding, DataContext, data templates, converters.
- Isolated storage
- Using XML files
- Consuming OData, and performing CRUD against OData sources
- Using on-device databases, including Perst, SQLite and SQL Server Compact with LINQ to SQL
- Consuming REST feeds, and creating a REST service
- WCF Data Services
Starting with 'Data binding', the book leads you through the various methods of data access available to the Windows Phone developer. Having been involved in the Windows Phone camps over the last few months, I know what a hot topic data access is. The Windows Phone Databound Application is a great way to learn about data binding, but the Data binding chapter of the book explain in very simple terms the art of data binding. You start with simple data binding of text blocks to your text boxes, progress through converters, and end with how to bind data classes to your forms. Each step contains example code, and it all builds together to create a data bound project.
The chapter on Isolated Storage takes you through file manipulation and application settings. This is available here as a downloadable sample chapter. If you follow the samples, you can use our GUI Isolated Storage Explorer to check your output.
XML access was until Mango probably the main data access method used. XML access is covered in depth, including remote XML file access, and builds on the lessons learnt in Data binding and Isolated Storage to bring them all into one project.
Chapter 4 covers Odata, and shows you how to build a data driven project, using Odata from Netflix. Following the pattern already set, the project starts simply, and gradually builds up to use all the features of Odata.
Chapter 5 takes you through database access on the device, starting with SQLite, moving through SQL Ce, and covering Perst from McObject, first ported by our very own Andy Wigley. Personally, I would have preferred more about SQL Ce, but that is more my interest. For those of you using SQL Ce, SQL Server Compact Toolbox from fellow MVP ErikEJ is a 'must have'.
The final 3 chapters get heavy, covering in great detail, REST, WCF and MVVM. Following the pattern already established, all 3 chapters contain detailed explanations, and sample code, beginning with simple examples, gradually getting more complex.
I think this is a book for 'dipping' into, and is a great help when you are looking to solve a particular problem. There are over 30 'recipes' for working with data. This book covers a wide subject, data access, but covers it in depth. As shown by questions on the forums and events, data access on Windows Phone is a hot topic, and this books really helps in explaining the options available to you, and sample projects to guide you. For anyone wanting to know the detail behind the acronyms, this is a great choice.
Originally posted 24/Jan/2012