New WF4 Caching Activities for Windows Server AppFabric

I’m happy to announce that we have just posted a “Labs” release on our http://wf.codeplex.com site with some new Caching Activities.  These activities work with Windows Server AppFabric Caching making it possible for you to use the cache directly from your workflow

In this example I’m implementing the “Cache Aside” pattern where I first try to get the value from the cache and then if I can’t find it I get the value from a repository of some kind and then put it into a cache.

 

The source includes unit tests but be sure to start the cache cluster before running the test.  The notification tests also require a named cache – just look for the TODO comments in the unit test code before you run the tests.

I would love to know what you think of these.  This release is an experiment to get code out the door quickly.  If you like these activities – let me know and they may end up in a more formal release in the future.

Azure Discovery Event in Los Angeles

We will be hosting an Azure Discovery event on December 16th at the Microsoft office in downtown L.A.

 

Windows Azure Platform – Acceleration Discover Event Invitation


Microsoft would like to invite you to a special event specifically designed for ISVs interested in learning more about the Windows Azure Platform. The “Windows Azure Platform Discover Events” are half-day events that will be held worldwide with the goal of helping ISVs understand the Microsoft’s Cloud Computing offerings with the Windows Azure Platform, discuss the opportunities for the cloud, and show ISVs how they can get started using Windows Azure and SQL Azure today.

The target audience for these events includes BDMs, TDMs, Architects, and Development leads.  The sessions are targeted at the 100-200 level with a mix of business focused information as well as technical information.

Agenda

 
 

%u00b7 Microsoft Partners and the Cloud – How the Windows Azure Platform Can Improve Your Business

 

%u00b7 Cloud Business Scenarios for ISVs

 

%u00b7 Windows Azure Platform Technical Overview, Pricing and SLAs

   
     

Registration Link: http://bit.ly/laazure

Fees

This event is brought to you by Metro – Microsoft’s Acceleration Program and is free of charge.

Register Today

Date:  12/16/2010

Time:  9AM -1PM

Location:

Microsoft (LA Office)

333 S Grand Ave

Los Angeles CA

90071-1504

Level: 100-200

Language:  English

Audience:  BDMs, TDMs, Architects, and Development leads

Registration Info:  http://bit.ly/laazure

Questions:  email:[email protected]

Windows Azure AppFabric CTP December release – announcement and scheduled maintenance

The next update to the Windows Azure AppFabric LABS environment is scheduled for December 15, 2010 (Wednesday).  Users will have NO access to the AppFabric LABS portal and services during the scheduled maintenance down time.    

When:

     START: December 15, 2010, 10 am PST

     END:  December 15, 2010, 6 pm PST

 Impact Alert:

 The AppFabric LABS environment (Service Bus, Access Control, Caching, and portal) will be unavailable during this period. Additional impacts are described below.

 Action Required:

 Existing accounts and Service Namespaces will be available after the services are deployed.

 However, ACS Identity Providers, Relying Party Applications, Rule Groups, Certificates, Keys, Service Identities and Management Credentials will NOT be persisted and restored after the maintenance. The user will be responsible for both backing up and restoring any ACS entities they care to reuse after the Windows Azure AppFabric LABS December Release.

Cache users will see the web.config snippet on their provisioned cache page change automatically as part of this release. We advise Cache customers to redeploy their application after applying the new snippet from the provisioned cache page to their application

Thank you for working in LABS and giving us valuable feedback.  Once the update becomes available, we’ll post the details via this blog. 

Stay tuned for the upcoming LABS release! 

The Windows Azure AppFabric Team

Dec 5th Links: ASP.NET, ASP.NET MVC, jQuery, Silverlight, Visual Studio

Here is the latest in my link-listing series.  Also check out my VS 2010 and .NET 4 series for another on-going blog series I’m working on.

[In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu]

ASP.NET

  • ASP.NET Code Samples Collection: J.D. Meier has a great post that provides a detailed round-up of ASP.NET code samples and tutorials from a wide variety of sources.  Lots of useful pointers.

  • Slash your ASP.NET compile/load time without any hard work: Nice article that details a bunch of optimizations you can make to speed up ASP.NET project load and compile times. You might also want to read my previous blog post on this topic here.

  • 10 Essential Tools for Building ASP.NET Websites: Great article by Stephen Walther on 10 great (and free) tools that enable you to more easily build great ASP.NET Websites.  Highly recommended reading.

  • Optimize Images using the ASP.NET Sprite and Image Optimization Framework: A nice article by 4GuysFromRolla that discusses how to use the open-source ASP.NET Sprite and Image Optimization Framework (one of the tools recommended by Stephen in the previous article).  You can use this to significantly improve the load-time of your pages on the client.

  • Formatting Dates, Times and Numbers in ASP.NET: Scott Mitchell has a great article that discusses formatting dates, times and numbers in ASP.NET.  A very useful link to bookmark.  Also check out James Michael’s DateTime is Packed with Goodies blog post for other DateTime tips.

  • Examining ASP.NET’s Membership, Roles and Profile APIs (Part 18): Everything you could possibly want to known about ASP.NET’s built-in Membership, Roles and Profile APIs must surely be in this tutorial series. Part 18 covers how to store additional user info with Membership.

