C# Class Castle.ActiveRecord.AR

Performs the framework initialization.
This class is not thread safe.
显示文件 Open project: shosca/ActiveRecord Class Usage Examples

Public Methods

Method Description
Configure ( ) : DefaultActiveRecordConfiguration

Builds a fluent configuration for general ActiveRecord settings.

CreateSchema ( ) : void

Generates and executes the creation scripts for the database.

CreateSchema ( Type baseClass ) : void

Generates and executes the creation scripts for the database using the specified baseClass to know which database it should create the schema for.

CurrentScope ( ) : ISessionScope

Gets the current scope

DisposeCurrentScope ( ) : void

Disposes the current scope

DropSchema ( ) : void

Generates and executes the Drop scripts for the database.

DropSchema ( Type baseClass ) : void

Generates and executes the Drop scripts for the database using the specified baseClass to know which database it should create the scripts for.

GenerateCreationScripts ( String fileName ) : void

Generates the creation scripts for the database

If ActiveRecord was configured to access more than one database, a file is going to be generate for each, based on the path and the fileName specified.

GenerateCreationScripts ( Type baseType, String fileName ) : void

Generates the creation scripts for the database The baseType is used to identify which database should we act upon.

GenerateDropScripts ( String fileName ) : void

Generates the drop scripts for the database saving them to the supplied file name.

If ActiveRecord was configured to access more than one database, a file is going to be generate for each, based on the path and the fileName specified.

GenerateDropScripts ( Type baseType, String fileName ) : void

Generates the drop scripts for the database saving them to the supplied file name. The baseType is used to identify which database should we act upon.

Initialize ( ) : void

Initializes the framework reading the configuration from the AppDomain and checking all the types on the executing Assembly

Initialize ( this source ) : void

Initialize the mappings using the configuration and checking all the types on the specified Assemblies

ResetInitialization ( ) : void

Intended to be used only by test cases

UpdateSchema ( ) : IList

Generates and executes the creation scripts for the database.

UpdateSchema ( Type baseClass ) : IList

Generates and executes the creation scripts for the database using the specified baseClass to know which database it should create the schema for.

Private Methods

Method Description
CheckInitialized ( ) : void
CreateAnotherFile ( string originalFileName, int fileCount ) : string

Generate a file name based on the original file name specified, using the count to give it some order.

CreateSchemaExport ( NHibernate.Cfg.Configuration cfg ) : NHibernate.Tool.hbm2ddl.SchemaExport
CreateSchemaUpdate ( NHibernate.Cfg.Configuration cfg ) : NHibernate.Tool.hbm2ddl.SchemaUpdate
CreateSessionFactoryAndRegisterToHolder ( IActiveRecordConfiguration source ) : void

Initialize the mappings using the configuration and the list of types

CreateSessionFactoryHolderImplementation ( IActiveRecordConfiguration source ) : ISessionFactoryHolder
RaiseOnConfigurationCreated ( NHibernate.Cfg.Configuration cfg, SessionFactoryConfig sessionFactoryConfig ) : void
RaiseOnHbmMappingCreated ( NHibernate.Cfg.MappingSchema.HbmMapping mapping, SessionFactoryConfig sessionFactoryConfig ) : void
RaiseOnMapperCreated ( NHibernate.Mapping.ByCode.ConventionModelMapper mapper, SessionFactoryConfig sessionFactoryConfig ) : void
RaiseSessionFactoryCreated ( ISessionFactory sf, NHibernate cfg, string name ) : void
RaiseSessionFactoryHolderCreated ( ISessionFactoryHolder holder ) : void

Method Details

Configure() public static method

Builds a fluent configuration for general ActiveRecord settings.
public static Configure ( ) : DefaultActiveRecordConfiguration
return DefaultActiveRecordConfiguration

CreateSchema() public static method

Generates and executes the creation scripts for the database.
public static CreateSchema ( ) : void
return void

CreateSchema() public static method

Generates and executes the creation scripts for the database using the specified baseClass to know which database it should create the schema for.
public static CreateSchema ( Type baseClass ) : void
baseClass System.Type
return void

CurrentScope() public static method

Gets the current scope
public static CurrentScope ( ) : ISessionScope
return ISessionScope

DisposeCurrentScope() public static method

Disposes the current scope
public static DisposeCurrentScope ( ) : void
return void

DropSchema() public static method

Generates and executes the Drop scripts for the database.
public static DropSchema ( ) : void
return void

DropSchema() public static method

Generates and executes the Drop scripts for the database using the specified baseClass to know which database it should create the scripts for.
public static DropSchema ( Type baseClass ) : void
baseClass System.Type
return void

GenerateCreationScripts() public static method

Generates the creation scripts for the database
If ActiveRecord was configured to access more than one database, a file is going to be generate for each, based on the path and the fileName specified.
public static GenerateCreationScripts ( String fileName ) : void
fileName String
return void

GenerateCreationScripts() public static method

Generates the creation scripts for the database The baseType is used to identify which database should we act upon.
public static GenerateCreationScripts ( Type baseType, String fileName ) : void
baseType System.Type
fileName String
return void

GenerateDropScripts() public static method

Generates the drop scripts for the database saving them to the supplied file name.
If ActiveRecord was configured to access more than one database, a file is going to be generate for each, based on the path and the fileName specified.
public static GenerateDropScripts ( String fileName ) : void
fileName String
return void

GenerateDropScripts() public static method

Generates the drop scripts for the database saving them to the supplied file name. The baseType is used to identify which database should we act upon.
public static GenerateDropScripts ( Type baseType, String fileName ) : void
baseType System.Type
fileName String
return void

Initialize() public static method

Initializes the framework reading the configuration from the AppDomain and checking all the types on the executing Assembly
public static Initialize ( ) : void
return void

Initialize() public static method

Initialize the mappings using the configuration and checking all the types on the specified Assemblies
public static Initialize ( this source ) : void
source this
return void

ResetInitialization() public static method

Intended to be used only by test cases
public static ResetInitialization ( ) : void
return void

UpdateSchema() public static method

Generates and executes the creation scripts for the database.
public static UpdateSchema ( ) : IList
return IList

UpdateSchema() public static method

Generates and executes the creation scripts for the database using the specified baseClass to know which database it should create the schema for.
public static UpdateSchema ( Type baseClass ) : IList
baseClass Type
return IList