Skip to main content

Projection

Projection is a data type that is used as a definition of property set for a Model. It is not a real class, however it may be instantiated if needed. During loading a model, only properties that are defined in a projection will be loaded. Projections are optional, because you may just supply string array with property names, but projections is a recommended way to define property sets. Projection should be used as a base class for all data types, it doesn't contain any properties. RecordProjection should be used as a base class for all business objects, that can be identified, it doesn't contain any properties. Projection may contain any properties that are defined in corresponding Model class, but the Id property will be loaded automatically in any case. You may need different projections for different purposes, framework contains some predefined projections:

  • RecordCommonProjection - set of properties that is used for common purposes.
  • RecordCreateProjection - set of properties that is used during record creation or cloning. Non-mentioned properties won't be created or cloned.
  • RecordDropdownProjection - set of properties that is used for dropdown list on frontend. Non-mentioned properties won't be loaded.
  • RecordEditorProjection - set of properties that is used for editor page on frontend. Non-mentioned properties won't be loaded.
  • RecordIdentityProjection - set of properties that contains only Id property and is used for references MainRecord -> ReferencedRecord. Usually you don't need to inherit this class.
  • RecordInitializeProjection - set of properties that is used during record initialization. Is is applicable for record properties only. Non-mentioned properties won't be initialized.
  • RecordProcessingProjection - set of properties that is used on backend for different data manipulations, calculations, etc. Non-mentioned properties won't be loaded and processed.
  • RecordReferenceProjection - set of properties that is used for references MainRecord -> ReferencedRecord. Unlike RecordIdentityProjection it may contains as many properties as you need. Non-mentioned properties won't be loaded.
  • RecordSeedProjection - set of properties that is used for seeding process. Non-mentioned properties won't be seeded.
  • RecordSnapshotProjection - set of properties that is used for creating record snapshot, if record came from external service and doesn't have a stable identifier.
  • RecordTableProjection - set of properties that is used for table page on frontend. Non-mentioned properties won't be loaded.
  • RecordTemplateProjection - set of properties that is used for seeding process. Sometimes you have records that depend on each other, sometimes these dependencies might be rather tricky. To eliminate dependencies resolution complexity you may use two-phase seeding. During first phase you seed a template - set of properties without dependencies. During second phase you seed other properties. Non-mentioned properties won't be seeded during first phase.
  • RecordValidateProjection - set of properties that is used for validation. Non-mentioned properties won't be loaded and validated.