ASP.NET with jQuery

  • An Introduction to jQuery Templates: Stephen Walther has written an outstanding introduction and tutorial on the new jQuery Template plugin that the ASP.NET team has contributed to the jQuery project.

  • Composition with jQuery Templates and jQuery Templates, Composite Rendering, and Remote Loading: Dave Ward has written two nice posts that talk about composition scenarios with jQuery Templates and some cool scenarios you can enable with them.

  • Using jQuery and ASP.NET to Build a News Ticker: Scott Mitchell has a nice tutorial that demonstrates how to build a dynamically updated “news ticker” style UI with ASP.NET and jQuery.

  • Checking All Checkboxes in a GridView using jQuery: Scott Mitchell has a nice post that covers how to use jQuery to enable a checkbox within a GridView’s header to automatically check/uncheck all checkboxes contained within rows of it.

ASP.NET MVC

  • ASP.NET MVC Diagnostics Using NuGet: Phil Haack has a nice post that demonstrates how to easily install a diagnostics page (using NuGet) that can help identify and diagnose common configuration issues within your apps.

  • ASP.NET MVC 3 JsonValueProviderFactory: James Hughes has a nice post that discusses how to take advantage of the new JsonValueProviderFactory support built into ASP.NET MVC 3.  This makes it easy to post JSON payloads to MVC action methods.

  • Practical jQuery Mobile with ASP.NET MVC: James Hughes has another nice post that discusses how to use the new jQuery Mobile library with ASP.NET MVC to build great mobile web applications.

  • Credit Card Validator for ASP.NET MVC 3: Benjii Me has a nice post that demonstrates how to build a [CreditCard] validator attribute that can be used to easily validate credit card numbers are in the correct format with ASP.NET MVC.

Silverlight

  • Silverlight FireStarter Keynote and Sessions: A great blog post from John Papa that contains pointers and descriptions of all the great Silverlight content we published last week at the Silverlight FireStarter.  You can watch all of the talks online.  More details on my keynote and Silverlight 5 announcements can be found here.

  • 31 Days of Windows Phone 7: 31 great tutorials on how to build Windows Phone 7 applications (using Silverlight). 

  • Silverlight for Windows Phone Toolkit Update: David Anson has a nice post that discusses some of the additional controls provided with the Silverlight for Windows Phone Toolkit.

Visual Studio

  • JavaScript Editor Extensions: A nice (and free) Visual Studio plugin built by the web tools team that significantly improves the JavaScript intellisense support within Visual Studio.

  • HTML5 Intellisense for Visual Studio: Gil has a blog post that discusses a new extension my team has posted to the Visual Studio Extension Gallery that adds HTML5 schema support to Visual Studio 2008 and 2010.

  • Visual Studio 2010 Emacs Emulation Extension and VIM Emulation Extension: Check out these two extensions if you are fond of Emacs and VIM key bindings and want to enable them within Visual Studio 2010.

Hope this helps,

Scott

Error with One-Way WSDL Operations and BizTalk Receive Locations

Error with One-Way WSDL Operations and BizTalk Receive Locations

Do you ever do WSDL-first web service development? Regardless of the reason that you do this (e.g. you’re an architectural-purist, your mother didn’t hold you enough), this style of service design typically works fine with BizTalk Server solutions. However, if you decide to build a one-way input service, you’ll encounter an annoying, but understandable error. […]

StreamInsight: Reading from other data contexts into StreamInsight with LINQPad

The LINQPad driver for StreamInsight provides an awesomely easy way to run StreamInsight queries using easily accessible data contexts of temporal streams.  However, as LINQPad only supports a single active data context connection in a query it can be difficult to use one of the hard to read “without a data context” sources (such as OData) and use StreamInsight.

As LINQPad does enable execution of generic .NET code, we can use a little trick to get around the single-connection context limitation simply placing the embedded server creation code (i.e. Server.Create()) directly into a LINQPad query statement (regardless of the active context).

Step 1: Reading an OData Service in LINQPad

We’ll start off by importing the Northwind data set as an OData service, then converting the Orders table into a CepStream.  For more background on how to work with the new (as of 1.1) IEnumerable/IObservable adapters for StreamInsight refer to Colin Meek’s excellent StreamInsight Sequence Integration: Five Easy Pieces post.

  • Start a copy of LINQPad with the StreamInsight driver installed.  Refer to the StreamInsight LINQPad Driver post if you haven’t yet done this.
  • From the data context list, click on Add Connection.  From the Choose Data Context dialog, select WCF Data Services (OData) and click Next.

