Namespaces

Types

Type Configuration

Namespace NHibernate.Cfg

Methods

Properties

Fields

Public instance methods

Configuration AddAssembly(Assembly assembly, bool skipOrdering)

Parameters
return Configuration
Assembly assembly
bool skipOrdering

Configuration AddAssembly(string assemblyName)

Adds all of the assembly's embedded resources whose names end with .hbm.xml .
The assembly must be loadable using Load . If this condition is not satisfied, load the assembly manually and call AddAssembly instead.
Parameters
return Configuration This configuration object.
string assemblyName The name of the assembly to load.

Configuration AddAssembly(Assembly assembly)

Adds all of the assembly's embedded resources whose names end with .hbm.xml .
Parameters
return Configuration This configuration object.
Assembly assembly The assembly.

void AddAuxiliaryDatabaseObject(IAuxiliaryDatabaseObject obj)

Parameters
IAuxiliaryDatabaseObject obj

Configuration AddClass(Type persistentClass)

Read a mapping from an embedded resource, using a convention.
The convention is for class Foo.Bar.Foo to be mapped by the resource named Foo.Bar.Foo.hbm.xml , embedded in the class' assembly. If the mappings and classes are defined in different assemblies or don't follow the naming convention, this method cannot be used.
Parameters
return Configuration This configuration object.
Type persistentClass The type to map.

Configuration AddDirectory(DirectoryInfo dir)

Read all mapping documents from a directory tree. Assume that any file named *.hbm.xml is a mapping document.
Parameters
return Configuration
DirectoryInfo dir a directory

Configuration AddDocument(XmlDocument doc)

Parameters
return Configuration
XmlDocument doc

Configuration AddDocument(XmlDocument doc, string name)

Read mappings from an XmlDocument .
Parameters
return Configuration This configuration object.
XmlDocument doc A loaded XmlDocument that contains the mappings.
string name The name of the document, for error reporting purposes.

Configuration AddFile(FileInfo xmlFile)

Parameters
return Configuration
FileInfo xmlFile

Configuration AddFile(string xmlFile)

Read mappings from a particular XML file. This method is equivalent to AddXmlFile .
Parameters
return Configuration
string xmlFile

void AddFilterDefinition(FilterDefinition definition)

Parameters
FilterDefinition definition

Configuration AddInputStream(Stream xmlInputStream)

Read mappings from a Stream .
The Stream passed in through the parameter is not to be cleaned up by this method. It is the caller's responsiblity to ensure that is properly handled when this method completes.
Parameters
return Configuration This Configuration object.
Stream xmlInputStream The stream containing XML

Configuration AddInputStream(Stream xmlInputStream, string name)

Read mappings from a Stream .
The Stream passed in through the parameter is not to be cleaned up by this method. It is the caller's responsiblity to ensure that is properly handled when this method completes.
Parameters
return Configuration This Configuration object.
Stream xmlInputStream The stream containing XML
string name ${WriteSummary(content)}

Configuration AddProperties(IDictionary properties)

Adds an IDictionary of configuration properties. The Key is the name of the Property and the Value is the String value of the Property.
Parameters
return Configuration This Configuration object.
IDictionary properties An IDictionary of configuration properties.

Configuration AddResource(string path, Assembly assembly)

Adds the mappings in the resource of the assembly.
Parameters
return Configuration This configuration object.
string path The path to the resource file in the assembly.
Assembly assembly The assembly that contains the resource file.

void AddSqlFunction(string functionName, ISQLFunction sqlFunction)

Parameters
string functionName
ISQLFunction sqlFunction

Configuration AddUrl(string url)

Read mappings from a URL.
Parameters
return Configuration This configuration object.
string url a URL

Configuration AddUrl(Uri url)

Read mappings from a URL.
Parameters
return Configuration This configuration object.
Uri url a Uri to read the mappings from.

Configuration AddXml(string xml, string name)

Read mappings from a String . This method is equivalent to AddXmlString .
Parameters
return Configuration This configuration object.
string xml an XML string
string name ${WriteSummary(content)}

Configuration AddXml(string xml)

Parameters
return Configuration
string xml

Configuration AddXmlFile(string xmlFile)

Read mappings from a particular XML file.
Parameters
return Configuration This configuration object.
string xmlFile a path to a file

Configuration AddXmlReader(XmlTextReader hbmReader, string name)

Adds the Mappings in the XmlTextReader after validating it against the nhibernate-mapping-2.2 schema.
Parameters
return Configuration This Configuration object.
XmlTextReader hbmReader The XmlTextReader that contains the mapping.
string name ${WriteSummary(content)}

Configuration AddXmlReader(XmlTextReader hbmReader)

Adds the Mappings in the XmlTextReader after validating it against the nhibernate-mapping-2.2 schema.
Parameters
return Configuration This Configuration object.
XmlTextReader hbmReader The XmlTextReader that contains the mapping.

Configuration AddXmlString(string xml)

Read mappings from a String .
Parameters
return Configuration This configuration object.
string xml an XML string

ISessionFactory BuildSessionFactory()

Instantiate a new ISessionFactory , using the properties and mappings in this configuration. The ISessionFactory will be immutable, so changes made to the configuration after building the ISessionFactory will not affect it.
Parameters
return ISessionFactory An ISessionFactory instance.

Configuration Configure(Assembly assembly, string resourceName)

