EchoTex_Payroll/Ease.Core/DataAccess/Oracle/OracleFactory.cs
2024-10-14 10:01:49 +06:00

52 lines
1.9 KiB
C#

/*
|-------------------------------------------------------------------------------|
| Copyright © Computer Ease Limited |
| Address: 1/9 Bloack-A Lalmatia, Dhaka-1207, Bangladesh |
| Email: info@celimited.com, cease@bol-online.com, web: www.celimited.com |
| Unauthorized copy or distribution is strictly prohibited |
| Author: S. M. Russel, Last modified date: 17/04/2009 |
|-------------------------------------------------------------------------------|
*/
using System;
using System.Data;
using System.Collections;
using System.Configuration;
using Ease.Core.Utility;
using System.Data.OracleClient;
namespace Ease.Core.DataAccess.Oracle
{
#region DataAccess: Oracle Connection Factory
public sealed class OracleFactory : ConnectionFactory
{
/// <summary>
/// Create an instance of IDbConnection for oracle using default connectionstring.
/// </summary>
/// <returns>Retuen an instance of OracleConnection.</returns>
public override System.Data.IDbConnection CreateConnection()
{
return new OracleConnection(base.ConnectionNode.ConnectionString);
}
/// <summary>
/// Create an instance of IDbConnection for oracle using ConnectionContext.
/// </summary>
/// <param name="context">Valid ConnectionContext.</param>
/// <returns>Return instatnce of OracleConnection.</returns>
public override System.Data.IDbConnection CreateConnection(ConnectionContext context)
{
if (context == null || context.ContextKey.Length <= 0)
throw new Exception("There is no key in the Connection Context");
return new OracleConnection(ConnectionFactory.ContextConnection(context).ConnectionNode.ConnectionString);
}
internal OracleFactory()
{
}
}
#endregion
}