Share via


ClearDatabaseSchemaIfModelChanges<TContext> Class

Definition

An implementation of IDatabaseInitializer<TContext> that will DELETE all resources (e.g. tables, views, functions, and procedures) within a given database schema, and optionally re-seed the database only if the model has changed since the database was created. This implementation of IDatabaseInitializer<TContext> is useful if the current user only has permission to access resources within a particular database schema and not the entire database.

public class ClearDatabaseSchemaIfModelChanges<TContext> : Microsoft.WindowsAzure.Mobile.Service.ClearDatabaseSchemaAlways<TContext> where TContext : DbContext
type ClearDatabaseSchemaIfModelChanges<'Context (requires 'Context :> DbContext)> = class
    inherit ClearDatabaseSchemaAlways<'Context (requires 'Context :> DbContext)>
Public Class ClearDatabaseSchemaIfModelChanges(Of TContext)
Inherits ClearDatabaseSchemaAlways(Of TContext)

Type Parameters

TContext

The type of DbContext.

Inheritance
ClearDatabaseSchemaIfModelChanges<TContext>

Remarks

Whether or not the model has changed is determined by the CompatibleWithModel(Boolean) method. To seed the database create a derived class and override the Seed method.

Constructors

ClearDatabaseSchemaIfModelChanges<TContext>()

Initializes a new instance of the ClearDatabaseSchemaAlways<TContext> that will DELETE all resources from the default schema derived from the service name in case the model has changed.

ClearDatabaseSchemaIfModelChanges<TContext>(String)

Initializes a new instance of the ClearDatabaseSchemaIfModelChanges<TContext> class with a given schema.

Properties

Schema

Gets the schema to DELETE all resources from.

(Inherited from ClearDatabaseSchemaAlways<TContext>)

Methods

DeleteAllResourcesFromSchema(TContext)

DELETE all resources from the Schema.

(Inherited from ClearDatabaseSchemaAlways<TContext>)
InitializeDatabase(TContext)

Executes the strategy to initialize the database for the given context.

Applies to