The Northwind OData context is now available for use in LINQPad.  One question that might immediately crop up is why didn’t I use the StreamInsight database context instead of the OData context?  LINQPad, unfortunately, doesn’t yet support multiple database contexts in a single query.  With the need to pull data from one context (LINQ to OData) and process it in another (StreamInsight), and the LINQ to OData context being rather challenging to create on the fly, we’ll use the Northwind as our primary context, and dynamically generate a StreamInsight embedded server.

  • The Northwind data context should now be available in the list of connections.  From the query pane, select C# Statement(s) as the language, and the Northwind URI as the database.  We use C# Statement instead of C# Expression to let us build up more complicated objects and code (such as the StreamInsight embedded server object).
  • Let’s run a simple query to make sure that the data feed is flowing through appropriately.  Type the code in the block below into the query window and press F5 to execute the query.
  1. // Retrieve orders from the Northwind OData feed that
  2. // have valid shipping dates and order dates.  Select
  3. // fields to be used in the StreamInsight query (basic
  4. // types only)
  5. var orders = from o in Orders
  6.                 where o.ShippedDate != null && o.OrderDate != null
  7.                 orderby o.OrderDate ascending
  8.                 select new
  9.                 {
  10.                     CustomerName = o.Customer.CompanyName,
  11.                     OrderDate = (DateTime)o.OrderDate,
  12.                     ShippedDate = (DateTime)o.ShippedDate,
  13.                     Region = o.ShipRegion
  14.                 };
  15.  
  16. orders.Dump();
  • The results should be similar to those shown in the screenshot below.  Once you’ve validated that the OData feed is being consumed properly, delete the orders.Dump() call.
IOrderedQueryable<> (200 items)
CustomerName OrderDate ShippedDate Region
Vins et alcools Chevalier 7/4/1996 0:00 7/16/1996 0:00 null
Toms Spezialitäten 7/5/1996 0:00 7/10/1996 0:00 null
Hanari Carnes 7/8/1996 0:00 7/12/1996 0:00 RJ
Victuailles en stock 7/8/1996 0:00 7/15/1996 0:00 null
Suprêmes délices 7/9/1996 0:00 7/11/1996 0:00 null
Hanari Carnes 7/10/1996 0:00 7/16/1996 0:00 RJ
Chop-suey Chinese 7/11/1996 0:00 7/23/1996 0:00 null
Richter Supermarkt 7/12/1996 0:00 7/15/1996 0:00 null
Wellington Importadora 7/15/1996 0:00 7/17/1996 0:00 SP
HILARION-Abastos 7/16/1996 0:00 7/22/1996 0:00 Táchira

 

Step 2: Creating a StreamInsight host and a basic query

Now that we have the OData feed available in LINQPad, let’s go ahead and set things up to allow us to create and execute StreamInsight queries without a data context (a data context or data connection makes this a lot easier – but since we also need the Northwind OData context, one of these has to be manually defined).

  • In LINQPad, click on the Query menu item, then on Query Properties (or press F4).
  • In the Query Properties dialog, add the following references to the Additional References list, as per the screenshot below.
    • Microsoft.ComplexProcessing.dll
    • Microsoft.ComplexProcessing.Observable.dll
  • Click on the Additional Namespace Imports tab, and add the following namespaces as per the screenshot below.
    • Microsoft.ComplexEventProcessing
    • Microsoft.ComplexEventProcessing.Linq
  • Since this won’t be the only time (I hope ) that we use this technique, go ahead and click on the Set as default for new queries button, click OK to acknowledge the popup, then click OK to close the Query Properties dialog.
  • Now we can go ahead and define an embedded StreamInsight server to process our queries, by pasting the code below into the LINQPad query window.
  1. using (Server server = Server.Create(“Default”))
  2. {
  3.     Application app = server.CreateApplication(“test”);
  4.    
  5.    
  6. }
  • Using the techniques described in Colin’s excellent post on using Sequences with StreamInsight v1.1, let’s convert the set of orders into a temporal stream.  The code below demonstrates how to obtain a CepStream<> of intervals from the enumerable set of orders.
  1. // Convert the set of orders into an interval stream
  2. var orderStream = orders.ToIntervalStream(app, t =>
  3.     IntervalEvent.CreateInsert((DateTimeOffset)t.OrderDate, (DateTimeOffset)t.ShippedDate, t),
  4.     AdvanceTimeSettings.IncreasingStartTime);
  • Now we’re ready to write our basic query.  Let’s look for the condition wherein we have more than one outstanding order in a region (i.e. if the order date and ship dates overlap).
  1. // Group the order stream by region, and create
  2. // snapshot windows to look at the sets of overlapping
  3. // orders.  Count the number of orders.   
  4. var regionCounts = from o in orderStream
  5.                    group o by o.Region into regionGroups
  6.                    from win in regionGroups.SnapshotWindow(SnapshotWindowOutputPolicy.Clip)
  7.                    select new { ShipRegion = regionGroups.Key, Count = win.Count() };
  8.  
  9. // Look for regions which have more than 1 overlapping
  10. // order
  11. var filter = from e in regionCounts
  12.              where e.Count > 2
  13.              select e;
  14.  
  15. // Dump the results of the query out into an enumerable
  16. var snk = from i in filter.ToIntervalEnumerable()
  17.           where i.EventKind == EventKind.Insert
  18.           select new { i.StartTime, i.EndTime, i.Payload.ShipRegion, i.Payload.Count };
  19. snk.Dump();
  • Let’s run the query (by pressing F5) and observe the results.
