Table of Contents

Class ShadowEditService

Namespace
Dynamicweb.CoreUI.Data.ShadowEditing
Assembly
Dynamicweb.CoreUI.dll

Creates, loads and persists the ShadowEdit instances that hold a user's pending, not yet committed modifications to a data model.

public sealed class ShadowEditService
Inheritance
ShadowEditService
Inherited Members

Constructors

ShadowEditService(ShadowEditRepositoryBase)

Creates, loads and persists the ShadowEdit instances that hold a user's pending, not yet committed modifications to a data model.

public ShadowEditService(ShadowEditRepositoryBase repository)

Parameters

repository ShadowEditRepositoryBase

Methods

DeleteShadowEdit(string)

Deletes the shadow edit with the given id, permanently discarding its pending modifications.

public void DeleteShadowEdit(string id)

Parameters

id string

The shadow edit id. Unknown ids are ignored.

GetShadowEdit(string)

Gets the shadow edit with the given id.

public ShadowEdit? GetShadowEdit(string id)

Parameters

id string

The shadow edit id.

Returns

ShadowEdit

The matching ShadowEdit, or null if none exists.

GetShadowEdit<T>(string)

Gets the shadow edit with the given id, typed to its data model.

public ShadowEdit<T>? GetShadowEdit<T>(string id)

Parameters

id string

The shadow edit id.

Returns

ShadowEdit<T>

The matching shadow edit, or null if no shadow edit has that id or it edits another model type.

Type Parameters

T

The data model type the shadow edit is expected to edit.

GetShadowEdit<T>(T?, DataQueryModelBase<T>?)

Starts editing a model by creating a shadow edit for it, assigning it a new id and persisting it.

public ShadowEdit<T> GetShadowEdit<T>(T? model, DataQueryModelBase<T>? query)

Parameters

model T

The model to edit, or null to resolve it from the query (or a new instance of T when there is no query).

query DataQueryModelBase<T>

The query the model originates from, or null when the model is not query bound.

Returns

ShadowEdit<T>

The newly created shadow edit, with no modifications applied yet.

Type Parameters

T

The data model type being edited.

Remarks

This always creates a new shadow edit; use GetShadowEdit<T>(string) to load an existing one.

GetShadowEdit<T>(T?, DataQueryModelBase<T>?, string?)

Starts editing a model by creating a shadow edit for it, assigning it a new id and persisting it.

public ShadowEdit<T> GetShadowEdit<T>(T? model, DataQueryModelBase<T>? query, string? id)

Parameters

model T

The model to edit, or null to resolve it from the query (or a new instance of T when there is no query).

query DataQueryModelBase<T>

The query the model originates from, or null when the model is not query bound.

id string

The shadow edit id to assign. If null, a new id is generated.

Returns

ShadowEdit<T>

The newly created shadow edit, with no modifications applied yet.

Type Parameters

T

The data model type being edited.

Remarks

This always creates a new shadow edit; use GetShadowEdit<T>(string) to load an existing one.

GetShadowEdits(Type)

Gets every shadow edit for the given data model type.

public IEnumerable<ShadowEdit> GetShadowEdits(Type modelType)

Parameters

modelType Type

The data model type the shadow edits belong to.

Returns

IEnumerable<ShadowEdit>

The matching shadow edits, or an empty sequence if there are none.

GetShadowEdits<T>()

Gets every shadow edit for the given data model type.

public IEnumerable<ShadowEdit<T>> GetShadowEdits<T>()

Returns

IEnumerable<ShadowEdit<T>>

The matching shadow edits, or an empty sequence if there are none.

Type Parameters

T

The data model type the shadow edits belong to.

HasKey(string)

Determines whether a shadow edit with the given id exists.

public bool HasKey(string key)

Parameters

key string

The shadow edit id to look for.

Returns

bool

true if a shadow edit with that id exists.

ResetShadowEdit(string)

Resets the shadow edit with the given id, discarding its modifications and rebuilding its baseline from the current model, and persists it.

public bool ResetShadowEdit(string id)

Parameters

id string

The shadow edit id.

Returns

bool

true if the shadow edit was found and reset; false if no shadow edit has that id.

Remarks

Call this after a save so that the shadow edit is kept alive, but compares subsequent edits against the newly committed values instead of the stale ones.

SaveShadowEdit(ShadowEdit)

Persists the shadow edit and its modifications, so it can be loaded again by its id.

public void SaveShadowEdit(ShadowEdit shadowEdit)

Parameters

shadowEdit ShadowEdit

The shadow edit to persist.

SaveShadowEdit<T>(ShadowEdit<T>)

Persists the shadow edit and its modifications, so it can be loaded again by its id.

public void SaveShadowEdit<T>(ShadowEdit<T> shadowEdit)

Parameters

shadowEdit ShadowEdit<T>

The shadow edit to persist.

Type Parameters

T

The data model type being edited.

To top