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 DatabaseClassAttribute
Specifies that the class is Database Class.
Inheritance
System.Object
DatabaseClassAttribute
Namespace: VeloxDB.ObjectInterface
Assembly: vlxdb.dll
Syntax
public sealed class DatabaseClassAttribute : Attribute
Remarks
Apply the DatabaseClassAttribute to classes that are part of the model. A database class must fulfill the following requirements:
- It must be declared as abstract
- It must inherit from DatabaseObject
- It must have an empty constructor
- Properties that need to be persisted must be marked with DatabasePropertyAttribute
- Persisted properties must be abstract with both getter and setter defined
Examples
[DatabaseClass]
public abstract partial class Post : DatabaseObject
{
[DatabaseProperty]
public abstract string Title { get; set; }
[DatabaseProperty]
public abstract string Content { get; set; }
[DatabaseReference(false, DeleteTargetAction.CascadeDelete, true)]
public abstract Blog Blog { get; set; }
public partial PostDTO ToDTO();
public static partial Post FromDTO(ObjectModel om, PostDTO post);
}
Constructors
DatabaseClassAttribute(Boolean)
Declaration
public DatabaseClassAttribute(bool isAbstract = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isAbstract | Specifies whether this class is an abstract class. Abstract classes cannot be instantiated and can only be inherited. |
Properties
IsAbstract
Get whether the class is abstract.
Declaration
public bool IsAbstract { get; }
Property Value
Type | Description |
---|---|
System.Boolean |