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.
How To: Create an Extension Plugin
In this example, we will create an extension plugin and publish it to NuGet feed, which can then be placed in the plugin folder of a pre-deployed ODS / API to extend it.
Before you begin:
- This walkthrough assumes you have a working extension project.
- This article uses the student transportation extension as an example.
- This example assumes you have the NuGet CLI tool. You can follow the instructions for Installing NuGet Client Tools.
- This example assumes you have access to a MyGet feed.
- If you don't have a MyGet feed, you can follow MyGet's instructions for Getting Started with NuGet.
- Alternatively, you can also work with other cost-effective options for distributing software packages such as Azure Artifacts, GitHub Packages, and so forth.
The steps can be summarized as:
Each step is outlined in detail, below.
Creating Extension Plugins
Step 1. Run CodeGen
After creating your extension project by following the example on How To: Extend the Ed-Fi ODS / API - Student Transportation Example, open a PowerShell session and navigate to Ed-Fi-ODS-Implementation folder and execute the following command to run code generation.
cd <source directory>\Ed-Fi-ODS-Implementation .\Initialize-PowershellForDevelopment.ps1 Invoke-CodeGen -Engine SQLServer
Step 2. Build Your Extension Project
From a PowerShell session, run the following command to build your extension project. If you followed the example on How To: Extend the Ed-Fi ODS / API - Student Transportation Example to create the EdFi.Ods.Extensions.SampleStudentTransportation project, your extension will be in Ed-Fi-ODS-Implementation\Application folder.
C:\Program Files\dotnet\dotnet.exe build <source directory>\Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Extensions.SampleStudentTransportation --configuration release
Step 3. Create a NuGet Package
Create a nuspec file for your extension package and place it in your extension project folder. The following example shows contents of the EdFi.Ods.Extensions.SampleStudentTransportation.nuspec file and is placed in <source directory>\Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Extensions.SampleStudentTransportation folder.
<?xml version="1.0"?> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>EdFi.Suite3.Ods.Extensions.SampleStudentTransportation</id> <version>5.1.0</version> <authors>Ed-Fi Alliance</authors> <owners>Ed-Fi Alliance</owners> <projectUrl>https://github.com/Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>EdFi.Ods.Extensions.SampleStudentTransportation</description> <releaseNotes></releaseNotes> </metadata> <files> <file src="Artifacts/**/*.sql" target="."/> <file src="Artifacts/**/*.json" target="."/> <file src="bin\release\netcoreapp3.1\EdFi.Ods.Extensions.SampleStudentTransportation.dll" target="."/> </files> </package>
Go to the location of NuGet.exe in your system and execute the following command in a command prompt. Make sure to update the contents of the nuspec file with your information. It is recommended that you version your extension package with the same version as the ODS / API for which it was built.
NuGet.exe pack <source directory>\Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Extensions.SampleStudentTransportation\EdFi.Ods.Extensions.SampleStudentTransportation.nuspec -OutputDirectory C:\OSS-Workspace\NugetPackages -Properties configuration=release -NoPackageAnalysis -NoDefaultExcludes
Step 4. Publish NuGet Package
In this step, execute the following command to publish NuGet package.
NuGet.exe push C:\OSS-Workspace\NugetPackages\EdFi.Suite3.Ods.Extensions.SampleStudentTransportation.5.1.0.nupkg <apikey> -Source https://www.myget.org/F/ed-fi/api/v3/index.json
Consuming Extension Plugins
Follow similar approach described in How To: Deploy TPDM As Dynamic Plugin to consume the published extension package.