You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
using System;
|
|
using System.Text;
|
|
|
|
namespace Common.Data
|
|
{
|
|
/// <summary>
|
|
/// 功能:数据连接信息
|
|
/// 作者:王昊昇
|
|
/// 时间:2012.2.8
|
|
/// </summary>
|
|
public class ConnectionInfo : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// 数据源连接
|
|
/// </summary>
|
|
public System.Data.IDbConnection Connection { get; set; }
|
|
|
|
/// <summary>
|
|
/// 数据源连接状态
|
|
/// </summary>
|
|
public ConnectionStatus ConnectionStatus { get; set; }
|
|
|
|
/// <summary>
|
|
/// 请求数据连接的用户信息
|
|
/// </summary>
|
|
public ConnectionUser ConnectionUser { get; set; }
|
|
|
|
/// <summary>
|
|
/// 已使用次数
|
|
/// </summary>
|
|
public int UsedFrequence { get; set; }
|
|
|
|
/// <summary>
|
|
/// 数据连接编号
|
|
/// </summary>
|
|
public string ID { get; set; }
|
|
|
|
/// <summary>
|
|
/// 释放所有资源
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
ConnectionStatus = ConnectionStatus.Closed;
|
|
if (Connection != null)
|
|
{
|
|
if (Connection.State == System.Data.ConnectionState.Open)
|
|
{
|
|
Connection.Close();
|
|
}
|
|
|
|
Connection.Dispose();
|
|
Connection = null;
|
|
}
|
|
|
|
ConnectionUser = null;
|
|
UsedFrequence = 0;
|
|
}
|
|
}
|
|
}
|
|
|