General

This page of the Model Settings dialog box is intended for NHibernate model properties customization. Here you can specify Database-First settings for Entity Developer behavior management during the process of adding objects from database to model. Here you can also set default values for some properties of objects composing the model, such as e.g. Default Access. In fact, this tab is a more convenient representation of the basic model properties and Entity Developer behavior settings towards the specific model. To edit the full list of model properties, call the model Properties docking window.

 

ExpandedToggleIconDatabase First Settings

Detect Many-to-Many associations

Select this check box to turn on the detection of many-to-many associations in your projects. If this check box is not selected, a class with two one-to-many associations will be generated for an intermediate table instead of a many-to-many association.

Detect Table Per Type inheritances

Specifies that inheritances of this type should be detected automatically.

Use Database Comments

Determines whether comments for database objects, if supported by DBMS, will be used for model objects Documentation initialization and taken into account when executing model or database update operations.

Include Foreign Key Columns in the Model

Determines whether to add foreign key columns as properties to the generated model classes.

Preserve schema name in storage

If selected, preserves the name of the schema for model objects when they are added from the database.

Preserve columns details

Specifies whether full information about the column should be preserved.

Preserve columns SqlType and Default

Specifies whether only full information about the type should be preserved.

Default Namespace

Defines the default namespace to be assumed for unqualified class names.

Default Assembly

Defines the default assembly to be assumed for unqualified class names.

Default Schema

Makes it possible to define a default schema for database tables.

Default Access

Makes it possible to select a default strategy for accessing a property value. Acceptable values are Property, Field, Nosetter and None.

Default Cascade

Makes it possible to select a default cascade for associations. Acceptable values are None and SaveUpdate.

Default Precision

Defines the default maximum number of digits for database columns.

Default Scale

Defines the default number of digits to the right of the decimal point for database columns.

Default Enum Storage Mode

Determines how properties of enum types will be stored in the database by default. Acceptable values are Integer (default) and String.

Default Collection Type

Default collection type used for the Many end of associations. Acceptable values are Set and Bag.

Default Lazy

Enables or disables lazy fetching.

Auto-Import

Specifies whether we can use unqualified class names (of classes in this mapping) in the query language.

Default Unicode

Specifies whether to use the Unicode encoding for database columns by default.

Default Collection Generic

Defines the default value of the generic property used for the Many end of associations.

Default Identity Generator

Name

Makes it possible to select a default identity generator. Acceptable values are:

assigned - lets the application assign an identifier to the object before Save() is called.
guid - uses System.Guid as the identifier.
guid.comb - uses a special algorithm to generate a new System.Guid. For more information on the algorithm, see the article http://www.informit.com/articles/article.asp?p=25862 .
guid.native - allows using the RDBMS native function to generate GUID. The behavior is similar to the “sequence” generator: when a new object is saved, NHibernate runs two queries; the first one to retrieve the GUID value and the second one to insert the entity using the GUID retrieved from the RDBMS.
hilo - uses a hi/lo algorithm to efficiently generate identifiers of any integral type, given a table and column (by default hibernate_unique_key and next_hi respectively) as a source of hi values. The hi/lo algorithm generates identifiers that are unique only for a particular database. Do not use this generator with a user-supplied connection.
identity - supports identity columns in DB2, MySQL, MS SQL Server and Sybase. The identifier returned by the database is converted to the property type using Convert.ChangeType. Any integral property type is thus supported.
increment - generates identifiers of any integral type that are unique only when no other process is inserting data into the same table. Do not use in a cluster.
native -  picks identity, sequence or hilo depending upon the capabilities of the underlying database.
select - retrieves a primary key assigned by a database trigger. The trigger selects some unique row value and retrieves the primary key value.
seqhilo - uses a hi/lo algorithm to efficiently generate identifiers of any integral type, given a named database sequence.
sequence - uses a sequence in DB2, PostgreSQL, Oracle or a generator in Firebird. The identifier returned by the database is converted to the property type using Convert.ChangeType. Any integral property type is thus supported.
sequence-identity - is based on “sequence” but works as an “identity”. The persistent object ID (POID) value is retrieved with the INSERT query. The type of an entity can be System.Int32 or System.Int64 depending on the RDBMS sequence generator.
trigger-identity - is a NHibernate specific feature where the persistent object ID (POID) is generated by the RDBMS at the INSERT query through a BEFORE INSERT trigger. In this case you can use any supported type, including custom type, with the limitation of “single-column”.
uuid.hex - uses System.Guid and its ToString(string format) method to generate identifiers of type string. The length of the string returned depends on the configured format.
uuid.string - uses System.Guid to create a byte[] that is converted to a string.
custom - lets that application use a custom generator.

Parameters

This box is active only when the custom generator is selected and allows entering parameters for selected generator.