CSLALight Navigation

CSLALight Navigation

Old forum URL: forums.lhotka.net/forums/t/6806.aspx


Dexter posted on Friday, April 17, 2009

Hi

I have been having a look at the navigator class to perform navigation to other silverlight usercontrols.

This is great and I can easily pass in an id of an object into the usercontrol for it to fetch its business object.

My question is this, If i want to pass a business object into the usercontrol as a parameter (which currently only allows a string parameter), is the best way of achieving this to serializing the business object itself ?

The scenario i am thinking of is when more than one screen must work on the same business object, before a saving occurs.

Dexter

 

 

RockfordLhotka replied on Monday, April 20, 2009

The Navigator control supports a couple scenarios.

One is to allow the Back/Forward buttons of the browser to work while the user interacts with your application.

Another is to allow the user to bookmark a URL and come back directly into the middle of your app.

To accomplish both of those scenarios, Navigator puts everything onto the URL - which means it can only work with relatively short string values.

It is then up to your application to interpret the string parameter value from the URL and translate that into some meaningful value.

You've probably noticed that you can implement the Csla.Silverlight.ISupportNavigation interface in a form, and that gives you access to parameter values and so forth. This is where you'd take the string value and translate it into an object instance or something like that.

Keeping in mind that a user might be moving from page to page in your application, you might choose to implement a static Dictionary<string,object> to cache objects so you can easily retrieve them if the user hits the Back button (just remember that data becomes stale, and watch how much memory you consume).

However, keeping in mind that a user might come back to a page "cold" by bookmarking a URL and opening a browser directly into the middle of your application, your code must also handle the case where the data isn't in your cache - in which case you need to decide whether to load the value via the data portal, or forcibly navigate the user to some other page, rather than the page they asked for.

Copyright (c) Marimer LLC