ColumnAttribute.DbType Proprietà

Definizione

Ottiene o imposta il tipo della colonna di database.

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

Valore della proprietà

Valore stringa che specifica il testo esatto che definisce la colonna in una dichiarazione di tabella Transact-SQL.

Esempio

[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

Commenti

Utilizzare questa proprietà per specificare il testo esatto che definisce la colonna in una dichiarazione di tabella Transact-SQL. Specificare la DbType proprietà solo se si prevede di usare CreateDatabase per creare un'istanza del database.

Il valore predefinito di DbType viene dedotto dal tipo di membro. Per altre informazioni, vedere Mapping dei tipi SQL-CLR.

Si applica a