Skip to content

Commit

Permalink
Added api-docs for the base PersistenceConfiguration builder
Browse files Browse the repository at this point in the history
  • Loading branch information
jagregory committed May 1, 2010
1 parent 7e62075 commit b59f471
Showing 1 changed file with 119 additions and 2 deletions.
121 changes: 119 additions & 2 deletions src/FluentNHibernate/Cfg/Db/PersistenceConfiguration.cs
Expand Up @@ -89,6 +89,9 @@ protected void ToggleBooleanSetting(string settingKey)
nextBoolSettingValue = true;
}

/// <summary>
/// Negates the next boolean option.
/// </summary>
public TThisConfiguration DoNot
{
get
Expand All @@ -98,103 +101,205 @@ public TThisConfiguration DoNot
}
}

/// <summary>
/// Sets the database dialect. This shouldn't be necessary
/// if you've used one of the provided database configurations.
/// </summary>
/// <returns>Configuration builder</returns>
public TThisConfiguration Dialect(string dialect)
{
values[DialectKey] = dialect;
values[AltDialectKey] = dialect;
return (TThisConfiguration) this;
}

/// <summary>
/// Sets the database dialect. This shouldn't be necessary
/// if you've used one of the provided database configurations.
/// </summary>
/// <returns>Configuration builder</returns>
public TThisConfiguration Dialect<T>()
where T : Dialect
{
return Dialect(typeof (T).AssemblyQualifiedName);
}

/// <summary>
/// Sets the default database schema
/// </summary>
/// <param name="schema">Default schema name</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration DefaultSchema(string schema)
{
values[DefaultSchemaKey] = schema;
return (TThisConfiguration) this;
}

/// <summary>
/// Enables the outer-join option.
/// </summary>
/// <returns>Configuration builder</returns>
public TThisConfiguration UseOuterJoin()
{
ToggleBooleanSetting(UseOuterJoinKey);
return (TThisConfiguration) this;
}

/// <summary>
/// Sets the max fetch depth.
/// </summary>
/// <param name="maxFetchDepth">Max fetch depth</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration MaxFetchDepth(int maxFetchDepth)
{
values[MaxFetchDepthKey] = maxFetchDepth.ToString();
return (TThisConfiguration)this;
}

/// <summary>
/// Enables the reflection optimizer.
/// </summary>
/// <returns>Configuration builder</returns>
public TThisConfiguration UseReflectionOptimizer()
{
ToggleBooleanSetting(UseReflectionOptimizerKey);
return (TThisConfiguration) this;
}

public TThisConfiguration QuerySubstitutions(string query)
/// <summary>
/// Sets any query stubstitutions that NHibernate should
/// perform.
/// </summary>
/// <param name="substitutions">Substitutions</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration QuerySubstitutions(string substitutions)
{
values[QuerySubstitutionsKey] = query;
values[QuerySubstitutionsKey] = substitutions;
return (TThisConfiguration)this;
}

/// <summary>
/// Enables the show SQL option.
/// </summary>
/// <returns>Configuration builder</returns>
public TThisConfiguration ShowSql()
{
ToggleBooleanSetting(ShowSqlKey);
return (TThisConfiguration)this;
}

/// <summary>
/// Enables the format SQL option.
/// </summary>
/// <returns>Configuration builder</returns>
public TThisConfiguration FormatSql()
{
ToggleBooleanSetting(FormatSqlKey);
return (TThisConfiguration)this;
}

/// <summary>
/// Sets the database provider. This shouldn't be necessary
/// if you're using one of the provided database configurations.
/// </summary>
/// <param name="provider">Provider type</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration Provider(string provider)
{
values[ConnectionProviderKey] = provider;
return (TThisConfiguration)this;
}

/// <summary>
/// Sets the database provider. This shouldn't be necessary
/// if you're using one of the provided database configurations.
/// </summary>
/// <typeparam name="T">Provider type</typeparam>
/// <returns>Configuration builder</returns>
public TThisConfiguration Provider<T>()
where T : IConnectionProvider
{
return Provider(typeof(T).AssemblyQualifiedName);
}

/// <summary>
/// Specify the database driver. This isn't necessary
/// if you're using one of the provided database configurations.
/// </summary>
/// <param name="driverClass">Driver type</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration Driver(string driverClass)
{
values[DriverClassKey] = driverClass;
return (TThisConfiguration)this;
}

/// <summary>
/// Specify the database driver. This isn't necessary
/// if you're using one of the provided database configurations.
/// </summary>
/// <typeparam name="T">Driver type</typeparam>
/// <returns>Configuration builder</returns>
public TThisConfiguration Driver<T>()
where T : IDriver
{
return Driver(typeof(T).AssemblyQualifiedName);
}

/// <summary>
/// Configure the connection string
/// </summary>
/// <example>
/// ConnectionString(x =>
/// {
/// x.Server("db_server");
/// x.Database("Products");
/// });
/// </example>
/// <param name="connectionStringExpression">Closure for building the connection string</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration ConnectionString(Action<TConnectionString> connectionStringExpression)
{
connectionStringExpression(connectionString);
return (TThisConfiguration)this;
}

/// <summary>
/// Set the connection string.
/// </summary>
/// <param name="value">Connection string to use</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration ConnectionString(string value)
{
connectionString.Is(value);
return (TThisConfiguration)this;
}

/// <summary>
/// Configure caching.
/// </summary>
/// <example>
/// Cache(x =>
/// {
/// x.UseQueryCache();
/// x.UseMinimalPuts();
/// });
/// </example>
/// <param name="cacheExpression">Closure for configuring caching</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration Cache(Action<CacheSettingsBuilder> cacheExpression)
{
cacheExpression(cache);
return (TThisConfiguration)this;
}

/// <summary>
/// Sets a raw property on the NHibernate configuration. Use this method
/// if there isn't a specific option available in the API.
/// </summary>
/// <param name="key">Setting key</param>
/// <param name="value">Setting value</param>
/// <returns>Configuration builder</returns>
public TThisConfiguration Raw(string key, string value)
{
values[key] = value;
Expand All @@ -213,12 +318,24 @@ public TThisConfiguration ProxyFactoryFactory(string proxyFactoryFactoryClass)
return (TThisConfiguration)this;
}

/// <summary>
/// Sets the proxyfactory.factory_class property.
/// NOTE: NHibernate 2.1 only
/// </summary>
/// <param name="proxyFactoryFactory">factory class</param>
/// <returns>Configuration</returns>
public TThisConfiguration ProxyFactoryFactory(Type proxyFactoryFactory)
{
values[ProxyFactoryFactoryClassKey] = proxyFactoryFactory.AssemblyQualifiedName;
return (TThisConfiguration)this;
}

/// <summary>
/// Sets the proxyfactory.factory_class property.
/// NOTE: NHibernate 2.1 only
/// </summary>
/// <typeparam name="TProxyFactoryFactory">factory class</typeparam>
/// <returns>Configuration</returns>
public TThisConfiguration ProxyFactoryFactory<TProxyFactoryFactory>() where TProxyFactoryFactory : IProxyFactoryFactory
{
return ProxyFactoryFactory(typeof(TProxyFactoryFactory));
Expand Down

0 comments on commit b59f471

Please sign in to comment.