LookUp Sources
The LookUp System will use the LookUp Engine to retrieve values for Queries and more.
The LookUp engine will parse tokens like [Module:ModuleId]
and then look for a LookUp Source with the matching name, in this case Module
.
For this to be possible, the Engine has a list of named sources like
Module
QueryString
Params
- etc.
On this page we'll explain how these work, and what special sources exist.
LookUp Sources
These are the sources which are automatically included in 2sxc
- App Sources
- App - the current App, which can give you folders (to link JS files) ☢️🩸
- App:Settings - app settings ☢️🩸
- App:Resources - app resources, translated labels etc. ☢️🩸
- Web Server and System Sources Hybrid
These work both on Dnn and Oqtane (2sxc 12+)[Query]
☢️🩸
- Web Server and System Sources
- QueryString - url parameters ☢️
- Form - form post parameters ☢️
- DateTime - current date/time information ☢️🩸
- CMS / Dnn Sources
- User Information Sources
- User
- Membership
- User Profile
Token Template Sources
In Token Templates we also have 3 special lookups
Content
- the current contentContent:Presentation
- presentation settings of the current content, if configuredListContent
?ListContent:Presentation
AnyNameYouWant
specified in a<repeat>
tag
Query Sources
In Queries we also have the following sources
DataSource Settings Source
In DataSources code you will usually only work with Settings
which contain all the settings that specific DataSource should work with. The Settings
source only exists in your C# code, not in the VisualQuery.
What is a LookUp Source (technical ⚠)
LookUp Sources are ILookUp objects and have a Name
like like QueryString
, Module
, Portal
etc.
Each one is capable of retrieving values like Id
or DefaultPage
.
So the Engine will ask the specific source for the expected value and the source will try to find it. If it has an answer, it will return that. If it doesn't find anything it will return null and let the Engine take care of fallback options.
Tip
Everything is lazy, so these objects are only accessed and populated if the parameter is actually needed. This results in great performance.
All LookUp objects implement the ILookUp interface and inherit the LookUpBase object.
Internal LookUp Objects (technical ⚠)
Just to give you an idea of the power of LookUp objects, here are some in use:
- LookUpInEntity - this resolves entity values.
- LookUpInNameValueCollection - this resolves from name/value lists like
Dictionary
orRequest.QueryString
objects
- LookUpInLookUps - will look up values in various attached LookUp objects
- - will look up a value from an
In
stream of a DataSource ToSic.Sxc.Dnn.LookUp.LookUpInDnnPropertyAccess
- will look up stuff in Dnn specific PropertyAccess objects, which are similar to LookUp objects- LookUpInEntity - will look up things in an IEntity and also provide more information like Count, IsFirst, etc. for the Token Engine
Also Read
History
- General Tokens introduced in 2sxc 1.0
- Most enhancements were in 2sxc 07.00