Class RealmSchema.Builder
A mutable builder that allows you to construct a RealmSchema instance.
Inherited Members
Namespace: Realms.Schema
Assembly: Realm.dll
Syntax
public class RealmSchema.Builder : SchemaBuilderBase<ObjectSchema>, IEnumerable<ObjectSchema>, IEnumerable
Constructors
| Edit this page View SourceBuilder()
Initializes a new instance of the RealmSchema.Builder class.
Declaration
public Builder()
Methods
| Edit this page View SourceAdd(ObjectSchema)
Adds a new ObjectSchema to this RealmSchema.Builder.
Declaration
public RealmSchema.Builder Add(ObjectSchema schema)
Parameters
Type | Name | Description |
---|---|---|
ObjectSchema | schema | The ObjectSchema to add. |
Returns
Type | Description |
---|---|
RealmSchema.Builder | The original RealmSchema.Builder instance to enable chaining multiple Add(ObjectSchema) calls. |
Add(Builder)
Adds a new ObjectSchema.Builder to this RealmSchema.Builder.
Declaration
public RealmSchema.Builder Add(ObjectSchema.Builder schemaBuilder)
Parameters
Type | Name | Description |
---|---|---|
ObjectSchema.Builder | schemaBuilder | The ObjectSchema.Builder to add. |
Returns
Type | Description |
---|---|
RealmSchema.Builder | The original RealmSchema.Builder instance to enable chaining multiple Add(Builder) calls. |
Remarks
This is a convenience method that will call Build() internally. It is intended to simplify declarative schema construction via collection initializers:
var schema = new RealmSchema.Builder
{
new ObjectSchema.Builder("MyClass", isEmbedded: false)
{
Property.Primitive("MyProperty", RealmValueType.Int)
}
}
Add(Type)
Adds a new Type to this RealmSchema.Builder.
Declaration
public RealmSchema.Builder Add(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The Type to add. It will be converted to ObjectSchema and added to the builder. |
Returns
Type | Description |
---|---|
RealmSchema.Builder | The original RealmSchema.Builder instance to enable chaining multiple Add(Type) calls. |
Build()
Constructs a RealmSchema from the properties added to this RealmSchema.Builder.
Declaration
public RealmSchema Build()
Returns
Type | Description |
---|---|
RealmSchema | An immutable RealmSchema instance that contains the properties added to the RealmSchema.Builder. |