Struct Property
Describes a single property of a class stored in a Realm.
Inherited Members
Namespace: Realms.Schema
Assembly: Realm.dll
Syntax
public readonly struct Property
Constructors
| Edit this page View SourceProperty(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 SourceIndexType
Gets a value indicating the index mode for this Property.
Declaration
public IndexType IndexType { get; }
Property Value
Type | Description |
---|---|
IndexType |
IsPrimaryKey
Gets a value indicating whether this Property is primary key.
Declaration
public bool IsPrimaryKey { get; }
Property Value
Type | Description |
---|---|
bool |
|
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. |
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. |
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. |
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. |
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 SourceBacklinks(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
| Edit this page View SourceFromType(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 |
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 |
string | managedName | The managed name of the property. |
Returns
Type | Description |
---|---|
Property | A Property instance that can be used to construct an ObjectSchema. |
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 |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |