note
VeloxDB is still in beta and APIs are subject to change. We are in the process of completing the documentation, so some sections may be incomplete or empty at this time.
Class DatabasePropertyAttribute
Specifies that the property is a database property.
Inheritance
System.Object
DatabasePropertyAttribute
Namespace: VeloxDB.ObjectInterface
Assembly: vlxdb.dll
Syntax
public sealed class DatabasePropertyAttribute : Attribute
Remarks
Apply the DatabasePropertyAttribute to properties of DatabaseObject that need to be persisted. Database properties must be abstract, with both getter and setter defined.
Database properties can be of following types:
byte
short
int
long
float
double
bool
System.DateTime
string
- DatabaseArray<T>
Note
Default values are not supported for DatabaseArray<T> and string types.
Examples
[DatabaseClass]
public abstract partial class Vehicle : DatabaseObject
{
[DatabaseProperty]
public abstract double PositionX { get; set; }
[DatabaseProperty]
public abstract double PositionY { get; set; }
[DatabaseProperty]
public abstract string ModelName { get; set; }
[DatabaseProperty]
public abstract int Year { get; set; }
[DatabaseProperty("5")]
public abstract int PassengerCapacity { get; set; }
[InverseReferences(nameof(Ride.Vehicle))]
public abstract InverseReferenceSet<Ride> Rides { get; }
public Vehicle()
{
}
}
Constructors
DatabasePropertyAttribute(Object)
Declaration
public DatabasePropertyAttribute(object defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | defaultValue | Specifies the default value for the property. |
Properties
DefaultValue
Gets the default value for the property.
Declaration
public object DefaultValue { get; }
Property Value
Type | Description |
---|---|
System.Object |