Date: Thu, 28 Mar 2024 14:37:45 -0500 (CDT) Message-ID: <1393038148.30118.1711654665415@PUBEDFIPRDWEB5.public.local> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_30117_840657264.1711654665411" ------=_Part_30117_840657264.1711654665411 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
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 assum= ed that the Ed-Fi ODS / API has been successfully downloaded and is running= in a local environment per the instructions in the Getting Started documentat= ion.
The steps in Visual Studio can be summarized as:
Each step is outlined in detail, below.
Step 1.1. Add a Composite Project Using the Visual Studio Projec= t Template. Visual Studio Project Template can be installed b= y following the steps in the Project Templates Installation section= of this documentation.
Step 1.2. Update the= Marker Interface file.
To integrate the Composite with the API, start by ensuring you have a ma= rker interface in the root of your Composites project.
This interface is an idiom used in the Ed-Fi Visual Studio Solution to e= nable a strongly typed mechanism for obtaining a reference to the .NET asse= mbly. If you used the Visual Studio Project template to create your composi= te, a file will already exist =E2=80=94 but you'll need to rename the inter= face and the file to match the convention (e.g., Marker_EdFi_O= ds_Composites_MyComposites.cs). The ma= rker interface file should have the following code:
namespace= EdFi.Ods.Composites.MyComposites { public interface Marker_EdFi_Ods_Composites_MyComposites { } }
Step 1.3.=
Update the
The Visual Studio Project Templat= e creates an empty sample Composites.xml file, replace its conte= nts with the following:
<?xml= version=3D"1.0" encoding=3D"utf-8"?> <CompositeMetadata organizationCode=3D"ed-fi"> <Category displayName=3D"My Sample Composites" name=3D"MyComposite">= ; <Routes> <Route relativeRouteTemplate=3D"/sections/{Section.Id}/{compositeN= ame}" /> </Routes> <Composites> <Composite name=3D"Student"> <Specification> <Parameter name=3D"Section.Id" filterPath=3D"StudentSectionAss= ociations->Section.Id" /> </Specification> <BaseResource name=3D"Student"> <Property name=3D"StudentUniqueId" /> <Property name=3D"FirstName" /> <Property name=3D"LastSurname" /> <Property name=3D"BirthDate" /> </BaseResource> </Composite> </Composites> </Category> </CompositeMetadata>
Consult API Composite Resources f= or guidance.
Composites cannot include resource model members added via Ed-Fi Extensi= ons. ODS / API composite definitions currently support only the resource mo= dels from the Ed-Fi Core.
The CompositeMetadata
attribu=
te organizationCode is a required attribute and indicates the Organization =
to which the composite belongs. This value is carried from the XML definiti=
on all the way into the API route definitions. The organizationCode=
code> in combination with the
Category
name are used to identi=
fy the composite being requested from the API.
Step 1.4. Save the Project.
To integrate the Composite Resources into the solution, add a reference = to new Composites project you constructed in the previous step in the&= nbsp;EdFi.Ods.WebApi project (located in the "En= try Points" folder).
Save all modified files, then run the application and view the Ed-F= i ODS / API using Swagger. The following new API Composite resource sh= ould be available:
You may have to clear your browser cache in order for Swagger UI to disp= lay the new resource.
The organizationCode
mentioned in Step 1.3 ("ed-fi" in=
this example) can be seen in the Composite URLs above (e.g., /ed-fi/=
composites/MyComposite/Students
). To successfully retrieve a composi=
te, 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: