Gets or sets whether a column can contain null values.
public:
property bool CanBeNull { bool get(); void set(bool value); };
public bool CanBeNull { get; set; }
member this.CanBeNull : bool with get, set
Public Property CanBeNull As Boolean
Property Value
Default = true
.
[Column(Storage="_LastName", DbType="NVarChar(20) NOT NULL", CanBeNull=false)]
public string LastName
{
get
{
return this._LastName;
}
set
{
if ((this._LastName != value))
{
this.OnLastNameChanging(value);
this.SendPropertyChanging();
this._LastName = value;
this.SendPropertyChanged("LastName");
this.OnLastNameChanged();
}
}
}
<Column(Storage:="_LastName", DbType:="NVarChar(20) NOT NULL", CanBeNull:=false)> _
Public Property LastName() As String
Get
Return Me._LastName
End Get
Set
If ((Me._LastName = value) _
= false) Then
Me.OnLastNameChanging(value)
Me.SendPropertyChanging
Me._LastName = value
Me.SendPropertyChanged("LastName")
Me.OnLastNameChanged
End If
End Set
End Property
Remarks
If you set this value to false
, the data in the corresponding column is assumed to be non-null.
Note
This property is duplicated from the DbType property for convenience. The CreateDatabase method uses only the DbType property. For this reason, you must specify whether a column can contain null values in the DbType property also.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4