# RelationshipContainer

    public enum RelationshipContainer<O> where O : CoreStoreObject

The containing type for relationships. Use the `DynamicObject.Relationship` typealias instead for shorter syntax.

    class Dog: CoreStoreObject {
        let master = Relationship.ToOne<Person>("master")
    }
    class Person: CoreStoreObject {
        let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master })
    }

### ToOne

- `ToOne`

  The containing type for to-one relationships. Any `CoreStoreObject` subclass can be a destination type. Inverse relationships should be declared from the destination type as well, using the `inverse:` argument for the relationship.

      class Dog: CoreStoreObject {
          let master = Relationship.ToOne<Person>("master")
      }
      class Person: CoreStoreObject {
          let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master })
      }

  Important

  `Relationship.ToOne` properties are required to be stored properties. Computed properties will be ignored, including `lazy` and `weak` properties.
  See more

  #### Declaration

  Swift

      public final class ToOne<D> : RelationshipProtocol where D : CoreStoreObject

### ToManyOrdered

- `ToManyOrdered`

  The containing type for to-many ordered relationships. Any `CoreStoreObject` subclass can be a destination type. Inverse relationships should be declared from the destination type as well, using the `inverse:` argument for the relationship.

      class Dog: CoreStoreObject {
          let master = Relationship.ToOne<Person>("master")
      }
      class Person: CoreStoreObject {
          let pets = Relationship.ToManyOrdered<Dog>("pets", inverse: { $0.master })
      }

  Important

  `Relationship.ToManyOrdered` properties are required to be stored properties. Computed properties will be ignored, including `lazy` and `weak` properties.
  See more

  #### Declaration

  Swift

      public final class ToManyOrdered<D> : RelationshipProtocol where D : CoreStoreObject

### ToManyUnordered

- `ToManyUnordered`

  The containing type for to-many unordered relationships. Any `CoreStoreObject` subclass can be a destination type. Inverse relationships should be declared from the destination type as well, using the `inverse:` argument for the relationship.

      class Dog: CoreStoreObject {
          let master = Relationship.ToOne<Person>("master")
      }
      class Person: CoreStoreObject {
          let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master })
      }

  Important

  `Relationship.ToManyUnordered` properties are required to be stored properties. Computed properties will be ignored, including `lazy` and `weak` properties.
  See more

  #### Declaration

  Swift

      public final class ToManyUnordered<D> : RelationshipProtocol where D : CoreStoreObject