OData client libraries for .NET 4, Silverlight 4 and Windows Phone 7

http://odata.codeplex.com/releases/view/54698

ODataNetFx4_SL4_WinPhone7_Client.zip – contains a Visual Studio 2010 solution with the source code for the OData .NET 4, Silverlight 4 and Windows Phone 7 Client library. To use, unzip the file locally and open the solution in Visual Studio 2010.
ODataClient_BinariesAndCodeGenToolForWinPhone.zip – contains just the OData client assemblies and code generation tools for use on Windows Phone 7.
ODataClient_WinPhone7SampleApp.zip – contains a sample Windows Phone 7 application which uses the OData client library for Windows Phone 7

Parallel Framework in Action

 

image
image

The #1 reason, IMHO, to look at .NET 4 is the parallelism. I say this not as a Microsoft Shill, but rather as a dude who owns a 6-core (12 with hyper-threading) processor. My most favorite app in the Training Kit is ContosoAutomotive. It’s a little WPF app that loads a few hundred thousand cars into a grid. There’s an interface, ICarQuery, that a bunch of plugins implement, and the app foreach’s over the CarQueries.

This snippet here uses the new System.Threading.Task stuff and makes a background task. That’s all one line there, from StartNew() all the way to the bottom. It says, "do this chunk in the background." and it’s a wonderfully natural and fluent interface. It also keeps your UI thread painting so your app doesn’t freeze up with that "curtain of not responding" that one sees all the time.

This code says "go do this in a background thread, and while you’re there, parallelize this as you like." This loop is "embarrassingly parallel." It’s a big for loop over 2 million cars in memory.

image

For more goto Scott Hanselman – The Weekly Source Code 56 – Visual Studio 2010 and .NET Framework 4 Training Kit – Code Contracts, Parallel Framework and COM Interop

Asynchronous Cancellation Patterns with .NET 4

 image

For calling methods asynchronously, since .NET 1.0 the async pattern can be used. .NET 2.0 added the event-based async pattern (also known as async component pattern) that makes async calls easier with Windows applications. Before .NET 4 no standard mechanism has been available to cancel asynchronous method calls. That’s new with .NET 4.0.

In this blog series you can read about these async patterns as well as the new unified model for cancellation.

Part 1 of this series introduced the async patterns and introduced cancellation with the BackgroundWorker class as it existed since .NET 2. In part 2 of this series Christian will show how the new .NET 4 cancellation framework can be used.

Previously to .NET 4, cancellation with async method calls was implemented in different ways if it was supported at all. For example, the BackgroundWorker implements cooperative cancellation by invoking the CancelAsync method, the long-running method needs to verify if it should be canceled by checking the CancellationPending property and needs to cancel by setting the Cancel property of the DoWorkEventArgs. More about this in the previous blog entry.

.NET 4 now supports cooperative cancellation of async methods in a standard way. The heart of this new framework is the CancellationToken struct. The CancellationToken is created by a CancellationTokenSource. This token can then be passed to any activity that should be cancelled. In case of a cancellation, the async call can verify cancellation by checking the IsCancellationRequested property of the CancellationToken. This unified model is now available with several classes offering asynchronous requests.

Natural User Interface library

 image

Blake.NUI is a new open-source library for multi-touch NUI (Natural User Interface) development.  It can be found at blakenui.codeplex.com and is under a MS-PL license.

The library is still in undergoing changes but here are some of the things currently included in Blake.NUI:

  • Controls
    • ZoomCanvas – an infinite canvas control that is the heart of NaturalShow
    • CircleText – layout text along the circumference of a circle
  • Gestures
    • TapGestureTrigger – a configurable Blend Trigger that fires when the user completes a tap gesture
    • DoubleTapGestureTrigger – a configurable Blend Trigger that fires when the user completes a double tap gesture
  • TouchDevices
    • MouseTouchDevice – promotes mouse input to WPF 4 touch events
    • SurfaceTouchDevice – promotes Microsoft Surface vision system input to WPF 4 touch events
  • Common classes and utilities
    • DisplayMatrix
    • AnimateUtility and SurfaceAnimateUtility
    • ScatterMatrixHelper
    • MathUtility
    • VisualUtility
  • NaturalShow
    • Common models, views, factories, and other classes

Patterns for Parallel Programming with the .NET Framework

 image

This document provides a detailed and in-depth tour of support in the Microsoft® .NET Framework 4 for parallel programming. This includes an examination of common parallel patterns and how they’re implemented without and with this new support in the .NET Framework, as well as covering best practices for developing parallel components utilizing parallel patterns.

This document was written by Stephen Toub from the Parallel Computing Platform team at Microsoft. It is based on the .NET Framework 4 and Visual Studio 2010. Two versions of the document are available, one with code samples in C# and one with code samples in Visual Basic.

Via Download details: Patterns for Parallel Programming with the .NET Framework

MEF Programming Guide with Silverlight-specific functionality

MEF Programming Guide

  1. Hosting MEF in an application
  2. Defining Parts and Contracts
  3. Declaring Exports
  4. Declaring Imports
  5. Lazy Imports
  6. Exports and Metadata
  7. Using Catalogs
  8. Filtered Catalogs
  9. Part Lifetime
  10. Recomposition
  11. Querying the Composition Container
  12. Composition Batch
  13. Debugging and Diagnostics
  14. FAQ

Silverlight-specific functionality

  1. Hosting MEF in Silverlight using CompositionInitializer
  2. Overriding the default host configuration
  3. Dynamic Instantiation and ExportFactory<T>
  4. Application partitioning with DeploymentCatalog

Also MEF Programming Guide – pdf

Learning MEF in Silverlight 4 and .NET 4

MEF has shipped with Silverlight 4 and with .NET Framework 4.0 and there are versions on CodePlex targeting Silverlight 3 and .NET Framework V3.5 Sp1.

If you’re looking to get started with MEF then here’s some quick resources;

  1. Glenn Block’s new MSDN Magazine Overview Article and Glenn’s Blog
  2. The Overview on CodePlex
  3. The Programming Guide on CodePlex
  4. Mike Taulty’s Channel 9 Videos

but if you’re already up and running then want to know what’s new in the latest drop for the Silverlight developer?

  1. Updated samples!
  2. Renaming and changes to PartInitializer
  3. Renaming and moving of PartCreator
  4. Renaming and changes to CompositionHost.InitializeContainer
  5. A new DeploymentCatalog class, suport dynamically asyn load XAP files on demand!!!

For more check this out: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/02/17/new-mef-drop-preview-9-on-codeplex.aspx

 

60+ .NET libraries every developer should know about.

 

Dependency Injection/Inversion of Control

Logging

Compression

Ajax

Data Mapper

ORM

Charting/Graphics

PDF Creators/Generators

Unit Testing/Mocking

Automated Web Testing

URL Rewriting

Controls

Unclassified

Via 60+ .NET libraries every developer should know about.