Share via


ClearDatabaseSchemaIfModelChanges<TContext> Class

 

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.

Namespace:   Microsoft.WindowsAzure.Mobile.Service
Assembly:  Microsoft.WindowsAzure.Mobile.Service.Entity (in Microsoft.WindowsAzure.Mobile.Service.Entity.dll)

Inheritance Hierarchy

System.Object
  System.Data.Entity.CreateDatabaseIfNotExists<TContext>
    Microsoft.WindowsAzure.Mobile.Service.ClearDatabaseSchemaAlways<TContext>
      Microsoft.WindowsAzure.Mobile.Service.ClearDatabaseSchemaIfModelChanges<TContext>

Syntax

public class ClearDatabaseSchemaIfModelChanges<TContext> : ClearDatabaseSchemaAlways<TContext>
where TContext : DbContext
generic<typename TContext>
where TContext : DbContext
public ref class ClearDatabaseSchemaIfModelChanges : ClearDatabaseSchemaAlways<TContext>
type ClearDatabaseSchemaIfModelChanges<'TContext when 'TContext : DbContext> = 
    class
        inherit ClearDatabaseSchemaAlways<'TContext>
    end
Public Class ClearDatabaseSchemaIfModelChanges(Of TContext As DbContext)
    Inherits ClearDatabaseSchemaAlways(Of TContext)

Type Parameters

Constructors

Name Description
System_CAPS_pubmethod 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.

System_CAPS_pubmethod ClearDatabaseSchemaIfModelChanges<TContext>(String)

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

Properties

Name Description
System_CAPS_protproperty Schema

Gets the schema to DELETE all resources from.(Inherited from ClearDatabaseSchemaAlways<TContext>.)

Methods

Name Description
System_CAPS_protmethod DeleteAllResourcesFromSchema(TContext)

DELETE all resources from the Schema.(Inherited from ClearDatabaseSchemaAlways<TContext>.)

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod InitializeDatabase(TContext)

(Overrides ClearDatabaseSchemaAlways<TContext>.InitializeDatabase(TContext).)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethod Seed(TContext)

(Inherited from CreateDatabaseIfNotExists<TContext>.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.WindowsAzure.Mobile.Service Namespace

Return to top