C# Class Castle.Facilities.NHibernateIntegration.NHibernateFacility

Provides a basic level of integration with the NHibernate project
This facility allows components to gain access to the NHibernate's objects: NHibernate.Cfg.Configuration NHibernate.ISessionFactory

It also allow you to obtain the ISession instance through the component ISessionManager, which is transaction aware and save you the burden of sharing session or using a singleton.

Inheritance: Castle.MicroKernel.Facilities.AbstractFacility
Afficher le fichier Open project: nats/castle-1.0.3-mono

Méthodes protégées

Méthode Description
ApplyConfigurationSettings ( NHibernate.Cfg.Configuration cfg, IConfiguration facilityConfig ) : void
ConfigureFacility ( ) : void
GenerateMappingFromAttributesIfNeeded ( NHibernate.Cfg.Configuration cfg, String targetAssembly ) : void

If targetAssembly has a reference on NHibernate.Mapping.Attributes : use the NHibernate mapping attributes contained in that assembly to update NHibernate configuration (cfg). Else do nothing

To avoid an unnecessary dependency on the library NHibernate.Mapping.Attributes.dll when using this facility without NHibernate mapping attributes, all calls to that library are made using reflexion.

Init ( ) : void
RegisterAssemblies ( NHibernate.Cfg.Configuration cfg, IConfiguration facilityConfig ) : void
RegisterComponents ( ) : void
RegisterResources ( NHibernate.Cfg.Configuration cfg, IConfiguration facilityConfig ) : void
RegisterSessionFactoryResolver ( ) : void
RegisterSessionManager ( ) : void
RegisterSessionStore ( ) : void
RegisterTransactionManager ( ) : void

Private Methods

Méthode Description
AssertHasAtLeastOneFactoryConfigured ( ) : void
AssertHasConfig ( ) : void
ConfigureFactories ( IConfiguration config, ISessionFactoryResolver sessionFactoryResolver, bool firstFactory ) : void
ConfigureReflectionOptimizer ( IConfiguration config ) : void

Reads the attribute useReflectionOptimizer and configure the reflection optimizer accordingly.

As reported on Jira (FACILITIES-39) the reflection optimizer slow things down. So by default it will be disabled. You can use the attribute useReflectionOptimizer to turn it on.

ObtainAssembly ( String assembly ) : Assembly

Method Details

ApplyConfigurationSettings() protected méthode

protected ApplyConfigurationSettings ( NHibernate.Cfg.Configuration cfg, IConfiguration facilityConfig ) : void
cfg NHibernate.Cfg.Configuration
facilityConfig IConfiguration
Résultat void

ConfigureFacility() protected méthode

protected ConfigureFacility ( ) : void
Résultat void

GenerateMappingFromAttributesIfNeeded() protected méthode

If targetAssembly has a reference on NHibernate.Mapping.Attributes : use the NHibernate mapping attributes contained in that assembly to update NHibernate configuration (cfg). Else do nothing
To avoid an unnecessary dependency on the library NHibernate.Mapping.Attributes.dll when using this facility without NHibernate mapping attributes, all calls to that library are made using reflexion.
protected GenerateMappingFromAttributesIfNeeded ( NHibernate.Cfg.Configuration cfg, String targetAssembly ) : void
cfg NHibernate.Cfg.Configuration NHibernate configuration
targetAssembly String Target assembly name
Résultat void

Init() protected méthode

protected Init ( ) : void
Résultat void

RegisterAssemblies() protected méthode

protected RegisterAssemblies ( NHibernate.Cfg.Configuration cfg, IConfiguration facilityConfig ) : void
cfg NHibernate.Cfg.Configuration
facilityConfig IConfiguration
Résultat void

RegisterComponents() protected méthode

protected RegisterComponents ( ) : void
Résultat void

RegisterResources() protected méthode

protected RegisterResources ( NHibernate.Cfg.Configuration cfg, IConfiguration facilityConfig ) : void
cfg NHibernate.Cfg.Configuration
facilityConfig IConfiguration
Résultat void

RegisterSessionFactoryResolver() protected méthode

protected RegisterSessionFactoryResolver ( ) : void
Résultat void

RegisterSessionManager() protected méthode

protected RegisterSessionManager ( ) : void
Résultat void

RegisterSessionStore() protected méthode

protected RegisterSessionStore ( ) : void
Résultat void

RegisterTransactionManager() protected méthode

protected RegisterTransactionManager ( ) : void
Résultat void