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.

54 lines
1.5 KiB

using System;
using System.Collections.Generic;
using System.Text;
namespace Apewer.Source
{
/// <summary>用于执行 SQL 语句的参数。</summary>
[Serializable]
public class Parameter
{
private string _name;
/// <summary>名称,不可设置位为空。</summary>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentNullException"></exception>
public string Name
{
get
{
return _name;
}
set
{
if (value == null) throw new ArgumentNullException();
if (value == "") throw new ArgumentException();
_name = value;
}
}
/// <summary>值。</summary>
public object Value { get; set; }
/// <summary>类型。</summary>
public ColumnType Type { get; set; }
/// <summary>类型为 VarChar 时,可指定长度。</summary>
public int Size { get; set; }
/// <summary>创建用于执行 SQL 语句的参数,名称不可设置位为空。</summary>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentNullException"></exception>
public Parameter(string name, object value, ColumnType type, int size = 0)
{
Name = name;
Value = value;
Type = type;
Size = size;
}
}
}