Show / Hide Table of Contents

Class Parameter

The Parameter class, representing a parameter kind of Argument. A parameter has a concrete value, which can be one of a number of possible types, such as an int or a string.

Inheritance
Object
QueryElement
Argument
Parameter
Implements
ICloneable
Inherited Members
Argument.Equal(Argument)
Argument.UnEqual(Argument)
Argument.LessThan(Argument)
Argument.LessThanOrEqual(Argument)
Argument.GreaterThan(Argument)
Argument.GreaterThanOrEqual(Argument)
Argument.Like(Argument)
Argument.Like(String)
Argument.NotLike(Argument)
Argument.NotBetween(Argument, Argument)
Argument.Between(Argument, Argument)
Argument.In(Argument[])
Argument.HasAny(Argument[])
Argument.HasAll(Argument[])
Argument.MissingAny(Argument[])
Argument.MissingAll(Argument[])
Argument.IsNull()
Argument.IsNotNull()
Argument.NotIn(Argument[])
Argument.ToArgumentArray<T>(T[])
Argument.ToArgumentArray<T>(T[], Boolean)
Argument.GetSubElements()
Argument.Alias
Argument.DataType
Argument.Size
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: SuperOffice.Data.SQL
Assembly: SoDataBase.dll
Syntax
public sealed class Parameter : Argument, ICloneable

Constructors

Parameter(DateTime)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(DateTime parameter)
Parameters
Type Name Description
DateTime parameter

DateTime value to be stored

Remarks

The actual data type, such as dbDateTimeLocal, will be overridden by the Compare class once the parameter is combined with a field. Compare will transfer the type from the field to the parameter part of the comparison.

Parameter(DateTime, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(DateTime parameter, bool useSqlParameter)
Parameters
Type Name Description
DateTime parameter

DateTime value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Remarks

The actual data type, such as dbDateTimeLocal, will be overridden by the Compare class once the parameter is combined with a field. Compare will transfer the type from the field to the parameter part of the comparison.

Parameter(DBNull)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(DBNull parameter)
Parameters
Type Name Description
DBNull parameter

NULL value to be stored

Parameter(DBNull, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(DBNull parameter, bool useSqlParameter)
Parameters
Type Name Description
DBNull parameter

NULL value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Parameter(Double)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(double parameter)
Parameters
Type Name Description
Double parameter

double value to be stored

Parameter(Double, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(double parameter, bool useSqlParameter)
Parameters
Type Name Description
Double parameter

double value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Parameter(Int32)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(int parameter)
Parameters
Type Name Description
Int32 parameter

int value to be stored

Parameter(Int32, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(int parameter, bool useSqlParameter)
Parameters
Type Name Description
Int32 parameter

int value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Parameter(Stream)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(Stream parameter)
Parameters
Type Name Description
Stream parameter

Stream to be stored

Remarks

The stream will actually be accessed / read only when the SQL statement executes

Parameter(Object)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(object parameter)
Parameters
Type Name Description
Object parameter

Enumerator value to be stored

Remarks

The object passed in has to be an enumerator type

Exceptions
Type Condition
SoInvalidArgumentException

Thrown if parameter is not an enumerator.

Parameter(Object, FieldDataType)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(object parameter, FieldDataType dataType)
Parameters
Type Name Description
Object parameter

Object value to be stored

FieldDataType dataType

Data type of object

Parameter(Object, FieldDataType, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(object parameter, FieldDataType dataType, bool useSqlParameter)
Parameters
Type Name Description
Object parameter

Object value to be stored

FieldDataType dataType

Data type of object

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Parameter(Object, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(object parameter, bool useSqlParameter)
Parameters
Type Name Description
Object parameter

Enumerator value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Remarks

The object passed in has to be an enumerator type

Exceptions
Type Condition
SoInvalidArgumentException

Thrown if parameter is not an enumerator.

Parameter(String)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(string parameter)
Parameters
Type Name Description
String parameter

string value to be stored

Parameter(String, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(string parameter, bool useSqlParameter)
Parameters
Type Name Description
String parameter

string value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Parameter(UInt32)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(uint parameter)
Parameters
Type Name Description
UInt32 parameter

uint value to be stored

Parameter(UInt32, Boolean)

Initializes a new instance of the Parameter class.

Declaration
public Parameter(uint parameter, bool useSqlParameter)
Parameters
Type Name Description
UInt32 parameter

uint value to be stored

Boolean useSqlParameter

If true, a sql parameter will be added for this parameter when creating the query, otherwise the value will be added directly to the query

Properties

Param

Get/Set values for object

Declaration
[Obsolete("Use Value", false)]
public object Param { get; set; }
Property Value
Type Description
Object

ParameterName

Name of the parameter in the parameter collection

Declaration
public string ParameterName { get; set; }
Property Value
Type Description
String

ParameterNameInSql

Name of the parameter in the generated sql

Declaration
public string ParameterNameInSql { get; set; }
Property Value
Type Description
String

UseSqlParameter

If true, the query for this parameter will use a SQl parameter. if false, no SQL Parameter will be used.

Declaration
public bool UseSqlParameter { get; set; }
Property Value
Type Description
Boolean
Remarks

Default value is true

Value

Get/Set values for object

Declaration
public object Value { get; set; }
Property Value
Type Description
Object

Methods

Clone()

Deep copy of the Parameter object, except for BLOBs.

Declaration
public override object Clone()
Returns
Type Description
Object

Clone of parameter

Overrides
QueryElement.Clone()
Remarks

BLOB data objects are not copied, and are instead shared between copies. This can cause trouble if you read one copy and expect the other to be unaffected. String parameter values are shared between copies as well, but since strings are immutable (read-only) objects, this is not a problem.

All other types of objects/values are copied, as are the names and aliases.

CopyTo(IDbDataParameter)

Populate an exsisting IDbDataParameter object.

Declaration
public void CopyTo(IDbDataParameter parameter)
Parameters
Type Name Description
IDbDataParameter parameter

Object to populate.

GetMainField()

This method returns null.

Declaration
public override FieldInfo GetMainField()
Returns
Type Description
FieldInfo

return null

Overrides
Argument.GetMainField()

ToString()

Returns a String that represents the current Object.

Declaration
public override string ToString()
Returns
Type Description
String

A String that represents the current Object.

Overrides
Object.ToString()

Implements

System.ICloneable

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top