Cyclic Reference

Xml & Json Serialization of Object Graphs with Cyclic References in .NET

Cyclic Reference
Cyclic Reference

As a WCF Developer you’ve no doubt run into some issues with object serialization at some point or another during the course of developing your applications. Either during the course of pushing your entities through a WCF Service or by attempting to serialize those object for transit through other media. Recently I ran into some issues around serializing WCF Entities with Circular References (or cyclic relationships) between parent & child Objects.

Background

A large percentage of our company’s software work relies on moving a variety of object graphs around through WCF. These object graphs, often times contain self-references or circular references. The data we deal with is primarily related to the airline industry; specifically crew & flight schedules. It contains complicated tree structures of data with information on the flights crew-member’s fly, the duties (work-shifts) those flights belong to & the pairings, those duties are contained within. (A pairing is airline industry parlance for a collection of Duties organised into a longer 4 or 5 scheduled body of work for a crew member. Confusingly, it is not necessarily a Pair of anything).

In order to allow us to more easily navigate these object graphs, we populate a number of helper properties on the entities to allow us to traverse up and down the graph with ease. The following is an extremely simplified example of what gets populated in our Crew Schedule “Roster” Object Graph and shows the relations ships between the three previously mentioned domain entities.

Of course, this makes for some interesting cyclic situations when both the parent objects & contents of the child collections are cross-wired to one another and we want to serialize those objects for use through a WCF Service.

Read More “Xml & Json Serialization of Object Graphs with Cyclic References in .NET”

Visual Studio 2012

Visual Studio 2012 – First Impressions

Visual Studio 2012
Visual Studio 2012

Last week, I took the leap and upgraded my work machine to Visual Studio 2012 and it’s been very smooth sailing so far. The installation for starters was a breeze and there are a number of improvements & new features that Ive been very impressed by straight out of the gates.

Dark Colour Scheme

I’m a big fan of the Dark Color schemes in the my IDE and a long time user of the Son Of Obsidian style in Visual Studio 2010 so it’s nice to see some first-class support for dark, expression-blend style themes in VS2012. Open the Tools Menu, then Options and the Color Theme is the very first choice on the General Tab.

VS2012 Dark Color Theme
VS2012 Dark Color Theme

Read More “Visual Studio 2012 – First Impressions”

Version 1.0

Global Assembly Versioning Strategy & Development Workflows for .NET Assemblies

Version 1.0Over the past few weeks I’ve been working on a new project in our company which involved building a number of inter-dependent assemblies, “strongly naming” them and installing them into the Global Assembly Cache. Over the course of the project, I was forced to look at a number of issues related to assembly versions, solution organisation and the deployment of assesmblies in a developer environment.

So given that it’s been a while since I wrote anything vaguely technical, I thought I’d document some of these issues down.

  • What version numbering strategy should we use?
  • How will we organise our Solution to make this easily manageable?
  • How will we manage these libraries during the deployment phase?
  • How will we circulate stable versions to developers during on-going development of other projects?
  • How will we release these libraries to customers?
[notice]TL;DR – Take a look at the VersioningDemo Solution on GitHub[/notice]

Read More “Global Assembly Versioning Strategy & Development Workflows for .NET Assemblies”

Parallel

System.Threading.Tasks & Parallelism in .NET 4.0

Parallel
Parallel

Alas, all my hope & dreams & promises of a regular blog post, dashed… oh well, here’s one now.

I’ve been playing with the System.Threading.Tasks namespace over the last few hours and it’s quite neat.

We’ll be rolling out some new software in the next few months at work which Processes SMS messages from Customers. In the past we had fudged together our own Multi-Threading/Multi-Pipeline code to try and get messages through the system as quickly as possible but it was fairly bloated to say the least. Enter the new Task and Parallel classes in .NET 4.0

Read More “System.Threading.Tasks & Parallelism in .NET 4.0”

Dynamic

Building Lambda Expressions at Runtime

Dynamic
Dynamic

Necessity is the mother of all… reasons to learn something new. So when some project requirements came down to put together a Search UI for an object graph of ~200 different properties in one wide table, we got an opportunity to play with some dynamic LINQ. We needed to come up with a quick way to allow a user to search across all the properties without making the UI unwieldy. What we provided them with was a simple UI allowing the user to apply 0:N conjunctive search filters. For each filter they choose an object property to filter by, the filtering operator (equal, less than, etc…) and the value they were searching for.

By the way, if there’s a nicer way to do this, I’d love to know about it.

Read More “Building Lambda Expressions at Runtime”