November Happy Hour will be moved to Thursday December 5th.

Class StoreDefinition

Maps a type bag into a collection of PropertyMaps

Inheritance
System.Object
StoreDefinition
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Data.Dynamic
Assembly: EPiServer.Data.dll
Version: 11.20.7
Syntax
public class StoreDefinition

Constructors

StoreDefinition(String, IList<PropertyMap>)

Declaration
[Obsolete("Use alternative constructor")]
public StoreDefinition(string storeName, IList<PropertyMap> mappings)
Parameters
Type Name Description
System.String storeName
System.Collections.Generic.IList<PropertyMap> mappings

StoreDefinition(String, IList<PropertyMap>, IDataStoreProviderFactory)

Declaration
public StoreDefinition(string storeName, IList<PropertyMap> mappings, IDataStoreProviderFactory dataStoreProviderFactory)
Parameters
Type Name Description
System.String storeName
System.Collections.Generic.IList<PropertyMap> mappings
IDataStoreProviderFactory dataStoreProviderFactory

Properties

ActiveMappings

Declaration
public IEnumerable<PropertyMap> ActiveMappings { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<PropertyMap>

AllMappings

Declaration
public IEnumerable<PropertyMap> AllMappings { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<PropertyMap>

CollectionMappings

Declaration
public IEnumerable<CollectionPropertyMap> CollectionMappings { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<CollectionPropertyMap>

DatabaseDateTimeKind

The DatabaseDateTimeKind property

Declaration
public DatabaseDateTimeKind DatabaseDateTimeKind { get; set; }
Property Value
Type Description
DatabaseDateTimeKind

EntityTypeId

Declaration
public int EntityTypeId { get; }
Property Value
Type Description
System.Int32

Id

Declaration
public int Id { get; }
Property Value
Type Description
System.Int32

InlineMappings

Declaration
public IEnumerable<InlinePropertyMap> InlineMappings { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<InlinePropertyMap>

MappingNames

Extract a collection of mapping names from the active mappings collection

Declaration
public IEnumerable<string> MappingNames { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.String>

A IEnumerable<string>

PendingDataMoves

Data moves not yet committed to the store

Declaration
public IEnumerable<DataMove> PendingDataMoves { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<DataMove>

ProviderMappings

Declaration
public IEnumerable<ProviderPropertyMap> ProviderMappings { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ProviderPropertyMap>

ReferenceMappings

Declaration
public IEnumerable<ReferencePropertyMap> ReferenceMappings { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ReferencePropertyMap>

StoreName

Declaration
public string StoreName { get; }
Property Value
Type Description
System.String

StoreRowsRequired

Get the number of rows in the data store the item represented by the current collection requires

Declaration
public int StoreRowsRequired { get; }
Property Value
Type Description
System.Int32

A System.Int32 indicating how many rows in the store are required for this type

TableName

Declaration
public string TableName { get; }
Property Value
Type Description
System.String

Version

Declaration
public int Version { get; }
Property Value
Type Description
System.Int32

Methods

ClearCache()

Clear the in-memory cache of store mappings

Declaration
public static void ClearCache()

Clone()

Declaration
public StoreDefinition Clone()
Returns
Type Description
StoreDefinition

CommitChanges()

Commit the changes done through the Remap and Rename methods to permanent storage

Declaration
public void CommitChanges()

CommitChanges(DataStoreProvider)

Commit the changes done through the Remap and Rename methods to permanent storage

Declaration
public void CommitChanges(DataStoreProvider provider)
Parameters
Type Name Description
DataStoreProvider provider

The DataStoreProvider to use when saving the changes

Create(String, IDictionary<String, Type>, StoreDefinitionParameters)

Creates a new or returns an existing StoreDefinition

Declaration
public static StoreDefinition Create(string storeName, IDictionary<string, Type> typeBag, StoreDefinitionParameters parameters)
Parameters
Type Name Description
System.String storeName

The name of the store to get the definition for

System.Collections.Generic.IDictionary<System.String, System.Type> typeBag

An IDictionary<string, Type> which is used to create the store mappings

StoreDefinitionParameters parameters

Parameters to use when creating the store mappings

Returns
Type Description
StoreDefinition

A StoreDefinition instance

Delete(String)

Delete the mappings for the store specified

Declaration
public static void Delete(string storeName)
Parameters
Type Name Description
System.String storeName

The name of the store to delete the mappings for

DeleteFromCache(String)

Delete the mappings from the in-memory cache for the store specified

Declaration
public static void DeleteFromCache(string storeName)
Parameters
Type Name Description
System.String storeName

The name of the store to delete the mappings for

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GenerateMappings(IEnumerable<KeyValuePair<String, Type>>, StoreDefinitionParameters, Int32)

Generates a collection of PropertyMap for the typeBag passed. This method is provided for mock support of DynamicDataStore

Declaration
public static IList<PropertyMap> GenerateMappings(IEnumerable<KeyValuePair<string, Type>> typeBag, StoreDefinitionParameters parameters, int version)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> typeBag

A IDictionary<string,Type> which is used to create the store mappings

StoreDefinitionParameters parameters

Parameters to use when creating the store mappings

System.Int32 version

The version number to assign to the mappings

Returns
Type Description
System.Collections.Generic.IList<PropertyMap>

A System.Collections.Generic.IList<T> instance

Get(String)

Returns a StoreDefinition or null if one does not exist for the storeName

Declaration
public static StoreDefinition Get(string storeName)
Parameters
Type Name Description
System.String storeName

The name of the store to get the definition for

Returns
Type Description
StoreDefinition

A StoreDefinition instancde

GetAll()

Returns a collection of all existing StoreDefinition objects

Declaration
public static IEnumerable<StoreDefinition> GetAll()
Returns
Type Description
System.Collections.Generic.IEnumerable<StoreDefinition>

A System.Collections.Generic.IEnumerable<T>

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

GetMapping(String)

Get the mapping with the specified name from the all mappings collection

Declaration
public PropertyMap GetMapping(string name)
Parameters
Type Name Description
System.String name

The name of the property to get

Returns
Type Description
PropertyMap

A PropertyMap with the name specified

Remap(IDictionary<String, Type>)

Remaps the store represented by the current instance using the type bag passed

Declaration
public void Remap(IDictionary<string, Type> typeBag)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.String, System.Type> typeBag

The type bag to use to generate the store mappings

Remap(IDictionary<String, Type>, StoreDefinitionParameters)

Remaps the store represented by the current instance using the type bag and StoreDefinitionParameters passed

Declaration
public void Remap(IDictionary<string, Type> typeBag, StoreDefinitionParameters parameters)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.String, System.Type> typeBag

The type bag to use to generate the store mappings

StoreDefinitionParameters parameters

Parameters to use when creating the store mappings

Remap(Type)

Remaps the store represented by the current instance using the Type passed

Declaration
public void Remap(Type type)
Parameters
Type Name Description
System.Type type

The Type to use to generate the store mappings

Remap(Type, StoreDefinitionParameters)

Remaps the store represented by the current instance using the Type and StoreDefinitionParameters passed

Declaration
public void Remap(Type type, StoreDefinitionParameters parameters)
Parameters
Type Name Description
System.Type type

The Type to use to generate the store mappings

StoreDefinitionParameters parameters

Parameters to use when creating the store mappings

RenameProperty(String, String)

Renames the property in the mappings

Declaration
public void RenameProperty(string oldName, string newName)
Parameters
Type Name Description
System.String oldName

The existing name of the property mapping

System.String newName

The new name of the property mapping

ValidateAgainstMappings(IDictionary<String, Type>, StoreDefinitionParameters, Boolean)

Validates the Type passed against the mappings held in the current instance

Declaration
public bool ValidateAgainstMappings(IDictionary<string, Type> typeBag, StoreDefinitionParameters parameters, bool throwIfDifferences)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.String, System.Type> typeBag

The type bag to use to generate the store mappings to compare to

StoreDefinitionParameters parameters

Parameters to use when generating the store mappings to compare to

System.Boolean throwIfDifferences

if true then an exception will be thrown if any mapping differences are found

Returns
Type Description
System.Boolean

true if the mappings generated match the current instance, otherwise false

Exceptions
Type Condition
StoreInconsistencyException

ValidateAgainstMappings(IDictionary<String, Type>, StoreDefinitionParameters, out IList<String>)

Validates the Type passed against the mappings held in the current instance

Declaration
public bool ValidateAgainstMappings(IDictionary<string, Type> typeBag, StoreDefinitionParameters parameters, out IList<string> errors)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.String, System.Type> typeBag

The type bag to use to generate the store mappings to compare to

StoreDefinitionParameters parameters

Parameters to use when generating the store mappings to compare to

System.Collections.Generic.IList<System.String> errors

The collection of error found when doing the validation

Returns
Type Description
System.Boolean

true if the mappings generated match the current instance, otherwise false

Exceptions
Type Condition
StoreInconsistencyException

ValidateAgainstMappings(IDictionary<String, Type>, Boolean)

Validates the Type passed against the mappings held in the current instance

Declaration
public bool ValidateAgainstMappings(IDictionary<string, Type> typeBag, bool throwIfDifferences)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.String, System.Type> typeBag

The type bag to use to generate the store mappings to compare to

System.Boolean throwIfDifferences

if true then an exception will be thrown if any mapping differences are found

Returns
Type Description
System.Boolean

true if the mappings generated match the current instance, otherwise false

Exceptions
Type Condition
StoreInconsistencyException

ValidateAgainstMappings(Type, StoreDefinitionParameters, Boolean)

Validates the Type passed against the mappings held in the current instance

Declaration
public bool ValidateAgainstMappings(Type type, StoreDefinitionParameters parameters, bool throwIfDifferences)
Parameters
Type Name Description
System.Type type

The Type to use to generate the store mappings to compare to

StoreDefinitionParameters parameters

Parameters to use when generating the store mappings to compare to

System.Boolean throwIfDifferences

if true then an exception will be thrown if any mapping differences are found

Returns
Type Description
System.Boolean

true if the mappings generated match the current instance, otherwise false

Exceptions
Type Condition
StoreInconsistencyException

ValidateAgainstMappings(Type, StoreDefinitionParameters, out IList<String>)

Validates the Type passed against the mappings held in the current instance

Declaration
public bool ValidateAgainstMappings(Type type, StoreDefinitionParameters parameters, out IList<string> errors)
Parameters
Type Name Description
System.Type type

The Type to use to generate the store mappings to compare to

StoreDefinitionParameters parameters

Parameters to use when generating the store mappings to compare to

System.Collections.Generic.IList<System.String> errors

The collection of error found when doing the validation

Returns
Type Description
System.Boolean

true if the mappings generated match the current instance, otherwise false

Exceptions
Type Condition
StoreInconsistencyException

ValidateAgainstMappings(Type, Boolean)

Validates the Type passed against the mappings held in the current instance

Declaration
public bool ValidateAgainstMappings(Type type, bool throwIfDifferences)
Parameters
Type Name Description
System.Type type

The Type to use to generate the store mappings to compare to

System.Boolean throwIfDifferences

if true then an exception will be thrown if any mapping differences are found

Returns
Type Description
System.Boolean

true if the mappings generated match the current instance, otherwise false

Exceptions
Type Condition
StoreInconsistencyException

Events

StoreDefinitionChanged

Raised when StoreDefinition be changed.

Declaration
public static event EventHandler<StoreDefinitionChangedEventArgs> StoreDefinitionChanged
Event Type
Type Description
System.EventHandler<StoreDefinitionChangedEventArgs>

Extension Methods