结构体属性
描述存储在Realm中的类的单个属性。
继承成员
命名空间: Realm 。模式
程序集:Realm.dll
语法
public readonly struct Property
构造函数
| 编辑本页 查看源代码Property(string, PropertyType, string?, string?, bool, IndexType, string?)
初始化Property结构体的新实例。
声明
public Property(string name, PropertyType type, string? objectType = null, string? linkOriginPropertyName = null, bool isPrimaryKey = false, IndexType indexType = IndexType.None, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 设置名称。 |
地产类型 | 类型 | 属性的类型。 设置类型。 |
字符串 | objectType | 属性的对象类型。 设置Object |
字符串 | linkOriginPropertyName | 链接到模型的属性的名称。 设置Link |
bool | isPrimaryKey | 指示此属性是否主键的标志。 设置Is |
索引类型 | 索引类型 | 一个枚举值,指示此属性是否已建立索引以及所使用的索引类型。 设置Index |
字符串 | ManagedName | 属性的托管名称。 设置Managed |
属性
| 编辑本页 查看源代码索引类型
获取一个值,该值指示此Property的索引模式。
声明
public IndexType IndexType { get; }
属性值
类型 | 说明 |
---|---|
索引类型 |
IsPrimaryKey
获取一个值,该值指示此属性是否主键。
声明
public bool IsPrimaryKey { get; }
属性值
类型 | 说明 |
---|---|
bool |
|
LinkOriginPropertyName
获取链接到包含此Linkingnull
。
声明
public string? LinkOriginPropertyName { get; }
属性值
类型 | 说明 |
---|---|
字符串 | 链接属性的名称。 |
ManagedName
获取属性的托管名称。 如果未设立,则视为与“名称”相同。
声明
public string ManagedName { get; }
属性值
类型 | 说明 |
---|---|
字符串 | 属性的名称。 |
名称
获取保存到 Realm 中的属性的名称。
声明
public string Name { get; }
属性值
类型 | 说明 |
---|---|
字符串 | 属性的名称。 |
ObjectType
声明
public string? ObjectType { get; }
属性值
类型 | 说明 |
---|---|
字符串 | 对象的类型。 |
类型
获取属性的类型。
声明
public PropertyType Type { get; }
属性值
类型 | 说明 |
---|---|
地产类型 | 属性的类型。 |
方法
| 编辑本页 查看源代码反向链接( string , string , string , string ?)
初始化描述反向链接集合的新属性(通过指定属性链接到该反向链接的所有对象)。
声明
public static Property Backlinks(string name, string originObjectType, string originPropertyName, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
字符串 | originObjectType | 关系另一方的对象。 |
字符串 | originPropertyName | 关系另一端的属性。 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
另请参阅
| 编辑本页 查看源代码FromType(string, Type, bool, IndexType, bool?, string?)
从Type值初始化新属性。
声明
public static Property FromType(string name, Type type, bool isPrimaryKey = false, IndexType indexType = IndexType.None, bool? isNullable = null, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
类型 | 类型 | 将用于推断 Property |
bool | isPrimaryKey | 指示属性是否主键的标志。 |
索引类型 | 索引类型 | 一个枚举值,指示此属性是否已建立索引以及所使用的索引类型。 设置Index |
bool ? | isNullable | 指示属性是否可为 null 的标志。 传递 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
FromType<T>(string, bool, IndexType, bool?, string?)
初始化描述所提供类型的新属性。
声明
public static Property FromType<T>(string name, bool isPrimaryKey = false, IndexType indexType = IndexType.None, bool? isNullable = null, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
bool | isPrimaryKey | 指示属性是否主键的标志。 |
索引类型 | 索引类型 | 一个枚举值,指示此属性是否已建立索引以及所使用的索引类型。 设置Index |
bool ? | isNullable | 指示属性是否可为 null 的标志。 传递 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
类型参数
名称 | 说明 |
---|---|
t | 将用于推断Property |
Object(string, string, string?)
初始化链接到 RealmObject 的新属性。
声明
public static Property Object(string name, string objectType, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
ObjectDictionary(string, string, string?)
将描述字符串字典的新属性初始化为 RealmObjects。
声明
public static Property ObjectDictionary(string name, string objectType, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
ObjectList(string, string, string?)
初始化描述 RealmObject 列表的新属性。
声明
public static Property ObjectList(string name, string objectType, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
ObjectSet(string, string, string?)
初始化描述一组 RealmObject 的新属性。
声明
public static Property ObjectSet(string name, string objectType, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
Primitive(string, RealmValueType, bool, IndexType, bool, string?)
初始化基元( string 、 int 、 date 等)类型的新属性。
声明
public static Property Primitive(string name, RealmValueType type, bool isPrimaryKey = false, IndexType indexType = IndexType.None, bool isNullable = false, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
Realm |
类型 | 属性的类型。 请注意,使用空值或对象将导致抛出异常。 如果要创建对象属性,请使用Object(string, string, string?) 。 |
bool | isPrimaryKey | 指示属性是否主键的标志。 |
索引类型 | 索引类型 | 一个枚举值,指示此属性是否已建立索引以及所使用的索引类型。 设置Index |
bool | isNullable | 指示属性是否可为 null 的标志。 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
PrimitiveDictionary(string, RealmValueType, bool, string?)
将描述字符串字典的新属性初始化为原始值。
声明
public static Property PrimitiveDictionary(string name, RealmValueType type, bool areElementsNullable = false, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
Realm |
类型 | 属性的类型。 请注意,使用空值或对象将导致抛出异常。 如果要创建对象属性的字典,请使用Object |
bool | areElementsNullable | 指示列表元素是否可为 null 的标志。 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
PrimitiveList(string, RealmValueType, bool, string?)
初始化描述基元值列表的新属性。
声明
public static Property PrimitiveList(string name, RealmValueType type, bool areElementsNullable = false, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
Realm |
类型 | 属性的类型。 请注意,使用空值或对象将导致抛出异常。 如果要创建对象属性列表,请使用Object |
bool | areElementsNullable | 指示列表元素是否可为 null 的标志。 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
PrimitiveSet(string, RealmValueType, bool, string?)
初始化描述一设立基元值的新属性。
声明
public static Property PrimitiveSet(string name, RealmValueType type, bool areElementsNullable = false, string? managedName = null)
参数
类型 | 名称 | 说明 |
---|---|---|
字符串 | 名称 | 属性的名称。 |
Realm |
类型 | 属性的类型。 请注意,使用空值或对象将导致抛出异常。 如果要创建一设立对象属性,请使用Object |
bool | areElementsNullable | 指示列表元素是否可为 null 的标志。 |
字符串 | ManagedName | 属性的托管名称。 |
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
RealmValue(string, string?)
初始化 RealmValue 类型的新属性。
声明
public static Property RealmValue(string name, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
RealmValueDictionary(string, string?)
初始化描述 RealmValues 字典的新属性。
声明
public static Property RealmValueDictionary(string name, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
RealmValueList(string, string?)
初始化描述 RealmValues 列表的新属性。
声明
public static Property RealmValueList(string name, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |
RealmValueSet(string, string?)
初始化描述一组 RealmValue 的新属性。
声明
public static Property RealmValueSet(string name, string? managedName = null)
参数
返回:
类型 | 说明 |
---|---|
属性 | 可用于构造 Object |