Class SqlServerDataStoreProvider

Inheritance
System.Object
SqlServerDataStoreProvider
Inherited Members
Namespace: EPiServer.Data.Dynamic.Providers
Assembly: EPiServer.Data.dll
Version: 12.0.3
Syntax
[ServiceConfiguration(IncludeServiceAccessor = false)]
public class SqlServerDataStoreProvider : DbDataStoreProvider

Constructors

SqlServerDataStoreProvider()

Declaration
public SqlServerDataStoreProvider()

Methods

CanMoveDataBetweenProperties(InlinePropertyMap, InlinePropertyMap)

Declaration
public override bool CanMoveDataBetweenProperties(InlinePropertyMap fromProperty, InlinePropertyMap toProperty)
Parameters
Type Name Description
InlinePropertyMap fromProperty
InlinePropertyMap toProperty
Returns
Type Description
System.Boolean
Overrides

ConvertToGuid(Object)

Declaration
protected override Guid ConvertToGuid(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Guid
Overrides

CreateParameter(String, DbType, ParameterDirection, Object)

Declaration
protected override IDbDataParameter CreateParameter(string name, DbType dbType, ParameterDirection direction, object value)
Parameters
Type Name Description
System.String name
System.Data.DbType dbType
System.Data.ParameterDirection direction
System.Object value
Returns
Type Description
System.Data.IDbDataParameter
Overrides

CreateParameter(String, Object)

Declaration
public override IDbDataParameter CreateParameter(string name, object value)
Parameters
Type Name Description
System.String name
System.Object value
Returns
Type Description
System.Data.IDbDataParameter
Overrides

GetCreateSaveSPCommandText(StoreDefinition)

Declaration
protected override string GetCreateSaveSPCommandText(StoreDefinition storeDefinition)
Parameters
Type Name Description
StoreDefinition storeDefinition
Returns
Type Description
System.String
Overrides

GetCreateViewCommandText(StoreDefinition)

Declaration
protected override string GetCreateViewCommandText(StoreDefinition storeDefinition)
Parameters
Type Name Description
StoreDefinition storeDefinition
Returns
Type Description
System.String
Overrides

GetDeleteAllProcedureCommand(String)

Declaration
protected override DbCommand GetDeleteAllProcedureCommand(string storeName)
Parameters
Type Name Description
System.String storeName
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetDeleteExcessReferencesCommand(Int64, String, Int32)

Declaration
protected override DbCommand GetDeleteExcessReferencesCommand(long id, string propertyName, int startIndex)
Parameters
Type Name Description
System.Int64 id
System.String propertyName
System.Int32 startIndex
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetDeleteProcedureCommand(Identity)

Declaration
protected override DbCommand GetDeleteProcedureCommand(Identity id)
Parameters
Type Name Description
Identity id
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetDropSaveSPCommandText(String)

Declaration
protected override string GetDropSaveSPCommandText(string storeName)
Parameters
Type Name Description
System.String storeName
Returns
Type Description
System.String
Overrides

GetDropViewCommandText(String)

Declaration
protected override string GetDropViewCommandText(string storeName)
Parameters
Type Name Description
System.String storeName
Returns
Type Description
System.String
Overrides

GetEntityReferenceCountCommand(IEntity)

Creates a command that returns the number of Dynamic Data Store objects that reference a specific IEntity.

Declaration
protected override DbCommand GetEntityReferenceCountCommand(IEntity entity)
Parameters
Type Name Description
IEntity entity

The IEntity for which reference should be counted.

Returns
Type Description
System.Data.Common.DbCommand

An System.Data.IDbCommand instance that should be run by calling ExecuteScalar to return the number of references.

Overrides

GetLoadCollectionCommand(Identity, String)

Declaration
protected override DbCommand GetLoadCollectionCommand(Identity id, string propertyName)
Parameters
Type Name Description
Identity id
System.String propertyName
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetLoadCommand(String, IDictionary<String, Object>, IEnumerable<InlinePropertyMap>)

Declaration
protected override DbCommand GetLoadCommand(string storeName, IDictionary<string, object> parameters, IEnumerable<InlinePropertyMap> inlineProperties)
Parameters
Type Name Description
System.String storeName
System.Collections.Generic.IDictionary<System.String, System.Object> parameters
System.Collections.Generic.IEnumerable<InlinePropertyMap> inlineProperties
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetLoadReferencesCommand(Identity)

Declaration
protected override DbCommand GetLoadReferencesCommand(Identity id)
Parameters
Type Name Description
Identity id
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetMoveDataCommand(StoreDefinition)

Declaration
protected override DbCommand GetMoveDataCommand(StoreDefinition storeDefinition)
Parameters
Type Name Description
StoreDefinition storeDefinition
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetProviderSpecificParameterName(String)

Return the decorated parameter name as used by MS SQL Server

Declaration
protected virtual string GetProviderSpecificParameterName(string name)
Parameters
Type Name Description
System.String name

The parameter name

Returns
Type Description
System.String

The decorated parameter name

GetQueryObject<T>(DynamicDataStore, LoadAsObjectType)

Declaration
protected override Query<T> GetQueryObject<T>(DynamicDataStore store, LoadAsObjectType loadObjectAs)
Parameters
Type Name Description
DynamicDataStore store
LoadAsObjectType loadObjectAs
Returns
Type Description
Query<T>
Type Parameters
Name Description
T
Overrides

GetSaveInlinePropertiesCommand(ProviderCallContext)

Declaration
protected override DbCommand GetSaveInlinePropertiesCommand(ProviderCallContext context)
Parameters
Type Name Description
ProviderCallContext context
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetSaveReferencePropertyCommand(PropertyMapType, DbType, Int64, String, Boolean, Int32, Type, Type, String, String, Object)

Declaration
protected override DbCommand GetSaveReferencePropertyCommand(PropertyMapType propertyType, DbType dataType, long id, string propertyName, bool isKey, int index, Type collectionType, Type elementType, string elementStoreName, string columnName, object value)
Parameters
Type Name Description
PropertyMapType propertyType
System.Data.DbType dataType
System.Int64 id
System.String propertyName
System.Boolean isKey
System.Int32 index
System.Type collectionType
System.Type elementType
System.String elementStoreName
System.String columnName
System.Object value
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetSaveReferencePropertyCommand(PropertyMapType, Int64, String, Boolean, Int32, Type, Type, String, IList<Tuple<String, Object, DbType>>)

Declaration
protected override DbCommand GetSaveReferencePropertyCommand(PropertyMapType propertyType, long id, string propertyName, bool isKey, int index, Type collectionType, Type elementType, string elementStoreName, IList<Tuple<string, object, DbType>> columnValues)
Parameters
Type Name Description
PropertyMapType propertyType
System.Int64 id
System.String propertyName
System.Boolean isKey
System.Int32 index
System.Type collectionType
System.Type elementType
System.String elementStoreName
System.Collections.Generic.IList<System.Tuple<System.String, System.Object, System.Data.DbType>> columnValues
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetStoreInfoDeleteCommand(String)

Gets the store info command delete.

Declaration
protected override DbCommand GetStoreInfoDeleteCommand(string storeName)
Parameters
Type Name Description
System.String storeName

Name of the store.

Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetStoreInfoLoadCommand(String, Boolean)

Gets the store info command load.

Declaration
protected override DbCommand GetStoreInfoLoadCommand(string storeName, bool loadInactiveProperties)
Parameters
Type Name Description
System.String storeName

Name of the store.

System.Boolean loadInactiveProperties

Set to true if properties belonging to old mapping of store should be included

Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetStoreInfoSaveCommand(StoreDefinition)

Get the 'Store Info Save' command

Declaration
protected override DbCommand GetStoreInfoSaveCommand(StoreDefinition storeDefinition)
Parameters
Type Name Description
StoreDefinition storeDefinition

The StoreDefinition to save

Returns
Type Description
System.Data.Common.DbCommand

An System.Data.IDbCommand instance

Overrides

GetStoreNameForItemCommand(Identity, String)

Declaration
protected override DbCommand GetStoreNameForItemCommand(Identity id, string tableName)
Parameters
Type Name Description
Identity id
System.String tableName
Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetStoreNamesCommandText()

Declaration
protected override string GetStoreNamesCommandText()
Returns
Type Description
System.String
Overrides

GetStoreSaveProcedureName(String)

Declaration
protected override string GetStoreSaveProcedureName(string storeName)
Parameters
Type Name Description
System.String storeName
Returns
Type Description
System.String
Overrides

GetStoreViewName(String)

Declaration
public override string GetStoreViewName(string storeName)
Parameters
Type Name Description
System.String storeName
Returns
Type Description
System.String
Overrides

GetTableInformation(String)

Declaration
public override TableInformation GetTableInformation(string tableName)
Parameters
Type Name Description
System.String tableName
Returns
Type Description
TableInformation
Overrides

GetUpdateIndexCommand(Int64, String, Boolean, Int32)

Gets the update index command, which updates the index property in a collection or dictionary for a specific property for a specific item. The index will be updated to an index outside of the current list, to continue holding a reference to an existing object.

Declaration
protected override DbCommand GetUpdateIndexCommand(long id, string propertyName, bool isKey, int startIndex)
Parameters
Type Name Description
System.Int64 id

The identity of the item, which will have one of it's properties updated.

System.String propertyName

Name of the property for which the index will be updated.

System.Boolean isKey

If set to true, the property will update the key part of a dictionary. If set to false, the property will update the value part on a dictionary or collection.

System.Int32 startIndex

The start index from where the index update should start. All items from the start index will be updated.

Returns
Type Description
System.Data.Common.DbCommand

A database command containing the update SQL for the index of a collection or dictionary.

Overrides

GetUpdatePropertyNameInReferenceTableCommand(PropertyMap, StoreDefinition)

Get an System.Data.IDbCommand instance, containing update statement for the property name in the reference table

Declaration
protected override DbCommand GetUpdatePropertyNameInReferenceTableCommand(PropertyMap propertyMap, StoreDefinition storeDefinition)
Parameters
Type Name Description
PropertyMap propertyMap

Property map containing old property name and new property name

StoreDefinition storeDefinition

The storeDefinition for the store

Returns
Type Description
System.Data.Common.DbCommand

An System.Data.IDbCommand instance

Overrides

GetUpdateReferencesPropertyNameCommand(String, String, String, String)

Gets the command to update References' names.

Declaration
public override DbCommand GetUpdateReferencesPropertyNameCommand(string storeName, string tableName, string oldPropertyName, string newPropertyName)
Parameters
Type Name Description
System.String storeName

Name of the store.

System.String tableName

Name of the CustomBigtable

System.String oldPropertyName

The old Name of the Property

System.String newPropertyName

The new Name of the Property

Returns
Type Description
System.Data.Common.DbCommand
Overrides

GetValueOverflowCountCommand(String, DbType, String, String, Type, Object, Object)

Declaration
protected override DbCommand GetValueOverflowCountCommand(string storeName, DbType dataType, string dbDeclarationType, string propertyName, Type dbType, object minValue, object maxValue)
Parameters
Type Name Description
System.String storeName
System.Data.DbType dataType
System.String dbDeclarationType
System.String propertyName
System.Type dbType
System.Object minValue
System.Object maxValue
Returns
Type Description
System.Data.Common.DbCommand
Overrides

IsProviderSpecificException(Exception)

Determines if an exception is specific to the data provider or a standard .NET exception

Declaration
public override bool IsProviderSpecificException(Exception exception)
Parameters
Type Name Description
System.Exception exception

The exception to check

Returns
Type Description
System.Boolean

true if the exception is data provider specific, otherwise false

Overrides

ProcessValueFromDb(Type, Object, String, ProviderCallContext, Type)

Declaration
protected override object ProcessValueFromDb(Type targetType, object value, string name, ProviderCallContext context, Type targetParentType)
Parameters
Type Name Description
System.Type targetType
System.Object value
System.String name
ProviderCallContext context
System.Type targetParentType
Returns
Type Description
System.Object
Overrides

ProcessValueToDb(DbType, String, Object, ProviderCallContext)

Declaration
protected override object ProcessValueToDb(DbType dataType, string name, object value, ProviderCallContext context)
Parameters
Type Name Description
System.Data.DbType dataType
System.String name
System.Object value
ProviderCallContext context
Returns
Type Description
System.Object
Overrides

ReservedColNames()

Declaration
protected string[] ReservedColNames()
Returns
Type Description
System.String[]

SaveStoreDefinition(StoreDefinition)

Sql Server has it's own version of this as we need to drop the views and sp's first if they already exist before re-creating them

Declaration
public override void SaveStoreDefinition(StoreDefinition storeDefinition)
Parameters
Type Name Description
StoreDefinition storeDefinition
Overrides

Extension Methods