Class DynamicDataStore
Base class for DynamicDataStore implementations
Implements
Inherited Members
Namespace: EPiServer.Data.Dynamic
Assembly: EPiServer.Data.dll
Version: 9.12.2Syntax
public abstract class DynamicDataStore : IDisposable
Remarks
All Methods and Properties that required storage access are abstract fpr mockability. Concerete implementations of those methods are implemented with the 'Internal' prefix to allow derived classes to take advantage if the in-build functionality
Constructors
DynamicDataStore(StoreDefinition)
Declaration
protected DynamicDataStore(StoreDefinition storeDefinition)
Parameters
Type | Name | Description |
---|---|---|
StoreDefinition | storeDefinition |
Properties
CachedStoreDefinition
Declaration
protected virtual StoreDefinition CachedStoreDefinition { get; }
Property Value
Type | Description |
---|---|
StoreDefinition |
DataStoreProvider
The store's DataStoreProvider
Declaration
public abstract DataStoreProvider DataStoreProvider { get; set; }
Property Value
Type | Description |
---|---|
DataStoreProvider |
FallbackTypeResolver
Declaration
public FallbackTypeResolverEventHandler FallbackTypeResolver { get; set; }
Property Value
Type | Description |
---|---|
FallbackTypeResolverEventHandler |
InternalDataStoreProvider
The data store provider for the store
Declaration
protected virtual DataStoreProvider InternalDataStoreProvider { get; set; }
Property Value
Type | Description |
---|---|
DataStoreProvider |
InternalName
The name of the store
Declaration
protected virtual string InternalName { get; }
Property Value
Type | Description |
---|---|
System.String |
InternalStoreDefinition
A copy of the StoreDefinition being used by the store
Declaration
protected virtual StoreDefinition InternalStoreDefinition { get; }
Property Value
Type | Description |
---|---|
StoreDefinition |
Remarks
Any changes made to the returned store definition are not automatically reflected in this instance. Call the Refresh method to update this instance with the lastest StoreDefinition
KeepObjectsInContext
Gets or sets a value indicating whether this instance should keep loaded/saved objects in its context.
Declaration
public virtual bool KeepObjectsInContext { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
To be able to recognize that a "POCO" (that is an object with no Id parameter) object is the same object instance between several operations (e.g. a Load followed by a Save) this value should be set to true.
If the same instance is used for many Load/Save operations then the context might hold references to many objects if this value is true.
Name
The name of the current store
Declaration
public abstract string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
StoreDefinition
The StoreDefinition for the current store
Declaration
public abstract StoreDefinition StoreDefinition { get; }
Property Value
Type | Description |
---|---|
StoreDefinition |
TypeHandlers
Declaration
protected virtual IDictionary<Type, ITypeHandler> TypeHandlers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Type, ITypeHandler> |
TypeToStoreMap
Declaration
protected virtual IDictionary<Type, string> TypeToStoreMap { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Type, System.String> |
Methods
Delete(Identity)
Delete an item from the store
Declaration
public abstract void Delete(Identity id)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | The Identity of the item to delete |
Delete(Object)
Delete an item from the store
Declaration
public abstract void Delete(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to delete from the store.
The Identity of the item to delete must be able to be derived from |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if the Identity of |
DeleteAll()
Delete all items in the store
Declaration
public abstract void DeleteAll()
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Find(IDictionary<String, Object>)
Find objects of from the store that match the conditions and return them as as the same .NET they were saved as
Declaration
public abstract IEnumerable<object> Find(IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | parameters | An dictionary containing property names and values to use when finding objects |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | Enumeration of System.Object |
Find(String, Object)
Find objects of from the store that match the condition and return them as the same .NET class they were saved as
Declaration
public abstract IEnumerable<object> Find(string propertyName, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property to use when finding objects |
System.Object | value | The value of the property to match to |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | Enumeration of System.Object |
Find<TResult>(IDictionary<String, Object>)
Find objects of from the store that match the conditions and return them as as TResult instances
Declaration
public abstract IEnumerable<TResult> Find<TResult>(IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | parameters | An dictionary containing property names and values to use when finding objects |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TResult> | Enumeration of TResult |
Type Parameters
Name | Description |
---|---|
TResult | The System.Type the properties for each store item will be loaded into |
Find<TResult>(String, Object)
Find objects of from the store that match the condition and return them as TResult instances
Declaration
public abstract IEnumerable<TResult> Find<TResult>(string propertyName, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property to use when finding objects |
System.Object | value | The value of the property to match to |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TResult> | Enumeration of TResult |
Type Parameters
Name | Description |
---|---|
TResult | The System.Type the properties for each store item will be loaded into |
FindAsPropertyBag(IDictionary<String, Object>)
Find objects of from the store that match the conditions and return them as as PropertyBag instances
Declaration
public abstract IEnumerable<PropertyBag> FindAsPropertyBag(IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | parameters | An dictionary containing property names and values to use when finding objects |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PropertyBag> | Enumeration of PropertyBag |
FindAsPropertyBag(String, Object)
Find objects of from the store that match the condition and return them as PropertyBag instances
Declaration
public abstract IEnumerable<PropertyBag> FindAsPropertyBag(string propertyName, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property to use when finding objects |
System.Object | value | The value of the property to match to |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PropertyBag> | Enumeration of PropertyBag |
InternalDelete(Identity)
Delete an item from the store
Declaration
protected virtual void InternalDelete(Identity id)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | The Identity of the item to delete |
InternalDelete(Object)
Delete an item from the store
Declaration
protected virtual void InternalDelete(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to delete from the store.
The Identity of the item to delete must be able to be derived from |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if the Identity of |
InternalDeleteAll()
Delete all items in the store
Declaration
protected virtual void InternalDeleteAll()
InternalLoad(Identity, out IDictionary<Identity, Object>)
Declaration
protected virtual object InternalLoad(Identity id, out IDictionary<Identity, object> loadedItems)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | |
System.Collections.Generic.IDictionary<Identity, System.Object> | loadedItems |
Returns
Type | Description |
---|---|
System.Object |
InternalLoad(Identity, Type, LoadAsObjectType, ProviderCallContext)
Declaration
protected virtual object InternalLoad(Identity id, Type type, LoadAsObjectType loadAs, ProviderCallContext parentContext)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | |
System.Type | type | |
LoadAsObjectType | loadAs | |
ProviderCallContext | parentContext |
Returns
Type | Description |
---|---|
System.Object |
InternalRefresh()
Refreshes the store's definition and local copies of globals caches. The internal identity map for this store instance is cleared.
Declaration
protected virtual void InternalRefresh()
InternalSave(Identity, Object, TypeToStoreMapper, ProviderCallContext)
Declaration
protected virtual Identity InternalSave(Identity id, object value, TypeToStoreMapper typeToStoreMapper, ProviderCallContext parentContext)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | |
System.Object | value | |
TypeToStoreMapper | typeToStoreMapper | |
ProviderCallContext | parentContext |
Returns
Type | Description |
---|---|
Identity |
Items()
An ordered queryable to allow Linq operations to be performed against the store
Declaration
public abstract IOrderedQueryable<object> Items()
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<System.Object> | An System.Linq.IOrderedQueryable of System.Object |
Items<TResult>()
An ordered queryable to allow Linq operations to be performed against the store
Declaration
public abstract IOrderedQueryable<TResult> Items<TResult>()
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TResult> | An System.Linq.IOrderedQueryable of TResult |
Type Parameters
Name | Description |
---|---|
TResult | The System.Type the properties for each store item will be loaded into |
ItemsAsPropertyBag()
An ordered queryable to allow Linq operations to be performed against the store
Declaration
public abstract IOrderedQueryable<PropertyBag> ItemsAsPropertyBag()
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<PropertyBag> | An System.Linq.IOrderedQueryable of PropertyBag |
Load(Identity)
Load an instance of an object from the store as the same .NET class it was saved as
Declaration
public abstract object Load(Identity id)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | The Identity of the item to load |
Returns
Type | Description |
---|---|
System.Object | The native object stored in the store. If the item was originally saved in a PropertyBag then a PropertyBag will be returned otherwise an instance of the System.Type originally saved will be returned. |
Load<TResult>(Identity)
Load an instance of an object from the store into a TResult
Declaration
public abstract TResult Load<TResult>(Identity id)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | The Identity of the item to load |
Returns
Type | Description |
---|---|
TResult | An instance of TResult |
Type Parameters
Name | Description |
---|---|
TResult | The System.Type the properties for each store item will be loaded into |
LoadAll()
Loads all objects from the store as the same .NET class they were saved as
Declaration
public abstract IEnumerable<object> LoadAll()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | Enumeration of System.Object |
LoadAll<TResult>()
Loads all objects from the store as TResult instances
Declaration
public abstract IEnumerable<TResult> LoadAll<TResult>()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TResult> | Enumeration of TResult |
Type Parameters
Name | Description |
---|---|
TResult | The System.Type the properties for each store item will be loaded into |
LoadAllAsPropertyBag()
Loads all objects from the store as PropertyBag instances
Declaration
public abstract IEnumerable<PropertyBag> LoadAllAsPropertyBag()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PropertyBag> | Enumeration of PropertyBag |
LoadAsPropertyBag(Identity)
Load an instance of an object from the store into a PropertyBag
Declaration
public abstract PropertyBag LoadAsPropertyBag(Identity id)
Parameters
Type | Name | Description |
---|---|---|
Identity | id | The identity of the item to load |
Returns
Type | Description |
---|---|
PropertyBag | An instance of PropertyBag or null if the item was not found in the store |
Refresh()
Refresh any cached properties from their source
Declaration
public abstract void Refresh()
RegisterDeletedAllEventHandler(String, EventHandler<ItemEventArgs>)
Register event fired when a DeletedAll for an store
Declaration
public static void RegisterDeletedAllEventHandler(string storeName, EventHandler<ItemEventArgs> eventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
System.EventHandler<ItemEventArgs> | eventHandler | Eventhandler to register |
RegisterItemDeletedEventHandler(String, EventHandler<ItemEventArgs>)
Register event fired when a store is Deleted
Declaration
public static void RegisterItemDeletedEventHandler(string storeName, EventHandler<ItemEventArgs> eventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
System.EventHandler<ItemEventArgs> | eventHandler | Eventhandler to register |
RegisterItemSavedEventHandler(String, EventHandler<ItemEventArgs>)
Register event fired when a store is saved
Declaration
public static void RegisterItemSavedEventHandler(string storeName, EventHandler<ItemEventArgs> eventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
System.EventHandler<ItemEventArgs> | eventHandler | Eventhandler to register |
Save(Object)
Save value
in the store
Declaration
public abstract Identity Save(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to save |
Returns
Type | Description |
---|---|
Identity | The identity of the saved object |
Save(Object, TypeToStoreMapper)
Save value
in the store
Declaration
public abstract Identity Save(object value, TypeToStoreMapper typeToStoreMapper)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to save |
TypeToStoreMapper | typeToStoreMapper | A delegate of type TypeToStoreMapper to use when mapping properties to stores |
Returns
Type | Description |
---|---|
Identity | The identity of the saved object |
Save(Object, Identity)
Save value
in the store
Declaration
public abstract Identity Save(object value, Identity id)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to save |
Identity | id | The id saved the object under |
Returns
Type | Description |
---|---|
Identity | The identity of the saved object |
Save(Object, Identity, TypeToStoreMapper)
Save value
in the store
Declaration
public abstract Identity Save(object value, Identity id, TypeToStoreMapper typeToStoreMapper)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to save |
Identity | id | The id saved the object under |
TypeToStoreMapper | typeToStoreMapper | A delegate of type TypeToStoreMapper to use when mapping properties to stores |
Returns
Type | Description |
---|---|
Identity | The identity of the saved object |
UnregisterDeletedAllEventHandler(String, EventHandler<ItemEventArgs>)
UnRegister event DeleteAll for an specific store
Declaration
public static void UnregisterDeletedAllEventHandler(string storeName, EventHandler<ItemEventArgs> eventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
System.EventHandler<ItemEventArgs> | eventHandler | Eventhandler to Unregister |
UnregisterItemDeletedEventHandler(String, EventHandler<ItemEventArgs>)
UnRegister event delete for an specific store
Declaration
public static void UnregisterItemDeletedEventHandler(string storeName, EventHandler<ItemEventArgs> eventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
System.EventHandler<ItemEventArgs> | eventHandler | Eventhandler to Unregister |
UnregisterItemSavedEventHandler(String, EventHandler<ItemEventArgs>)
UnRegister event save for an specific store
Declaration
public static void UnregisterItemSavedEventHandler(string storeName, EventHandler<ItemEventArgs> eventHandler)
Parameters
Type | Name | Description |
---|---|---|
System.String | storeName | Name of the store. |
System.EventHandler<ItemEventArgs> | eventHandler | Eventhandler to Unregister |
Update<TStore>()
Declaration
public virtual IUpdateQueryable<TStore> Update<TStore>()
Returns
Type | Description |
---|---|
IUpdateQueryable<TStore> |
Type Parameters
Name | Description |
---|---|
TStore |