IEnumerable<> (130 items)
StartTime EndTime ShipRegion Count
7/8/1996 7:00:00 AM +00:00 7/9/1996 7:00:00 AM +00:00 null 3
7/9/1996 7:00:00 AM +00:00 7/10/1996 7:00:00 AM +00:00 null 4
7/10/1996 7:00:00 AM +00:00 7/11/1996 7:00:00 AM +00:00 null 3
7/11/1996 7:00:00 AM +00:00 7/12/1996 7:00:00 AM +00:00 null 3
7/12/1996 7:00:00 AM +00:00 7/15/1996 7:00:00 AM +00:00 null 4

Interesting result combining LINQPad exploration of a LINQ to WCF OData and StreamInsight – but what went into producing that result? Which collection of events resulted in that output event?  Answering that question will be my next post on using the Event Flow Debugger with LINQPad and StreamInsight

  1. // Retrieve orders from the Northwind OData feed that
  2. // have valid shipping dates and order dates.  Select
  3. // fields to be used in the StreamInsight query (basic
  4. // types only)
  5. var orders = from o in Orders
  6. where o.ShippedDate != null && o.OrderDate != null
  7. orderby o.OrderDate ascending
  8. select new
  9. {
  10.     CustomerName = o.Customer.CompanyName,
  11.     OrderDate = (DateTime)o.OrderDate,
  12.     ShippedDate = (DateTime)o.ShippedDate,
  13.     Region = o.ShipRegion
  14. };
  15.  
  16. using (Server server = Server.Create(“Default”))
  17. {
  18.     Application app = server.CreateApplication(“test”);
  19.  
  20.     // Convert the set of orders into an interval stream
  21.     var orderStream = orders.ToIntervalStream(app, t =>
  22.       IntervalEvent.CreateInsert((DateTimeOffset)t.OrderDate, (DateTimeOffset)t.ShippedDate, t),
  23.       AdvanceTimeSettings.IncreasingStartTime);
  24.    
  25.     // Group the order stream by region, and create
  26.     // snapshot windows to look at the sets of overlapping
  27.     // orders.  Count the number of orders.   
  28.     var regionCounts = from o in orderStream
  29.         group o by o.Region into regionGroups
  30.         from win in regionGroups.SnapshotWindow(SnapshotWindowOutputPolicy.Clip)
  31.         select new { ShipRegion = regionGroups.Key, Count = win.Count() };
  32.  
  33.     // Look for regions which have more than 1 overlapping
  34.     // order
  35.     var filter = from e in regionCounts
  36.         where e.Count > 2
  37.         select e;
  38.  
  39.     // Dump the results of the query out into an enumerable
  40.     var snk = from i in filter.ToIntervalEnumerable()
  41.           where i.EventKind == EventKind.Insert
  42.           select new { i.StartTime, i.EndTime, i.Payload.ShipRegion, i.Payload.Count };
  43.     snk.Dump();
  44. }

Installing the Designer Extensibility Sample: Issues I came across

While working on this sample, I came across the following errors:

  1. I needed to change the version of .NET from 3.5 to 4.0 in the properties of the project.
  2. I got the following error when I compiled the error: The type ‘Microsoft.VisualStudio.Modeling.ModelElement’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Microsoft.VisualStudio.Modeling.Sdk.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. C:\Projects\Microsoft.Practices.ESB\Source\Samples\Designer Extensibility Samples\Extenders.Itinerary.OrchestrationSample\Extenders.Itinerary.OrchestrationSample\OrchestrationSampleExtender.cs
  3. This made me install the following components:
  4. Visual Studio 2010 SDK
    Visual Studio 2010 Visualization and Modeling SDK
  5. This then required me to reference the following assembly in the project: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Modeling.Sdk.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Modeling.Sdk.10.0.dll
  6. Once I built the two projects, in the directions (step 7) it states: In Windows Explorer, open the \Lib folder under the Itinerary Designer install path. This actual path is: C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit 2.1\Tools\Itinerary Designer\Lib\