TimeSpanValidatorAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
構成プロパティに対して時間検証を実行するように .NET に宣言によって指示します。 このクラスは継承できません。
public ref class TimeSpanValidatorAttribute sealed : System::Configuration::ConfigurationValidatorAttribute
[System.AttributeUsage(System.AttributeTargets.Property)]
public sealed class TimeSpanValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute
[<System.AttributeUsage(System.AttributeTargets.Property)>]
type TimeSpanValidatorAttribute = class
inherit ConfigurationValidatorAttribute
Public NotInheritable Class TimeSpanValidatorAttribute
Inherits ConfigurationValidatorAttribute
- 継承
- 属性
例
次の例は、TimeSpanValidatorAttribute属性を使用してカスタム ConfigurationSection オブジェクトのプロパティを装飾する方法を示しています。
[ConfigurationProperty("maxIdleTime",
DefaultValue = "0:10:0",
IsRequired = false)]
[TimeSpanValidator(MinValueString = "0:0:30",
MaxValueString = "5:00:0",
ExcludeRange = false)]
public TimeSpan MaxIdleTime
{
get
{
return (TimeSpan)this["maxIdleTime"];
}
set
{
this["maxIdleTime"] = value;
}
}
<ConfigurationProperty("maxIdleTime", _
DefaultValue:="0:10:0", _
IsRequired:=False), _
TimeSpanValidator(MinValueString:="0:0:30", _
MaxValueString:="5:00:0", _
ExcludeRange:=False)> _
Public Property MaxIdleTime() As TimeSpan
Get
Return CType(Me("maxIdleTime"), TimeSpan)
End Get
Set(ByVal value As TimeSpan)
Me("maxIdleTime") = value
End Set
End Property
次の例は、前のサンプルで使用したカスタム セクションを含む構成ファイルの抜粋です。
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="custom" type="Microsoft.Samples.AspNet.Configuration.SampleSection, ConfigurationValidatorAttribute" />
</configSections>
<custom fileName="NewFile.txt" maxSize="1000" maxAttempts="101" maxUsers="2500" maxIdleTime="00:15:00" />
</configuration>
注釈
TimeSpanValidatorAttribute属性を使用して、構成プロパティを装飾します。 これは、TimeSpanValidator クラスを使用してプロパティを検証し、それに装飾パラメーターの値を渡すように.NETに指示することです。
TimeSpanValidatorAttributeオブジェクトは、プロパティ型にのみ適用できます。
コンストラクター
| 名前 | 説明 |
|---|---|
| TimeSpanValidatorAttribute() |
TimeSpanValidatorAttribute クラスの新しいインスタンスを初期化します。 |
フィールド
| 名前 | 説明 |
|---|---|
| TimeSpanMaxValue |
許容される絶対値を取得します。 |
| TimeSpanMinValue |
許容される絶対値を取得します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| ExcludeRange |
MinValueStringおよびMaxValueStringで定義されている範囲内の整数を含めるか除外するかを示す値を取得または設定します。 |
| MaxValue |
絶対最大 TimeSpan 値を取得します。 |
| MaxValueString |
相対的な最大 TimeSpan 値を取得または設定します。 |
| MinValue |
絶対最小値 TimeSpan 値を取得します。 |
| MinValueString |
相対最小値 TimeSpan 値を取得または設定します。 |
| TypeId |
派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。 (継承元 Attribute) |
| ValidatorInstance |
TimeSpanValidator クラスのインスタンスを取得します。 |
| ValidatorType |
検証コントロール属性の型を取得します。 (継承元 ConfigurationValidatorAttribute) |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| GetHashCode() |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IsDefaultAttribute() |
派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
| Match(Object) |
派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
インターフェイスの型情報を取得するために使用できるオブジェクトの型情報を取得します。 (継承元 Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
オブジェクトによって公開されるプロパティとメソッドへのアクセスを提供します。 (継承元 Attribute) |