Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The basic requirements of content management are to persist arbitrary structured data associated with a group of urls, 
allow that data to be edited through a UI, and to provide that data to be inserted into a page template.
This is done in a clean light-touch way in Lynicon by simply extending the Route class.  Lynicon provides a generic 
DataRoute class, which when used, manages retrieval of an arbitrarily (within certain specifications) typed data item and 
provision of it to the controller's action method via model binding.

image 

The most basic scenario of content routing would then be implemented like this:

...

Code Block
languagec#
public ActionResult Index(TestContent data)
{
	return View(data);
}

Lynicon comes with 2 standard kinds of persistence.  The default, as above, serializes content types before storing them in a dedicated database table along with metadata.  This is Content persistence.  Another kind exists called Basic persistence which simply stores each field as a database field, this is described elsewhere.

Content Types

The values of all readable and writeable public properties in a content type are persisted, unless they have the attribute JsonIgnoreAttribute applied to them.

Persisted properties must have values of the following legal types:

  • Another type which is a valid content type
  • A primitive type
  • A generic list of legal types

A content type should ideally inherit directly or indirectly from BaseContent.  It is possible to use a valid content type which does not, but certain operations cannot be performed on it.

...

Routing

The standard routing in MVC will send all urls matching the url string (subject to constraints) to the controller.  The DataRoute<T> route will only match urls where a persisted data item of type T corresponding to the url exists.

...