Search Results for

    Show / Hide Table of Contents

    Class RealmSchema

    Describes the complete set of classes which may be stored in a Realm, either from assembly declarations or, dynamically, by evaluating a Realm from disk. To construct a new RealmSchema instance, use the RealmSchema.Builder API.
    By default, this will be all the IRealmObjects and IEmbeddedObjects in all your assemblies. Unless you restrict with Schema. Just because a given class may be stored in a Realm doesn't imply much overhead. There will be a small amount of metadata but objects only start to take up space once written.

    Inheritance
    object
    RealmSchema
    Implements
    IReadOnlyCollection<ObjectSchema>
    IEnumerable<ObjectSchema>
    IEnumerable
    Namespace: Realms.Schema
    Assembly: Realm.dll
    Syntax
    public class RealmSchema : IReadOnlyCollection<ObjectSchema>, IEnumerable<ObjectSchema>, IEnumerable

    Properties

    | Edit this page View Source

    Count

    Gets the number of known classes in the schema.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    The number of known classes.

    Methods

    | Edit this page View Source

    AddDefaultTypes(IEnumerable<Type>)

    Adds a collection of types to the default schema.

    Declaration
    public static void AddDefaultTypes(IEnumerable<Type> types)
    Parameters
    Type Name Description
    IEnumerable<Type> types

    Types to be added to the default schema.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown if the schema has already materialized.

    | Edit this page View Source

    GetBuilder()

    Create a mutable RealmSchema.Builder containing the object schemas in this Realm schema.

    Declaration
    public RealmSchema.Builder GetBuilder()
    Returns
    Type Description
    RealmSchema.Builder

    A RealmSchema.Builder instance that can be used to mutate the schema and eventually produce a new one by calling Build().

    | Edit this page View Source

    TryFindObjectSchema(string, out ObjectSchema)

    Attempts to find the definition of a class in this schema.

    Declaration
    public bool TryFindObjectSchema(string name, out ObjectSchema schema)
    Parameters
    Type Name Description
    string name

    A valid class name which may be in this schema.

    ObjectSchema schema

    The schema corresponding to the provided name or null if the schema is not found.

    Returns
    Type Description
    bool

    true if this RealmSchema contains a class definition with the supplied name; false otherwise.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if a name is not supplied.

    Operators

    | Edit this page View Source

    implicit operator RealmSchema?(ObjectSchema[]?)

    Constructs a RealmSchema from an array of ObjectSchema instances.

    Declaration
    public static implicit operator RealmSchema?(ObjectSchema[]? objects)
    Parameters
    Type Name Description
    ObjectSchema[] objects

    The object schemas that will be contained in the newly constructed RealmSchema.

    Returns
    Type Description
    RealmSchema

    null if objects is null; a RealmSchema containing the supplied ObjectSchemas otherwise.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the array contains multiple ObjectSchema instances with the same Name.

    | Edit this page View Source

    implicit operator RealmSchema?(Builder?)

    A convenience operator to construct a RealmSchema from a RealmSchema.Builder by calling the Build() method.

    Declaration
    public static implicit operator RealmSchema?(RealmSchema.Builder? builder)
    Parameters
    Type Name Description
    RealmSchema.Builder builder

    The builder that describes the newly created schema.

    Returns
    Type Description
    RealmSchema

    null if builder is null; the result of Build() otherwise.

    | Edit this page View Source

    implicit operator RealmSchema?(HashSet<Type>?)

    Constructs a RealmSchema from a HashSet of Type instances.

    Declaration
    public static implicit operator RealmSchema?(HashSet<Type>? objects)
    Parameters
    Type Name Description
    HashSet<Type> objects

    The Types that will be converted to ObjectSchema and added to the resulting RealmSchema.

    Returns
    Type Description
    RealmSchema

    null if objects is null; a RealmSchema containing the supplied ObjectSchemas otherwise.

    See Also
    Add(Type)
    | Edit this page View Source

    implicit operator RealmSchema?(List<ObjectSchema>?)

    Constructs a RealmSchema from a list of ObjectSchema instances.

    Declaration
    public static implicit operator RealmSchema?(List<ObjectSchema>? objects)
    Parameters
    Type Name Description
    List<ObjectSchema> objects

    The object schemas that will be contained in the newly constructed RealmSchema.

    Returns
    Type Description
    RealmSchema

    null if objects is null; a RealmSchema containing the supplied ObjectSchemas otherwise.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the list contains multiple ObjectSchema instances with the same Name.

    | Edit this page View Source

    implicit operator RealmSchema?(List<Type>?)

    Constructs a RealmSchema from a List of Type instances.

    Declaration
    public static implicit operator RealmSchema?(List<Type>? objects)
    Parameters
    Type Name Description
    List<Type> objects

    The Types that will be converted to ObjectSchema and added to the resulting RealmSchema.

    Returns
    Type Description
    RealmSchema

    null if objects is null; a RealmSchema containing the supplied ObjectSchemas otherwise.

    See Also
    Add(Type)
    | Edit this page View Source

    implicit operator RealmSchema?(Type[]?)

    Constructs a RealmSchema from an array of Type instances.

    Declaration
    public static implicit operator RealmSchema?(Type[]? objects)
    Parameters
    Type Name Description
    Type[] objects

    The Types that will be converted to ObjectSchema and added to the resulting RealmSchema.

    Returns
    Type Description
    RealmSchema

    null if objects is null; a RealmSchema containing the supplied ObjectSchemas otherwise.

    See Also
    Add(Type)

    Implements

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