Configure NHibernate using a resource contained in an Assembly.
Calling Configure(Assembly, string) will overwrite the values set in app.config or web.config
Parameters
return Configuration A Configuration object initialized from the manifest resource.
Assembly assembly The Assembly that contains the resource.
string resourceName The name of the manifest resource being requested.

Configuration Configure(XmlTextReader reader)

Configure NHibernate using the specified XmlTextReader.
Calling Configure(XmlTextReader) will overwrite the values set in app.config or web.config
Parameters
return Configuration A Configuration object initialized with the file.
XmlTextReader reader The XmlTextReader that contains the Xml to configure NHibernate.

Configuration Configure()

Configure NHibernate using the section from the application config file, if found, or the file hibernate.cfg.xml otherwise.
To configure NHibernate explicitly using hibernate.cfg.xml , ignoring the application configuration file, use this code: configuration.Configure("path/to/hibernate.cfg.xml");
Parameters
return Configuration A configuration object initialized with the file.

Configuration Configure(string fileName)

Configure NHibernate using the file specified.
Calling Configure(string) will overwrite the values set in app.config or web.config
Parameters
return Configuration A Configuration object initialized with the file.
string fileName The location of the XML file to use to configure NHibernate.

Mappings CreateMappings()

Create a new Mappings to add classes and collection mappings to.
Parameters
return Mappings

bool Equals(object obj)

Parameters
return bool
object obj

String[] GenerateDropSchemaScript(Dialect dialect)

Generate DDL for droping tables
Parameters
return String[]
Dialect dialect

String[] GenerateSchemaCreationScript(Dialect dialect)

Generate DDL for creating tables
Parameters
return String[]
Dialect dialect

PersistentClass GetClassMapping(Type persistentClass)

Get the mapping for a particular class
Parameters
return PersistentClass
Type persistentClass

Collection GetCollectionMapping(string role)

Get the mapping for a particular collection role
Parameters
return Collection Collection
string role a collection role

int GetHashCode()

Parameters
return int

string GetProperty(string name)

Gets the value of the configuration property.
Parameters
return string ${WriteSummary(content)}
string name The name of the property.

Type GetType()

Parameters
return Type

NamedXmlDocument LoadMappingDocument(XmlTextReader hbmReader, string name)

Load and validate the mappings in the XmlTextReader against the nhibernate-mapping-2.2 schema, without adding them to the configuration.
This method is made public to be usable from the unit tests. It is not intended to be called by end users.
Parameters
return NamedXmlDocument NamedXmlDocument containing the validated XmlDocument built from the XmlReader.
XmlTextReader hbmReader The XmlReader that contains the mapping.
string name The name of the document, for error reporting purposes.

Configuration SetCacheConcurrencyStrategy(string collectionRole, string concurrencyStrategy)

Set up a cache for a collection role
Parameters
return Configuration
string collectionRole
string concurrencyStrategy

Configuration SetCacheConcurrencyStrategy(Type clazz, string concurrencyStrategy)

Set up a cache for an entity class
Parameters
return Configuration
Type clazz
string concurrencyStrategy

Configuration SetDefaultAssembly(string defaultAssembly)

Set the default assembly to use for the mappings added to the configuration afterwards.
This setting can be overridden for a mapping file by setting default-assembly attribute of element.
Parameters
return Configuration This configuration instance.
string defaultAssembly The default assembly name.

Configuration SetDefaultNamespace(string defaultNamespace)

Set the default namespace to use for the mappings added to the configuration afterwards.
This setting can be overridden for a mapping file by setting default-namespace attribute of element.
Parameters
return Configuration This configuration instance.
string defaultNamespace The default namespace.

Configuration SetInterceptor(IInterceptor interceptor)

Sets the default interceptor for use by all sessions.
Parameters
return Configuration This configuration instance.
IInterceptor interceptor The default interceptor.

Configuration SetNamingStrategy(INamingStrategy namingStrategy)

Set a custom naming strategy
Parameters
return Configuration
INamingStrategy namingStrategy the NamingStrategy to set

Configuration SetProperties(IDictionary properties)

Specify a completely new set of properties
Parameters
return Configuration
IDictionary properties

Configuration SetProperty(string name, string value)

Sets the value of the configuration property.
Parameters
return Configuration This configuration object.
string name The name of the property.
string value The value of the property.

string ToString()

Parameters
return string

Public properties

ICollection ClassMappings get;

The class mappings
return ICollection

ICollection CollectionMappings get;

The collection mappings
return ICollection

IDictionary FilterDefinitions get;

return IDictionary

IDictionary Imports get;

Get the query language imports
return IDictionary

IInterceptor Interceptor get; set;

Gets or sets the IInterceptor to use.
return IInterceptor

IDictionary NamedQueries get;

The named queries
return IDictionary

IDictionary NamedSQLQueries get;

The named SQL queries
return IDictionary

INamingStrategy NamingStrategy get;

Naming strategy for tables and columns
return INamingStrategy

IDictionary Properties get; set;

Gets or sets the IDictionary that contains the configuration properties and their values.
return IDictionary

IDictionary SqlFunctions get;

return IDictionary

IDictionary SqlResultSetMappings get;

return IDictionary

Public fields

string MappingSchemaXMLNS

The XML Namespace for the nhibernate-mapping
return string

string CfgSchemaXMLNS

The XML Namespace for the nhibernate-configuration
return string