Class NovaRazorContext
Everything that is necessary for a Razor Page to render Nova content. A scoped instance must be created and configured for each rendering request.
Inherited Members
Namespace: Noxum.Nova.Razor.Model
Assembly: Noxum.Nova.Razor.Model.dll
Syntax
public sealed class NovaRazorContext
Constructors
NovaRazorContext(NovaApiContext, SystemObjects, IEnumerable<INovaRazorOutputFormat>, INovaRazorLinkFactory, IRazorViewRenderer, NovaRazorHttpClientFactory, CancellationToken)
Create a new instance
Declaration
public NovaRazorContext(NovaApiContext apiContext, SystemObjects systemObjects, IEnumerable<INovaRazorOutputFormat> outputFormats, INovaRazorLinkFactory linkFactory, IRazorViewRenderer razorViewRenderer, NovaRazorHttpClientFactory httpClientFactory, CancellationToken requestAborted)
Parameters
| Type | Name | Description |
|---|---|---|
| NovaApiContext | apiContext | |
| SystemObjects | systemObjects | |
| IEnumerable<INovaRazorOutputFormat> | outputFormats | |
| INovaRazorLinkFactory | linkFactory | |
| IRazorViewRenderer | razorViewRenderer | |
| NovaRazorHttpClientFactory | httpClientFactory | |
| CancellationToken | requestAborted |
Properties
ApiContext
Get the current Noxum.Nova.Data.NovaApiContext
Declaration
public NovaApiContext ApiContext { get; }
Property Value
| Type | Description |
|---|---|
| NovaApiContext |
BranchId
Get the current branch ID
Declaration
public ObjId BranchId { get; }
Property Value
| Type | Description |
|---|---|
| ObjId |
Languages
Get the sorted list of languages of the selected scope. This may be empty, e.g. if a Job is created by a trigger
Declaration
public IReadOnlyList<CachedLanguage> Languages { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<CachedLanguage> |
LinkFactory
Get the INovaRazorLinkFactory to create links and hyperlinks to binaries and objects
Declaration
public INovaRazorLinkFactory LinkFactory { get; }
Property Value
| Type | Description |
|---|---|
| INovaRazorLinkFactory |
Objects
Get the sorted list of objects to be rendered.
Declaration
public IReadOnlyList<ObjId> Objects { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<ObjId> |
OutputCulture
Get the current output culture to use. For a user-created Preview or a Job, this is the UI culture of the user. The output culture may be used as base language and as the formatting provider for rendering.
Declaration
public CultureInfo OutputCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| CultureInfo |
OutputFormat
Get the intended output format
Declaration
public INovaRazorOutputFormat OutputFormat { get; }
Property Value
| Type | Description |
|---|---|
| INovaRazorOutputFormat |
OutputFormats
The dictionary of possible output format
Declaration
public FrozenDictionary<string, INovaRazorOutputFormat> OutputFormats { get; }
Property Value
| Type | Description |
|---|---|
| FrozenDictionary<string, INovaRazorOutputFormat> |
OutputLanguage
Get the current language to use for rendering. For a user-created Preview or a Job, this is the UI language of the user. The output language may be used as the base language and as the formatting provider for rendering.
Declaration
public CachedLanguage OutputLanguage { get; set; }
Property Value
| Type | Description |
|---|---|
| CachedLanguage |
OutputMediaType
Gets or sets the media type of the output content.
Declaration
public string OutputMediaType { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RazorViewRenderer
Get the IRazorViewRenderer to render Razor views
Declaration
public IRazorViewRenderer RazorViewRenderer { get; }
Property Value
| Type | Description |
|---|---|
| IRazorViewRenderer |
RequestAborted
Notifies when the connection underlying this request is aborted and thus request operations should be cancelled.
Declaration
public CancellationToken RequestAborted { get; }
Property Value
| Type | Description |
|---|---|
| CancellationToken |
SystemObjects
The current SystemObjects
Declaration
public SystemObjects SystemObjects { get; }
Property Value
| Type | Description |
|---|---|
| SystemObjects |
Variants
Get a dictionary of sorted lists of variants of the selected scope. The dictionary may be empty, e.g. if a Job is created by a trigger
Declaration
public IReadOnlyDictionary<ObjId, IReadOnlyList<CachedObject>> Variants { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<ObjId, IReadOnlyList<CachedObject>> |
Methods
CreateModelAsync(IEnumerable<ObjId>)
Create a page model from a list of object IDs
Declaration
public Task<NovaRazorModel> CreateModelAsync(IEnumerable<ObjId> objs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ObjId> | objs | The object IDs |
Returns
| Type | Description |
|---|---|
| Task<NovaRazorModel> | The page model |
GetObjectAsync(NovaObject)
Create an Nova object proxy used by Razor pages
Declaration
public Task<NovaRazorObject> GetObjectAsync(NovaObject obj)
Parameters
| Type | Name | Description |
|---|---|---|
| NovaObject | obj | The Nova object |
Returns
| Type | Description |
|---|---|
| Task<NovaRazorObject> | The Nova Razor Object proxy |
GetObjectAsync(ObjId)
Create an Nova object proxy used by Razor pages
Declaration
public Task<NovaRazorObject> GetObjectAsync(ObjId objId)
Parameters
| Type | Name | Description |
|---|---|---|
| ObjId | objId | The Nova object ID |
Returns
| Type | Description |
|---|---|
| Task<NovaRazorObject> | The Nova Razor Object proxy |
GetObjectAsync(Guid)
Create an Nova object proxy used by Razor pages
Declaration
public Task<NovaRazorObject> GetObjectAsync(Guid objGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | objGuid | The Nova object Guid |
Returns
| Type | Description |
|---|---|
| Task<NovaRazorObject> | The Nova Razor Object proxy |
GetObjectsAsync(IEnumerable<ObjId>)
Create a list of Nova object proxies used by Razor pages. The order of the result list corresponds to the enumeration order.
Declaration
public Task<IReadOnlyList<NovaRazorObject>> GetObjectsAsync(IEnumerable<ObjId> objIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ObjId> | objIds | The object IDs |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<NovaRazorObject>> | A list of Nova Razor Object proxies |
GetObjectsByTypeAsync(ObjId)
Get all objects of a specific type that are not deleted. MAY LOAD A LOT OF DATA!
Declaration
public Task<IReadOnlyList<NovaRazorObject>> GetObjectsByTypeAsync(ObjId typeId)
Parameters
| Type | Name | Description |
|---|---|---|
| ObjId | typeId | The object type ID |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<NovaRazorObject>> | The list of corresponding NovaRazorObjects |
GetSystemObject<T>(ObjId)
Create an Nova object proxy used by Razor pages
Declaration
public T GetSystemObject<T>(ObjId id) where T : NovaRazorObject
Parameters
| Type | Name | Description |
|---|---|---|
| ObjId | id | The id of the Nova cached object |
Returns
| Type | Description |
|---|---|
| T | The Nova Razor Object proxy |
Type Parameters
| Name | Description |
|---|---|
| T |
GetSystemObject<T>(Guid)
Create an Nova object proxy used by Razor pages
Declaration
public T GetSystemObject<T>(Guid guid) where T : NovaRazorObject
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guid | The Nova cached object GUID |
Returns
| Type | Description |
|---|---|
| T | The Nova Razor Object proxy |
Type Parameters
| Name | Description |
|---|---|
| T |
GetSystemObject<T>(string)
Create an Nova object proxy used by Razor pages
Declaration
public T GetSystemObject<T>(string apiIdentifier) where T : NovaRazorObject
Parameters
| Type | Name | Description |
|---|---|---|
| string | apiIdentifier | The ApiIdentifier of the Nova cached object |
Returns
| Type | Description |
|---|---|
| T | The Nova Razor Object proxy |
Type Parameters
| Name | Description |
|---|---|
| T |
SearchObjectsByValueAsync(ObjId, ScopedAttributeKey, object)
Search for objects of a specific type by value.
Declaration
public Task<IReadOnlyList<NovaRazorObject>> SearchObjectsByValueAsync(ObjId typeId, ScopedAttributeKey key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| ObjId | typeId | The object type ID |
| ScopedAttributeKey | key | The ScopedAttributeKey to search for |
| object | value | The value to search for |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<NovaRazorObject>> | The list of existing NovaRazorObjects in object ID order |
SearchObjectsByValueAsync(ScopedAttributeKey, object)
Search for objects of any type by value.
Declaration
public Task<IReadOnlyList<NovaRazorObject>> SearchObjectsByValueAsync(ScopedAttributeKey key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| ScopedAttributeKey | key | The ScopedAttributeKey to search for |
| object | value | The value to search for |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<NovaRazorObject>> | The list of existing NovaRazorObjects in object ID order |