Search Results for

    Show / Hide Table of Contents
    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 SupportPolymorphismAttribute

    Apply this attribute to automapper method to specify that it supports polymorphism

    Inheritance
    object
    Attribute
    SupportPolymorphismAttribute
    Inherited Members
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.Equals(object)
    Attribute.GetHashCode()
    Attribute.Match(object)
    Attribute.IsDefaultAttribute()
    Attribute.TypeId
    object.GetType()
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: VeloxDB.ObjectInterface
    Assembly: vlxdb.dll
    Syntax
    public sealed class SupportPolymorphismAttribute : Attribute

    Remarks

    AutoMapper methods by default don't support polymorphism. This is because polymorphism support introduces slight performance overhead. In order to support polymorphism, mark the automapper methods with SupportPolymorphismAttribute. If you don't mark the base methods with SupportPolymorphismAttribute automapper generator will prevent you from extending the base class. The derived class must contain all automapper methods that the base class contains. DTO Type should be the DTO Type of the derived class, not base class. Automapper uses this information in order to determine which database type maps to which DTO. For more detailed overview of automapper see Database APIs section of the guide.

    Examples

    The following example demonstrates how to declare an automapper method that supports polymorphism.

    using VeloxDB.ObjectInterface;
    
    namespace University;
    
    [DatabaseClass(true)]
    public abstract partial class Person : DatabaseObject
    {
        [DatabaseProperty]
        public abstract string Name { get; set; }
    
        [DatabaseProperty]
        public abstract string Address { get; set; }
    
        [SupportPolymorphism]
        public partial PersonDTO ToDTO();
    
        [SupportPolymorphism]
        public static partial Person FromDTO(ObjectModel om, PersonDTO dto);
    }
    
    

    And here you can see how to specify automapper methods in derived class.

    using VeloxDB.ObjectInterface;
    
    namespace University;
    
    [DatabaseClass]
    public abstract partial class Student : Person
    {
        [DatabaseReference]
        public abstract ReferenceArray<Course> Courses { get; set; }
    
        [DatabaseProperty]
        public abstract DatabaseArray<int> Scores { get; set; }
    
        public new partial StudentDTO ToDTO();
        public static partial Student FromDTO(ObjectModel om, StudentDTO dto);
    }
    
    
    

    Constructors

    SupportPolymorphismAttribute()

    Declaration
    public SupportPolymorphismAttribute()
    In this article
    © 2025 Copyright: VeloxDB