Back to Devexpress

DbTypeAttribute Class

xpo-devexpress-dot-xpo-0d6d30f8.md

latest2.0 KB
Original Source

DbTypeAttribute Class

Specifies the database type of the column that a property is mapped to.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public sealed class DbTypeAttribute :
    Attribute
vb
<AttributeUsage(AttributeTargets.Property Or AttributeTargets.Field, Inherited:=True)>
Public NotInheritable Class DbTypeAttribute
    Inherits Attribute

Remarks

The DbTypeAttribute can be used to designate a provider-specific database type for the column which the persistent property or field is mapped to:

csharp
public class MyPersistentObject : XPObject {
    // ...
    DateTime myReadDate;
    [DbType("smalldatetime")]
    public DateTime ReadDate {
        get { return myReadDate; }
        set {
                myReadDate = value;
        }
    }
}
vb
Public Class MyPersistentObject
   Inherits XPObject
   ' ...
   Private myReadDate As DateTime
   <DbType("smalldatetime")> _
   Public Property ReadDate() As DateTime
      Get
         Return myReadDate
      End Get
      Set
            myReadDate = value
      End Set
   End Property
End Class

Inheritance

Object Attribute DbTypeAttribute

See Also

DbTypeAttribute Members

Built-In Attributes

DevExpress.Xpo Namespace