Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Let's return to our original proposition of sending around URLs that encode a pointer to one particular domain object, (a particular location, for example). It is not feasible to represent the domain object's entire set of values in an URL, but we can easily encode an object ID. Remember from the PhoneBook-tutorial (re-store part) that a complete ObjectID consists of

  • class information ("Location", for example)
  • some ID (at this time, only GUIDs are supported)
  • information on how the ID should be interpreted ("System.Guid")

The static method ObjectID.Parse can parse such a string representation in a format like Location|9388...E7|Guid. In contrast to the dummy foo-int from the previous exercise, having an object ID in the perma-URL actually makes sense: it enables users to link to a particular object.
So if we want to give each domain object in EditLocationForm|s its own unique URL, we do the following:

  • modify the signature of the Call method in such a fashion that the domain object's ID is passed rather than the .NET object itself
  • adapt the invocations to fit the new signature
  • for compatibility reasons, we should keep the current obj variable for holding the actual Location object
    [ Before working on this exercise, you should remove the instructive Int32 foo parameter from the EditLocationForm and restore the invocations to their original form. ]

Modify the re-call header for the object ID
The new header in EditLocationForm.aspx.cs shall look like this:

...