18 - Reference an Entity Defined in a Different Project (Including Core)
Problem
Need to reference an entity that is defined in a different project. Note, the following example is for referencing a domain entity but the same approach is required when referencing domain entities, associations, or properties.
Solution
Include the project namespace followed by a period when referencing the entity. If the entity is defined in the core Ed-Fi model, the namespace is "EdFi". If the entity is defined in a different project, the namespace matches the projectName as it is defined in the project's package.json file.
Discussion
Sometimes, a project may require a reference to an entity that is defined in a different project. This is most common when referencing an entity or property defined in the core Ed-Fi model while working in an extension project.
For example, the new domain entity below in an extension project StudentTransportation references both School and Student, domain entities defined in the core Ed-Fi model.
Example Domain Entity
The Student and School entities that are defined in the core Ed-Fi model (i.e. outside of the StudentTransportation extension project), include the namespace reference "EdFi" followed by a period before the name of the entity. Those properties that are newly defined in the StudentTransportation extension project do not require a namespace reference.