- My daughter had her tonsils & adenoids out on yesterday. It was a routine procedure and it went by-the-numbers, but any parent will tell you it’s hard to see your kid in a hospital bed.
- Given the previous bullet, I’m not at the SOA/BPM conference for the big announcement. Don’t worry, there’s lots of other folks covering the news.
- It was a crappy sports weekend in the Pierson house. Va Tech snatched defeat from the jaws of victory, Southern Cal never led at Oregon, the Capitals losttwice, and the Redskins got blown out by the Pats. At least the Caps won big yesterday in Toronto.
- Speaking of the Capitals, Peter Bondra retired Monday. I still think it’s a travesty that he didn’t spend his whole career in DC, but I’ve made my peace with it.
- Nick Malik has a great series on business operations models and how they apply to SOA. Regular readers should be unsurprised that I favor low standardization, though I can see the value of high integration. That makes the Coordinated Operating Model my fav, though I can see the benefit of the Diversified Model as well. I can’t wait to read what Nick has to say on changing models.
- Speaking of Nick, I’m doing a roundtable with him on “Making SOA Work in the Enterprise” @ the Strategic Architect Forum. Should be fun. Sorry for the lack of linkage on this, but it’s an invite-only event.
- Jezz Santos has a new series of white papers on building software factories. First up “Packaging with Visual Studio 2005”
- Aaron Skonnard has a new whitepaper on using the WCF LOB Adapter SDK with BTS 2006 R2. I’ve been building one of these things recently, so I’m looking forward to checking that out. (via Sam Gentile)
- Tim Ewald looks at Resource Oriented Architecture (when did ROA become a TLA?) and wonders “what if your problem domain is more focused on processes than data?” I wonder that all the time. (via Jesus Rodriguez)
- It’s not just durable messaging – Libor Soucek also disagrees with my opinions on centralized control. I agree 100% with Libor that centralized management would make operation’s lives “much, MUCH easier” as he puts it. However, that doesn’t make it feasible at any significant scale. Furthermore, I wouldn’t describe an approach that requires that “all services adopt [the] same common management interface” as “pragmatic”. Frankly, just the opposite.
Posts tagged WCF
- Quick update to the DevHawk 2007 World Tour: I won’t be making it to the SOA & BP Conference. Riley’s having her tonsils out. As much as I’d like to hang with my geek peeps, family is the priority. But I can still make an evening event or geek dinner later in the week if anyone is game.
- Caps season-opening winning streak continues. Still 100% on the PK, though the power play is pretty anemic. As I said yesterday, it’s WAAAAY to early in the season to start bragging, but starting strong is much better than starting weak.
- Speaking of hockey, looks like the NHL Network is launching in the US this month (it’s been available in Canada since 2001). Also, NHL.tv is up and running. Those wishing to see Caps highlights can go directly to Capitals.NHL.tv. Unfortunately, if you want to see full games, you’ve got to subscribe to Center Ice or Center Ice Online to the tune of $150. But I don’t want to get “up to 40 games each week”, I just want the Caps games. Between the time zone difference and kids, it’s not like I have time to watch that much hockey anyway. Why can’t I subscribe to just the Caps games online for say $25 a season?
- Finished Halo 3 Sunday night. Fun game and a great end of the trilogy. Looking forward to what the newly-independent Bungie does next. Something tells me we haven’t seen the last of Master Chief. However, I do think Bioshock has better and more original storytelling. Mass Effect looks like it’ll be better still.
- Sam Gentile pointed out that his Neudesic colleague David Pallmann has posted a series of WCF tips. Several of them are right on the money like “Take Advantage of One Way Operations” and “Use a Discovery Mechanism to Locate Services“. However, I can’t agree with “Maintain a Service Catalog“. David warns that if you don’t, “The left hand won’t know what the right hand is doing.” Of course, that’s probably the case regardless of how you maintain your service catalog. And “Retry on minor failures“? That’s fine, if you’ve got an idempotent operation. Unfortunately, most non-read operations aren’t idempotent unless you take the time to design them that way. And most people don’t.
- Speaking of Sam, he’s blown up his CodeBetter blog and walked away from the ALT.NET crowd. I’ve not been a fan of this ALT.NET stuff since it surfaced – as Sam said, “ALT.NET is a divisive thing” – so I’m happy to see my good friend walk away from it.
- Speaking of ALT.NET, Scott Hanselman blogged about previewing the new ASP.NET MVC Framework at the ALT.NET conference. Like Sam, Scott thinks the term ALT.NET is “too polarizing”. I like Scott’s suggestion for Pragmatic.NET. Oh, and the MVC framework stuff looks cool too.
- Reading Dare’s description of OAuth gave me a distinct sensation of deja-vu.
I’ve been investigating the new WCF/WF integration in .NET Framework 3.5. I want to understand how the new context features work. Unfortunately, there’s not much info out there (that I could find at any rate). You’re pretty much stuck with the samples and Jesus Rodriguez’s overview of durable services. So I sat down to dig a little deeper.
Note, since there are no docs on this stuff as I write this, many of the links below are Reflector code links.
I started by lifting the DurableCalculator sample contract and service implementation and dumping it into a new WCF Service Library project. I did this for two reasons. First, VS08 has added a WCF Service Host much like VS05 added the ASP.NET Development Server. Very cool. But the existing sample is still written to be hosted in IIS, so I wanted to change that. Second, and much more important, I wanted to start with a vanilla config file. I knew it wouldn’t work out of the box, but the point of this exercise was to learn how this works under the covers.
When you fire up the durable service with the vanilla config file, you get an error (as expected). Services marked with the DurableServiceAttribute require a binding that supports the context protocol. WsHttpBinding, the default binding when you create a new service, doesn’t. However, it’s easy to fix by switching to wsHttpContextBinding instead. Via Reflector, we see that wsHttpContextBinding inherits from wsHttpBinding and adds a ContextBindingElement to the binding element collection created by the base class. BasicHttpContextBinding and netTcpContextBinding work the same way.
Even after changing to wsHttpContextBinding, we’re still getting an error on service start. But it’s a new error, so we’re making progress. Now, we’re told that services marked with DurableServiceAttribute need a persistence provider to be specified. If we look in the original sample’s web.config file, we find a persistenceProvider element in the service behavior. This element references the SqlPersistenceProviderFactory type. Obviously, the point here is to persist durable service instances to the database between calls, much as WF can do.
However, merely configuring the existing SQL persistence provider doesn’t really tell you what’s going on under the hood. Besides, often when you’re experimenting, you don’t really want to go thru the headache of setting up a SQL store for persisting instances to. Somewhere along the line, I implemented a fake persistence service for WF that stored the serialized instances in memory. So I decided to do the same for WCF durable services.
Building a WCF Persistence Provider requires building two classes: a factory and the provider itself. Factories inherit from PersistenceProviderFactory, which exposes only one non-CommunicationObject method: CreateProvider. It appears that the service host creates a single persistence provider factory and calls CreateProvider whenever it needs a persistence provider. Providers themselves inherit from PersistenceProvider, which exposes methods to Load, Save and Delete durable service instances.
My FakePersistenceProvider (and factory) are brain dead simple, though the ratio of “real” code to factory and CommunicationObject scaffolding is quite low (about 40 lines out of 258). The factory keeps a dictionary of serialized service instances, keyed by guid. When providers are created, this key guid is passed as a parameter to CreateProvider. The provider instances delegate Load, Save and Delete back to internal methods on the factory class. The methods themselves use the NetDataContractSerializer to serialize the service instance out to a byte array and deserializing it back again. I chose NetDataContractSerializer because that’s what the SQL persistence provider uses under the hood.
PersistenceProvider supports async versions of Load, Save and Delete but I didn’t implement them. Also, there’s a LockingPersistenceProvider abstract class which adds (you guessed it) instance locking semantics. However, my fake provider doesn’t span machines, much less require locking semantics so I skipped it.
So it looks like DurableServiceAttribute, context-supporting bindings and persistence providers are all inter-related. Certainly, you can’t use the attribute with out the binding and persistence provider. As I continue to dig, I’m want to see how context inter-relates with WF as well as it’s possible usage outside of DurableServiceAttribute based scenarios.
If you’re interested in the code, I’ve stuck it up on my SkyDrive. In addition to the FakePersistenceProvider implementation and the simple Durable Calculator service, it includes a simple client to test the service and persistence provider. The WCF Service Host includes a test client, but it doesn’t appear to support the context protocol, so I had to build a simple test app instead. Enjoy.
- I’m in Chicago today and tomorrow for a reunion of sorts. In my last job, I managed a group of external architects called the Microsoft Architecture Advisory Board (aka the MAAB). We discontinued the program a while back, but the core of the group found the program valuable enough they have continued to meet anyway. I found the MAAB meetings incredibly valuable and insightful, so I’m really excited to be invited to continue my involvement with the group.
- I picked up Bioshock Tuesday (Circuit City had it on sale) on my way to my bi-weekly campus excursion. My meetings were over around 2pm so I headed home early, expecting to surprise the kids. But Jules had decided to skip naps and go shopping with them. Her cell phone was dead, so I ended up at home with a couple of hours to myself and a brand new copy of Bioshock. Wow, is that a good game. Certainly deserving of the amazingly good reviews it’s garnered.
- Speaking of reviews, this transparently biased review of Bioshock over at Sony Defense
FarceForce is frakking hilarious. Somehow, I doubt their dubious review will stem the tidal wave of Bioshock’s well-deserved hype. Can’t wait to read their Halo 3 review.
- Pat Helland writes at length on master-master replication. I reformated it into PDF so I could read it – the large images were messing up the text flow on my system. As usual for Pat, there’s gold in that thar post. His thoughts on DAGs of versions and vector clocks as identifiers are very exciting. However, I think he glosses over the importance of declarative merging. I would think programmatic merge would likely be non-deterministic across nodes. If so, wouldn’t you end up with two documents with the same vector-clock identifier by different data?
- Joe McKendrick points to a few people who predict the term “service-oriented” will eventually be subsumed under the general heading of “architecture”. Not to brag, but I made that exact same prediction almost three years ago.
- Erik Johnson thinks that SOA 2.0 centers on transformational patterns. The idea (I think) is that if systems “understand each other more deeply”, then we can build a “smarter stack” and design apps via new constructs to promote agility and simplicity. Personally, I’m skeptical that we can define unambiguously system semantics except in the simplest scenarios, but Erik talks about using “graph transformation mathematics” to encode semantics. I don’t know anything about graph transformation mathematics, but at least Erik has progressed beyond hand waving to describing the “what”. Here’s looking forward to the “how”.
- New dad Clemens Vasters somehow finds time to implement an XML-RPC binding for WCF 3.5. I was encouraged that it didn’t require any custom attributes or extensions at the programmer level. Of course, XML-RPC fits semantically into WCF’s interface based service model, so it shouldn’t be a huge surprise that it didn’t require any custom extensions. But did it need WCF 3.5? Would this work if recompiled against the 3.0 assemblies?
- Phil Haack writes a long post on Duck Typing. VB9 originally supported duck typing – the feature was called Dynamic Interfaces – when it was first announced, but it was subsequently cut. I was really looking forward to that feature. Between it and XML Literals, VB9 was really stepping out of C#’s shadow. I guess it still is, even without dynamic interfaces.
- Since I’ve been doing some LINQ to XML work lately, I decided to go back and re-write my code in VB9 using XML literals. While XML literals are nice, I don’t think they’re a must have. First, LINQ to XML has a nice fluent interface, so the literals don’t give you that much cleaner code (though you do avoid writing XElement and XAttribute over and over.) Second, I find VB9′s template syntax (like ASP <%= expression %>) clunky to work with, especially in nested templates. Finally, I like the namespace support of XNames better. As far as I can tell, VB9 defines namespaces with xmlns attributes just like XML does. So I’m not dying for literal XML support in a future version of C#. How about you?
- I’m not sure if I should laugh or cry at Nick Malik’s definition of politecture. I mean, it’s funny so I’m laughing, but it’s so true that it makes me want to cry.
- Don Box comments on retiring the tenets. It’s good to see him say “please God tell me we can do better” than CLR interfaces or WSDL.
- Looks like the P2P APIs are finally getting the managed treatment in .NET FX 3.5. A long time ago, John deVadoss asked me what an enterprise system like CRM might look like if it used a peer-to-peer approach instead of client-server. If I had any free time, I’d prototype one out on this API. (via Mike Taulty)
- Scott Guthrie goes back to his LINQ to SQL series to tackle Stored Procs and UDFs. Being able to use UDFs inline with LINQ queries is very cool. However, it seems to me that LINQ discourages the use of stored procs. As a developer, I’d rather write LINQ queries than stored procs, if I can. The probably puts me at odds with DBAs who’d rather all DB access be via stored procs they control.
- Soma writes about new MSBuild enhancements in VS08: multi-targeting and parallel build.
- I just discovered Vista Battery Saver. Basically, it turns off Aero and Sidebar when you’re on battery. I’m traveling to Chicago next week, so we’ll see if it has much impact on my battery life. (via Plenty of Code and Larkware)