using System;
using System.Xml;
using System.Xml.Serialization;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Diagnostics;
using System.Runtime;
using System.Runtime.Serialization;
using Tdo;
using Tdo.Common;
using Tdo.Common.Entities;
using Tdo.Common.Entities.Tables;
using Tdo.Common.Entities.Views;
using Tdo.Common.Helper;
using Tdo.Common.TdoSqlExpressionDom;
using Tdo.Common.TdoTypes;
namespace Tdo.Common.TdoSqlExpressionDom{
/// <summary>
/// TdoParameterCollection class to create parametric queries
/// </summary>
[CLSCompliant(true)]
[Serializable()]
public sealed class TdoParameterCollection
{
private static Random randomGenerator = new Random();
/// <summary>
/// Contains the parameters list to construct the Where clause
/// </summary>
private volatile ArrayList parametercollection;
/// <summary>
/// Prefix for parameters name
/// </summary>
private const string prefix = "_p";
/// <summary>
/// default constructor of TdoParameterCollection class
/// </summary>
internal TdoParameterCollection()
{
this.parametercollection = ArrayList.Synchronized(new ArrayList());
}
/// <summary>
/// Function that returns the name of the next useful parameter
/// </summary>
/// <returns></returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider")]
internal string NextParamName()
{
return "@" + TdoParameterCollection.prefix + Guid.NewGuid().ToString("N");
//return String.Format("@{0}{1}{2}", TdoParameterCollection.prefix, TdoParameterCollection.randomGenerator.Next(int.MaxValue).ToString(), (++this.paramnumber));
}
/// <summary>
/// Empty the Parameter Collection
/// </summary>
internal void Reset()
{
lock (this.parametercollection.SyncRoot)
{
this.parametercollection.Clear();
}
}
/// <summary>
/// Returns or Sets an ArrayList containing a SqlParameter Collection
/// </summary>
internal ArrayList ParameterCollection
{
get
{
return this.parametercollection;
}
set
{
this.parametercollection = value;
}
}
}
}
|