Share via


ColumnAttribute.DbType Vlastnost

Definice

Získá nebo nastaví typ sloupce databáze.

public:
 property System::String ^ DbType { System::String ^ get(); void set(System::String ^ value); };
public string DbType { get; set; }
member this.DbType : string with get, set
Public Property DbType As String

Hodnota vlastnosti

Řetězcová hodnota, která určuje přesný text, který definuje sloupec v deklaraci tabulky Transact-SQL.

Příklady

[Column(Storage="_FirstName", DbType="NVarChar(10) NOT NULL", CanBeNull=false)]
public string FirstName
{
    get
    {
        return this._FirstName;
    }
    set
    {
        if ((this._FirstName != value))
        {
            this.OnFirstNameChanging(value);
            this.SendPropertyChanging();
            this._FirstName = value;
            this.SendPropertyChanged("FirstName");
            this.OnFirstNameChanged();
        }
    }
}
<Column(Storage:="_FirstName", DbType:="NVarChar(10) NOT NULL", CanBeNull:=false)>  _
Public Property FirstName() As String
    Get
        Return Me._FirstName
    End Get
    Set
        If ((Me._FirstName = value)  _
                    = false) Then
            Me.OnFirstNameChanging(value)
            Me.SendPropertyChanging
            Me._FirstName = value
            Me.SendPropertyChanged("FirstName")
            Me.OnFirstNameChanged
        End If
    End Set
End Property

Poznámky

Tato vlastnost slouží k určení přesného textu, který definuje sloupec v deklaraci tabulky Transact-SQL. Vlastnost zadejte pouze v DbType případě, že plánujete použít CreateDatabase k vytvoření instance databáze.

Výchozí hodnota je DbType odvozena z typu člen. Další informace najdete v tématu Mapování typů SQL-CLR.

Platí pro