Connector Close Method MVC+ (Model-Facade-View-Controller) Framework for ASP.NET
Closes database connection.

Namespace: NovaDimension.Data
Assembly: NovaDimension.Data (in NovaDimension.Data.dll) Version: 4.0.204.0 (4.0.0204.0)
Syntax

public void Close()

Implements

IConnectionable Close 
Exceptions

Examples

This sample shows how to use the Close  method.
using system;
using NovaDimension.Component;
using NovaDimension.Data;
using NovaDimension.Data.Client;
using NovaDimension.Data.SQLServer; // in case of using Microsoft SQL Server 
using NovaDimension.Data.Oracle;    // in case of using Oracle 
using NovaDimension.Data.MySQL;     // in case of using MySQL 

class TestClass()
{
    static int Main()
    {
        DbConfig config;
        IFactoryable<IConnectionable, DbCfg> factory;
        IConnectionable connector;

        try
        {
            config = (DbConfig)SerializeHelper.Deserialize("\\Config", "DbConfig.config");
            factory = DatabaseFactory.CreateFactory(config.UserManager);

            // in case of using Microsoft SQL Server
            connector = (SQLServerConnector)factory.CreateProduct(config.UserManager);

            // in case of using Oracle
            connector = (OracleConnector)factory.CreateProduct(config.UserManager);

            // in case of using MySQL
            connector = (MySQLConnector)factory.CreateProduct(config.UserManager);

            connector.InitConnection();
            connector.Open();
            // ...
        }
        catch (ExceptionEx<DatabaseFactoryException> ex)
        {
            Console.WriteLine(ex.Message);
        }
        catch (ExceptionEx<ConnectorException> ex)
        {
            Console.WriteLine(ex.Message);
        }
        finally
        {
            connector.Close();
        }
    }
}
See Also