In this example, we will create a new domain entity called StudentTransportation. This entity will add an Ed-Fi Extension to the Student Enrollment interchange and will be exposed in Ed-Fi ODS / API through a new API resource called studentTransportations. It is assumed that the Ed-Fi ODS has been successfully downloaded and is running as in a local environment per the instructions in the Getting Started documentation.
The steps can be summarized as:
Each step is outlined in detail, below.
Step 1. Author Ed-Fi Core Schema Extensions
Create an Extension to the Ed-Fi Core Schema, called EXTENSION-Ed-Fi-Core.xsd, and place it in the C:\Ed-Fi-ODS-Implementation\Extensions\Schemas folder. This Extension introduces new entity types for the StudentTransportation entity. It is important to note that core schema Extension file must be able to resolve the reference to the Ed-Fi Core Schema file.
For more information about how to extend the Ed-Fi Core Schema, see XML Schema - Extensions Framework Guide.
Step 2. Author a Custom Interchange Schema
Create a custom interchange file, called EXTENSION-Interchange-StudentEnrollment.xsd, and place it in the C:\Ed-Fi-ODS-Implementation\Extensions\Schemas folder. This file overrides the Ed-Fi Student Enrollment Interchange, adding in the StudentTransportation entity into the Interchange. It is important to note that the
schemaLocation should be a valid reference the schema file that contains the Extension definition (i.e., the EXTENSION-Ed-Fi-Core.xsd file created in the previous step).
For more information about how to create a custom interchange schema, see XML Schema - Custom Interchange Schema.
Step 3. Author Database Schema Extensions
Create an Extension SQL script called 0001-Extensions.sql and place it in the C:\Ed-Fi-ODS-Implementation\Database\Structure\EdFi folder. This script defines the database schema for the Extension.
When modeling the Ed-Fi Extension database tables, it is important to follow the patterns that already exist in the database.
Step 4. Author API Metadata Extensions
Create an Extension API metadata file called DomainMetadata-Extension.xml and place it in the C:\Ed-Fi-ODS-Implementation\Extensions\Metadata folder. This file will register the StudentTransportation entity as a domain aggregate and ensure the code generation process will process the entity.
Step 5. Run Code Generation and Verify Changes
Re-run the code generation steps outlined in the Getting Started Guide, (i.e., from a PowerShell prompt run
Initialize-PowershellForDevelopment.ps script, followed by the
initdev command). Then run the application and view the Ed-Fi ODS / API using Swagger. The following new API resource should be visible: