Class DatabaseVersionValidator
Validates the database version against the supported assembly version.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Data
Assembly: EPiServer.Data.dll
Version: 8.11.0Syntax
[ServiceConfiguration(typeof(IDatabaseSchemaUpdater))]
public class DatabaseVersionValidator : IDatabaseSchemaUpdater
Constructors
DatabaseVersionValidator(IDatabaseHandler)
Initializes a new instance of the DatabaseVersionValidator class.
Declaration
public DatabaseVersionValidator(IDatabaseHandler databaseHandler)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseHandler | databaseHandler | The database handler. |
DatabaseVersionValidator(IDatabaseHandler, ScriptExecutor)
Initializes a new instance of the DatabaseVersionValidator class.
Declaration
public DatabaseVersionValidator(IDatabaseHandler databaseHandler, ScriptExecutor scriptExecutor)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseHandler | databaseHandler | The database handler. |
ScriptExecutor | scriptExecutor | The script executor |
Methods
GetDatabaseVersion()
Gets the database version.
Declaration
public virtual Version GetDatabaseVersion()
Returns
Type | Description |
---|---|
System.Version |
GetStatus(ConnectionStringsSection)
Called during startup to collect status of the databases.
Declaration
public DatabaseSchemaStatus GetStatus(ConnectionStringsSection connectionStrings)
Parameters
Type | Name | Description |
---|---|---|
System.Configuration.ConnectionStringsSection | connectionStrings | The current configured connection strings. |
Returns
Type | Description |
---|---|
DatabaseSchemaStatus | The handled database and the current version of the database. |
ThrowUpdateCodeException(Version, Version)
Throws an NotSupportedException exception saying that packages needs to be updated.
Declaration
public virtual void ThrowUpdateCodeException(Version databaseVersion, Version codeVersion)
Parameters
Type | Name | Description |
---|---|---|
System.Version | databaseVersion | The database version |
System.Version | codeVersion | The .NET code version |
ThrowUpdateDatabaseException(Version, Version)
Throws an NotSupportedException exception saying that database needs to be updated.
Declaration
public virtual void ThrowUpdateDatabaseException(Version databaseVersion, Version codeVersion)
Parameters
Type | Name | Description |
---|---|---|
System.Version | databaseVersion | The database version |
System.Version | codeVersion | The .NET code version |
Update(ConnectionStringSettings)
Called during startup if result from GetStatus(ConnectionStringsSection) has DatabaseVersion lower than ApplicationRequiredVersion and setting UpdateDatabaseSchema is true and no implemenation of IsDatabaseUpdateAllowed(ConnectionStringSettings) prevents automatic update.
Declaration
public void Update(ConnectionStringSettings connectionStringSettings)
Parameters
Type | Name | Description |
---|---|---|
System.Configuration.ConnectionStringSettings | connectionStringSettings | The connection string settings returned from GetStatus(ConnectionStringsSection) |
ValidateDatabaseVersion(Version)
Validates the database version.
Declaration
public virtual void ValidateDatabaseVersion(Version supportedVersion)
Parameters
Type | Name | Description |
---|---|---|
System.Version | supportedVersion |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Will be thrown if the database version not maches the supported version. |