Welcome Guest, you are in: Namespace

A description of how Urls are handled in Sueetie by the SueetieUrls class and SueetieLink Control.

Sueetie Url Handling - Patterns

Sueetie Urls are managed in a Sueetie.Core class called SueetieUrls.cs and used in ASPNET with a SUEETIE:SueetieLink User Control. The definition properties for Sueetie Links are located in the .config file /util/config/urls.config.

The Sueetie.Core SueetieUrls Class

Below is the outline of the Sueetie.Core.SueetieUrls class. At the top you can see a simple SueetieUrl container which holds three properties: Name, Url and Roles.

Image

The SueetieUrls class has three primary areas and functions: 1) Individual Url Assignment, 2) Url formatting and retrieving the SueetieUrl object requested, and 3) Loading the urls.config configuration file.

Retrieving the urls.config file

As mentioned above, the urls.config file is located in /util/config. Its url XML elements have three attributes reflecting the properties of the SueetieUrl container class: Name, Path and Roles. Here is an excerpt.

Image

The Roles property is optional and when not assigned means the link has no Role restrictions. The SueetieUrls class uses XDocument and Linq to retrieve and cache the file, with a cache dependency on urls.config so that urls are updated immediately upon changes to urls.config.

Image

The SueetieLink User Control

The Sueetie.Controls SueetieLink User Control works with the SueetieUrls class and adds a SueetieUrlLinkTo enumerator to support Intellisense in creating the control as shown here.

Image

The SueetieUrlLinkTo property is optional, so for custom links, a non-Intellisense enabled UrlName property can be used instead.

Image

The SueetieUrl container class is retrieved with a GetSueetieUrl(string urlName) method. The SueetieLink Onload method demonstrates how a SueetieUrlLinkTo enum property is sought and if found retrieves the specified SueetieUrl object. If not found, the UrlName property is used.

Image

Image

Two other SueetieLink Control Prooperties are worth mentioning: TextKey and LanguageFile. These are to support Localization, with TextKey being the language file KEY value in /util/languages/LANG/sueetie.xml. LanguageFile property specifies another language resource file if sueetie.xml is not used.

Image

Sueetie Url Handling - Origins

The origins of Sueetie Url logic are essentially the Sueetie Core and Control classes that have come before it as there is very little new here. The Enumerator selection support in the SueetieLink control for instance was used in the Sueetie Forum Link Control.

Using XDocument and Linq to retrieve configuration information from an XML file is something we've done with a number of processes including Background Tasks, Localization and SueetieConfiguration class.

Top

ScrewTurn Wiki version 3.0.4.560.

Copyright © 2008-2012 Sueetie LLC. All rights reserved.
Sueetie