Search Results for

    Show / Hide Table of Contents

    Struct Property

    Describes a single property of a class stored in a Realm.

    Inherited Members
    ValueType.ToString()
    Namespace: Realms.Schema
    Assembly: Realm.dll
    Syntax
    public readonly struct Property

    Constructors

    | Edit this page View Source

    Property(string, PropertyType, string?, string?, bool, IndexType, string?)

    Initializes a new instance of the Property struct.

    Declaration
    public Property(string name, PropertyType type, string? objectType = null, string? linkOriginPropertyName = null, bool isPrimaryKey = false, IndexType indexType = IndexType.None, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property. Sets Name.

    PropertyType type

    The type of the property. Sets Type.

    string objectType

    The object type of the property. Sets ObjectType.

    string linkOriginPropertyName

    The name of the property that links to the model. Sets LinkOriginPropertyName.

    bool isPrimaryKey

    A flag indicating whether this property is a primary key. Sets IsPrimaryKey.

    IndexType indexType

    An enum indicating whether this property is indexed and the type of the index used. Sets IndexType.

    string managedName

    The managed name of the property. Sets ManagedName.

    Properties

    | Edit this page View Source

    IndexType

    Gets a value indicating the index mode for this Property.

    Declaration
    public IndexType IndexType { get; }
    Property Value
    Type Description
    IndexType
    | Edit this page View Source

    IsPrimaryKey

    Gets a value indicating whether this Property is primary key.

    Declaration
    public bool IsPrimaryKey { get; }
    Property Value
    Type Description
    bool

    true if the property is primary key (the matching property in the class definition is marked with PrimaryKeyAttribute); false otherwise.

    | Edit this page View Source

    LinkOriginPropertyName

    Gets the name of the property that links to the model containing this LinkingObjects property. This will be null for properties where Type doesn't have the LinkingObjects flag.

    Declaration
    public string? LinkOriginPropertyName { get; }
    Property Value
    Type Description
    string

    The name of the linking property.

    | Edit this page View Source

    ManagedName

    Gets the managed name of the property. If not set, it is considered to be the same as Name.

    Declaration
    public string ManagedName { get; }
    Property Value
    Type Description
    string

    The name of the property.

    | Edit this page View Source

    Name

    Gets the name of the property as saved into realm.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    The name of the property.

    | Edit this page View Source

    ObjectType

    Gets the type of the object if relevant. This will be null for properties where Type doesn't have the Object flag.

    Declaration
    public string? ObjectType { get; }
    Property Value
    Type Description
    string

    The type of the object.

    | Edit this page View Source

    Type

    Gets the type of the property.

    Declaration
    public PropertyType Type { get; }
    Property Value
    Type Description
    PropertyType

    The type of the property.

    Methods

    | Edit this page View Source

    Backlinks(string, string, string, string?)

    Initializes a new property describing a collection of backlinks (all objects linking to this one via the specified property).

    Declaration
    public static Property Backlinks(string name, string originObjectType, string originPropertyName, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string originObjectType

    The object on the other side of the relationship.

    string originPropertyName

    The property that is on the other end of the relationship.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    See Also
    BacklinkAttribute
    | Edit this page View Source

    FromType(string, Type, bool, IndexType, bool?, string?)

    Initializes a new property from a Type value.

    Declaration
    public static Property FromType(string name, Type type, bool isPrimaryKey = false, IndexType indexType = IndexType.None, bool? isNullable = null, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    Type type

    The Type value that will be used to infer the PropertyType. Nullability will be inferred for value types, but must be specified via isNullable for reference types.

    bool isPrimaryKey

    A flag indicating whether the property is primary key.

    IndexType indexType

    An enum indicating whether this property is indexed and the type of the index used. Sets IndexType.

    bool? isNullable

    A flag indicating whether the property is nullable. Pass null to infer nullability from the type argument. Pass a non-null value to override it.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    FromType<T>(string, bool, IndexType, bool?, string?)

    Initializes a new property describing the provided type.

    Declaration
    public static Property FromType<T>(string name, bool isPrimaryKey = false, IndexType indexType = IndexType.None, bool? isNullable = null, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    bool isPrimaryKey

    A flag indicating whether the property is primary key.

    IndexType indexType

    An enum indicating whether this property is indexed and the type of the index used. Sets IndexType.

    bool? isNullable

    A flag indicating whether the property is nullable. Pass null to infer nullability from the T argument. Pass a non-null value to override it.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    Type Parameters
    Name Description
    T

    The type that will be used to infer the PropertyType. Nullability will be inferred for value types, but must be specified via isNullable for reference types.

    | Edit this page View Source

    Object(string, string, string?)

    Initializes a new property linking to a RealmObject.

    Declaration
    public static Property Object(string name, string objectType, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string objectType

    The object type. Both standalone and embedded objects are valid.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    ObjectDictionary(string, string, string?)

    Initializes a new property describing a dictionary of strings to RealmObjects.

    Declaration
    public static Property ObjectDictionary(string name, string objectType, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string objectType

    The object type. Both standalone and embedded objects are valid.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    ObjectList(string, string, string?)

    Initializes a new property describing a list of RealmObjects.

    Declaration
    public static Property ObjectList(string name, string objectType, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string objectType

    The object type. Both standalone and embedded objects are valid.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    ObjectSet(string, string, string?)

    Initializes a new property describing a set of RealmObjects.

    Declaration
    public static Property ObjectSet(string name, string objectType, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string objectType

    The object type. Both standalone and embedded objects are valid.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    Primitive(string, RealmValueType, bool, IndexType, bool, string?)

    Initializes a new property of a primitive (string, int, date, etc.) type.

    Declaration
    public static Property Primitive(string name, RealmValueType type, bool isPrimaryKey = false, IndexType indexType = IndexType.None, bool isNullable = false, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    RealmValueType type

    The type of the property. Note that using Null or Object will result in an exception being thrown. If you want to create an object property, use Object(string, string, string?).

    bool isPrimaryKey

    A flag indicating whether the property is primary key.

    IndexType indexType

    An enum indicating whether this property is indexed and the type of the index used. Sets IndexType.

    bool isNullable

    A flag indicating whether the property is nullable.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    PrimitiveDictionary(string, RealmValueType, bool, string?)

    Initializes a new property describing a dictionary of strings to primitive values.

    Declaration
    public static Property PrimitiveDictionary(string name, RealmValueType type, bool areElementsNullable = false, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    RealmValueType type

    The type of the property. Note that using Null or Object will result in an exception being thrown. If you want to create a dictionary of objects property, use ObjectDictionary(string, string, string?).

    bool areElementsNullable

    A flag indicating whether the elements of the list are nullable.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    PrimitiveList(string, RealmValueType, bool, string?)

    Initializes a new property describing a list of primitive values.

    Declaration
    public static Property PrimitiveList(string name, RealmValueType type, bool areElementsNullable = false, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    RealmValueType type

    The type of the property. Note that using Null or Object will result in an exception being thrown. If you want to create a list of objects property, use ObjectList(string, string, string?).

    bool areElementsNullable

    A flag indicating whether the elements of the list are nullable.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    PrimitiveSet(string, RealmValueType, bool, string?)

    Initializes a new property describing a set of primitive values.

    Declaration
    public static Property PrimitiveSet(string name, RealmValueType type, bool areElementsNullable = false, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    RealmValueType type

    The type of the property. Note that using Null or Object will result in an exception being thrown. If you want to create a set of objects property, use ObjectSet(string, string, string?).

    bool areElementsNullable

    A flag indicating whether the elements of the list are nullable.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    RealmValue(string, string?)

    Initializes a new property of RealmValue type.

    Declaration
    public static Property RealmValue(string name, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    RealmValueDictionary(string, string?)

    Initializes a new property describing a dictionary of RealmValues.

    Declaration
    public static Property RealmValueDictionary(string name, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    RealmValueList(string, string?)

    Initializes a new property describing a list of RealmValues.

    Declaration
    public static Property RealmValueList(string name, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    | Edit this page View Source

    RealmValueSet(string, string?)

    Initializes a new property describing a set of RealmValues.

    Declaration
    public static Property RealmValueSet(string name, string? managedName = null)
    Parameters
    Type Name Description
    string name

    The name of the property.

    string managedName

    The managed name of the property.

    Returns
    Type Description
    Property

    A Property instance that can be used to construct an ObjectSchema.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2020-2024 Realm
    Generated by DocFX