#region Apache Notice
/*****************************************************************************
* $Header: $
* $Revision: 591621 $
* $Date$
*
* iBATIS.NET Data Mapper
* Copyright (C) 2008/2005 - The Apache Software Foundation
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************************/
#endregion
using Apache.Ibatis.Common.Utilities.Objects;
using Apache.Ibatis.Common.Utilities.Objects.Members;
using Apache.Ibatis.DataMapper.Session;
using Apache.Ibatis.Common.Data;
using System.Collections.Generic;
namespace Apache.Ibatis.DataMapper.Configuration
{
///
/// The class allows the user to set by code some
/// setting that will drive the iBATIS engine and his configuration.
///
public sealed class ConfigurationSetting
{
private IObjectFactory objectFactory = null;
private IGetAccessorFactory getAccessorFactory = null;
private ISetAccessorFactory setAccessorFactory = null;
private ISessionFactory sessionFactory = null;
private IDataSource dataSource = null;
private ISessionStore sessionStore = null;
private readonly IDictionary properties = new Dictionary();
private bool validateMapperConfigFile = false;
private ISqlSource dynamicSqlEngine = null;
private bool useStatementNamespaces = false;
private bool isCacheModelsEnabled = false;
private bool useReflectionOptimizer = true;
private bool preserveWhitespace;
///
/// Gets or sets the dynamic SQL engine.
///
/// The dynamic SQL engine.
public ISqlSource DynamicSqlEngine
{
get { return dynamicSqlEngine; }
set { dynamicSqlEngine = value; }
}
///
/// Indicates whether we enable or not the validation of Mapper config files.
///
///
/// true if must validate; otherwise, false.
///
public bool ValidateMapperConfigFile
{
get { return validateMapperConfigFile; }
set { validateMapperConfigFile = value; }
}
///
/// Gets or sets the session store.
///
/// The session store.
public ISessionStore SessionStore
{
get { return sessionStore; }
set { sessionStore = value; }
}
///
/// Gets or sets the object factory.
///
/// The object factory.
public IObjectFactory ObjectFactory
{
get { return objectFactory; }
set { objectFactory = value; }
}
///
/// Gets or sets the set accessor factory.
///
/// The set accessor factory.
public ISetAccessorFactory SetAccessorFactory
{
get { return setAccessorFactory; }
set { setAccessorFactory = value; }
}
///
/// Gets or sets the get accessor factory.
///
/// The get accessor factory.
public IGetAccessorFactory GetAccessorFactory
{
get { return getAccessorFactory; }
set { getAccessorFactory = value; }
}
///
/// Gets or sets the session factory.
///
/// The session factory.
public ISessionFactory SessionFactory
{
get { return sessionFactory; }
set { sessionFactory = value; }
}
///
/// Gets or sets the data source.
///
/// The data source.
public IDataSource DataSource
{
get { return dataSource; }
set { dataSource = value; }
}
///
/// Use to add properties configuration by code.
///
/// The properties.
public IDictionary Properties
{
get { return properties; }
}
///
/// Gets or sets a value indicating whether the DataMapper use statement namespaces.
///
///
/// true if [use statement namespaces]; otherwise, false.
///
public bool UseStatementNamespaces
{
get { return useStatementNamespaces; }
set { useStatementNamespaces = value; }
}
///
/// Gets or sets a value indicating whether cache model use is enabled.
///
///
/// true if cache model use is enabled; otherwise, false.
///
public bool IsCacheModelsEnabled
{
get { return isCacheModelsEnabled; }
set { isCacheModelsEnabled = value; }
}
///
/// Gets or sets a value indicating whether the DataMapper use reflection optimizer.
///
///
/// true if the DataMapper use reflection optimizer; otherwise, false.
///
public bool UseReflectionOptimizer
{
get { return useReflectionOptimizer; }
set { useReflectionOptimizer = value; }
}
///
/// Gets or sets a value indicating whether whitespace within <statement> nodes should be preserved.
///
///
/// Using the default value of false may cause single line SQL comments '--' to comment out more than expected. A
/// safer commenting syntax is to always use the multi-line comments supported by most vendors: '/* ... */'
///
public bool PreserveWhitespace
{
get { return preserveWhitespace; }
set { preserveWhitespace = value; }
}
}
}