
using System;
using System.Data;
using System.Data.Common;

namespace STMes.DataProvider
{
	/// <summary>
	/// The <b>IDataProvider</b> is an interface that provides specific data provider information
	/// for the <see cref="DbManager"/> class. 
	/// </summary>
	/// <remarks>
	/// See the <see cref="DbManager.AddDataProvider"/> method to find an example.
	/// </remarks>
	/// <seealso cref="DbManager.AddDataProvider">AddDataManager Method</seealso>
	public interface IDataProvider
	{
		/// <summary>
		/// Creates a new instance of the <see cref="IDbConnection"/>.
		/// </summary>
		/// <remarks>
		/// See the <see cref="DbManager.AddDataProvider"/> method to find an example.
		/// </remarks>
		/// <seealso cref="DbManager.AddDataProvider">AddDataManager Method</seealso>
		/// <returns>The <see cref="IDbConnection"/> object.</returns>
		IDbConnection CreateConnectionObject();
		IDbConnection CreateConnectionObject(string connectionString );

		/// <summary>
		/// Creates an instance of the <see cref="DbDataAdapter"/>.
		/// </summary>
		/// <remarks>
		/// See the <see cref="DbManager.AddDataProvider"/> method to find an example.
		/// </remarks>
		/// <seealso cref="DbManager.AddDataProvider">AddDataManager Method</seealso>
		/// <returns>The <see cref="DbDataAdapter"/> object.</returns>
		DbDataAdapter CreateDataAdapterObject();

		/// <summary>
		/// Populates the specified <see cref="IDbCommand"/> object's Parameters collection with 
		/// parameter information for the stored procedure specified in the <see cref="IDbCommand"/>.
		/// </summary>
		/// <remarks>
		/// See the <see cref="DbManager.AddDataProvider"/> method to find an example.
		/// </remarks>
		/// <seealso cref="DbManager.AddDataProvider">AddDataManager Method</seealso>
		/// <param name="command">The <see cref="IDbCommand"/> referencing the stored procedure 
		/// for which the parameter information is to be derived.
		/// The derived parameters will be populated into the Parameters of this command.</param>
		void DeriveParameters(IDbCommand command);

		/// <summary>
		/// Returns an actual type of the connection object used by this instance of the <see cref="DbManager"/>.
		/// </summary>
		/// <remarks>
		/// See the <see cref="DbManager.AddDataProvider"/> method to find an example.
		/// </remarks>
		/// <seealso cref="DbManager.AddDataProvider">AddDataManager Method</seealso>
		/// <value>An instance of the <see cref="Type"/> class.</value>
		Type ConnectionType { get; }

		/// <summary>
		/// Returns the data manager name.
		/// </summary>
		/// <remarks>
		/// See the <see cref="DbManager.AddDataProvider"/> method to find an example.
		/// </remarks>
		/// <seealso cref="DbManager.AddDataProvider">AddDataManager Method</seealso>
		/// <value>The data manager name.</value>
		string Name { get; }

		/// <summary>
		/// Create DB Privider Data Parameter
		/// </summary>
		/// <returns><seealso cref="System.Data.IDbDataParameter"/></returns>
		System.Data.IDbDataParameter CreateDataParameter();

		/// <summary>
		/// Create DB Privider Data Command Builder
		/// </summary>
		/// <param name="da"></param>
		/// <returns><seealso cref="System.Object"/></returns>
		System.Object CreateCommandBuilder(DbDataAdapter da);

		/// <summary>
		/// Test Connection Info
		/// </summary>
		/// <param name="db">Test Connection Object</param> 
		/// <returns>Test Result</returns>
		bool Ping(ref IDbConnection db);

        int GetSID(ref IDbConnection db);
	}
}
