C# Class SharpArch.NHibernate.NHibernateConfigurationFileCache

File cache implementation of INHibernateConfigurationCache. Saves and loads a seralized version of Configuration to a temporary file location.
Seralizing a Configuration object requires that all components that make up the Configuration object be Serializable. This includes any custom NHibernate user types implementing NHibernate.UserTypes.IUserType.
Inheritance: INHibernateConfigurationCache
Datei anzeigen Open project: sharparchitecture/Sharp-Architecture

Protected Properties

Property Type Description
dependentFilePaths List

Public Methods

Method Description
LoadConfiguration ( string configKey, string configPath, IEnumerable mappingAssemblies ) : Configuration

Load the Configuration object from a cache.

NHibernateConfigurationFileCache ( ) : System

Initializes new instance of the NHibernateConfigurationFileCache

NHibernateConfigurationFileCache ( string dependentFilePaths ) : System

Initializes new instance of the NHibernateConfigurationFileCache using the given dependentFilePaths parameter.

SaveConfiguration ( string configKey, Configuration config ) : void

Save the Configuration object to cache to a temporary file.

Protected Methods

Method Description
CachedConfigPath ( string configKey ) : string

Provide a unique temporary file path/name for the cache file.

The hash value is intended to avoid the file from conflicting with other applications also using this cache feature.

GetMaxDependencyTime ( ) : System.DateTime

Returns the latest file write time from the list of dependent file paths.

IsCachedConfigCurrent ( string cachePath ) : bool

Tests if an existing cached configuration file is out of date or not.

Private Methods

Method Description
AppendToDependentFilePaths ( IEnumerable paths ) : void

Append the given list of file paths to the dependentFilePaths list.

AppendToDependentFilePaths ( string path ) : void

Append the given file path to the dependentFilePaths list.

FindFile ( string path ) : string

Tests if the file or assembly name exists either in the application's bin folder or elsewhere.

If the path parameter does not end with ".dll" it is appended and tested if the dll file exists.

Method Details

CachedConfigPath() protected method

Provide a unique temporary file path/name for the cache file.
The hash value is intended to avoid the file from conflicting with other applications also using this cache feature.
protected CachedConfigPath ( string configKey ) : string
configKey string
return string

GetMaxDependencyTime() protected method

Returns the latest file write time from the list of dependent file paths.
protected GetMaxDependencyTime ( ) : System.DateTime
return System.DateTime

IsCachedConfigCurrent() protected method

Tests if an existing cached configuration file is out of date or not.
Thrown if the cachePath or configPath /// parameters are null.
protected IsCachedConfigCurrent ( string cachePath ) : bool
cachePath string Location of the cached
return bool

LoadConfiguration() public method

Load the Configuration object from a cache.
public LoadConfiguration ( string configKey, string configPath, IEnumerable mappingAssemblies ) : Configuration
configKey string Key value to provide a unique name to the cached .
configPath string NHibernate configuration xml file. This is used to determine if the /// cached is out of date or not.
mappingAssemblies IEnumerable Assemblies containing NHibernate mappings.
return Configuration

NHibernateConfigurationFileCache() public method

Initializes new instance of the NHibernateConfigurationFileCache
public NHibernateConfigurationFileCache ( ) : System
return System

NHibernateConfigurationFileCache() public method

Initializes new instance of the NHibernateConfigurationFileCache using the given dependentFilePaths parameter.
public NHibernateConfigurationFileCache ( string dependentFilePaths ) : System
dependentFilePaths string LIst of files that the cached configuration /// is dependent upon.
return System

SaveConfiguration() public method

Save the Configuration object to cache to a temporary file.
public SaveConfiguration ( string configKey, Configuration config ) : void
configKey string Key value to provide a unique name to the cached .
config Configuration Configuration object to save.
return void

Property Details

dependentFilePaths protected_oe property

List of files that the cached configuration is dependent on. If any of these files are newer than the cache file then the cache file could be out of date.
protected List dependentFilePaths
return List