A newer version of the Ed-Fi ODS / API is now available. See the Ed-Fi Technology Version Index for a link to the latest version.

Skip to end of metadata
Go to start of metadata

This section outlines the steps necessary to integrate and activate the Ed-Fi Composite definitions for use in an Ed-Fi ODS / API. It is assumed that the Ed-Fi ODS / API has been successfully downloaded and is running in a local environment per the instructions in the Getting Started documentation.  

The steps in Visual Studio can be summarized as:

Each step is outlined in detail, below. 

Step 1. Create the Composites Project

Step 1.1. Add a Composite Project Using the Visual Studio Project Template. Visual Studio Project Template can be installed by following steps in Getting Started - Project Templates Installation section of this documentation.

  • To add a project to your Ed-Fi-Ods Visual Studio Solution, right-click on the "Composites" folder. Select Add > New Project.
  • In the "Add New Project" dialog, find the "Ed-Fi API Composites Project Template" entry at the bottom of the Visual C# section, as shown below. Make sure you choose Microsoft .NET Framework 4.8 or above.
  • Enter the project name for the new project and click OK. The suggested naming convention for this type of project is something like EdFi.Ods.Composites.MyComposites.

Step 1.2. Update the Marker Interface file. 

To integrate the Composite with the API, start by ensuring you have a marker interface in the root of your Composites project.  in the root of your Composites project.

This interface is an idiom used in the Ed-Fi Visual Studio Solution to enable a strongly typed mechanism for obtaining a reference to the .NET assembly. If you used the Visual Studio Project template to create your composite, a file will already exist — but you'll need to rename the interface and the file to match the convention (e.g., Marker_EdFi_Ods_Composites_MyComposites.cs). The marker interface file should have the following code:

namespace EdFi.Ods.Composites.MyComposites
    public interface Marker_EdFi_Ods_Composites_MyComposites { }

Step 1.3. Update the Composites.xml file to add the appropriate composite definition. 

The Visual Studio Project Template creates a sample Composites.xml file. Consult API Composite Resources for guidance. The Composite Definition should look something like the following:

<?xml version="1.0" encoding="utf-8"?>
<CompositeMetadata organizationCode="ed-fi">
  <Category displayName="My Sample Composites" name="MyComposite">
      <Route relativeRouteTemplate="/sections/{Section.Id}/{compositeName}" />
      <Composite name="Student">
          <Parameter name="Section.Id" filterPath="StudentSectionAssociation->Section.Id" />
        <BaseResource name="Student">
          <Property name="StudentUniqueId" />
          <Property name="FirstName" />
          <Property name="LastSurname" />
          <Property name="BirthDate" />

Composites cannot include resource model members added via Ed-Fi Extensions. ODS / API composite definitions currently support only the resource models from the Ed-Fi Core.

The CompositeMetadata attribute 'organizationCode' is a required attribute and indicates the 'Organization' the composite belongs to. This value is carried from the xml definition all the way into the API route definitions. The organizationCode in combination with the Category name are used to identify the composite being requested from the API.  

Step 1.4. Save the Project.

Step 2. Integrate Composites into the Solution

To integrate the Composite Resources into the solution, perform the following tasks in the EdFi.Ods.WebApi project (located in the "Entry Points" folder):

Step 2.1. Add a reference to the new Composites project you constructed in the previous step.

  • Open the EdFi.Ods.WebApi.Startup.ApiStartup.cs file and add the following code in the following steps.
  • Add a line to include MyComposites assembly:

using EdFi.Ods.Composites.MyComposites;

Step 2.2. Locate the EnsureAssembliesLoaded method in the same file and add a line for the new extension assembly marker to ensure it is loaded at runtime. The line should read something like the following:


Step 3. Run Code Generation and Verify Changes 

Save all modified files, close the Ed-Fi-ODS Visual Studio Solution, then 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 Composite resource should be available:

You may have to clear your browser cache in order for Swagger UI to display the new resource.

The "organizationCode" (ed-fi) mentioned in Step 1.3 can be seen in the Composite URLs above (e.g., /ed-fi/composites/MyComposite/Students). To successfully retrieve a composite, this value (defined in the XML definition) must be present as the first segment of a composite URL.


The following GitHub link contains source files for the Composite described in this article:

Composite Source Files