/* |-------------------------------------------------------------------------------| | 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 | | Source: UIP | | Author: S. M. Russel, Last modified date: 23/07/2012 | |-------------------------------------------------------------------------------| */ using System; using System.Data; using Ease.Core.Utility; using System.Collections; using System.Configuration; using Microsoft.Data.SqlClient; namespace Ease.Core.DataAccess.SQL { #region DataAccess: SQL Connection Factory /// /// Summary description for SQLFactory. /// public sealed class SqlFactory : ConnectionFactory { /// /// Create an instance of IDbConnection for MS SQL using default connectionstring. /// /// Retuen an instance of IDbConnection for MS SQL. public override System.Data.IDbConnection CreateConnection() { return new SqlConnection(base.ConnectionNode.ConnectionString); } /// /// Create an instance of IDbConnection for MS SQL using ConnectionContext. /// /// Valid ConnectionContext. /// Return instatnce of IDbConnection for MS SQL. 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 SqlConnection(ConnectionFactory.ContextConnection(context).ConnectionNode.ConnectionString); } internal SqlFactory() { } } #endregion }