When ODS / API instance you are working with contains extensions, custom profiles or custom composites, you will not be able to use Ed-Fi core SDK from the NuGet feed as described in Using Ed-Fi Core SDK . However you can use code generation to create customized SDK.

Generating a new SDK

Visit Using Code Generation to Create an SDK article for step-by -step guidance for SDK generation.  Install and configure required software, Download and extract SDK Generator source code. Pay attention to the extracted folder name and path

Run the SDK generator to generate SDK jar file. 

Execute each of the following commands from the directory of the previously generated SDK jar file (e.g. C:\Ed-Fi-ODS-API-SDK\target\scala-2.10).

SDK Generator Commands

java -jar sdk-generate.jar csharp --url https://api.ed-fi.org/api/metadata/resources/api-docs --baseDir C:\Ed-Fi-ODS-API-SDK\CSharpSDK --apiPackage EdFi.OdsApi.Sdk.Api.Resources --modelPackage EdFi.OdsApi.Sdk.Models.Resources --helperPackage EdFi.OdsApi.Sdk.Helpers --projectName EdFiClientSDK

java -jar sdk-generate.jar csharp --url https://api.ed-fi.org/api/metadata/descriptors/api-docs --baseDir C:\Ed-Fi-ODS-API-SDK\CSharpSDK --apiPackage EdFi.OdsApi.Sdk.Api.Descriptors --modelPackage EdFi.OdsApi.Sdk.Models.Descriptors --helperPackage EdFi.OdsApi.Sdk.Helpers --projectName EdFiClientSDK

java -jar sdk-generate.jar csharp --url https://api.ed-fi.org/api/metadata/types/api-docs --baseDir C:\Ed-Fi-ODS-API-SDK\CSharpSDK --apiPackage EdFi.OdsApi.Sdk.Api.Types --modelPackage EdFi.OdsApi.Sdk.Models.Types --helperPackage EdFi.OdsApi.Sdk.Helpers --projectName EdFiClientSDK 

java -jar sdk-generate.jar csharp --url https://api.ed-fi.org/api/metadata/assessment/api-docs --baseDir C:\Ed-Fi-ODS-API-SDK\CSharpSDK --apiPackage EdFi.OdsApi.Sdk.Api.AssessmentComposite --modelPackage EdFi.OdsApi.Sdk.Models.AssessmentComposite --helperPackage EdFi.OdsApi.Sdk.Helpers --projectName EdFiClientSDK

java -jar sdk-generate.jar csharp --url https://api.ed-fi.org/api/metadata/enrollment/api-docs --baseDir C:\Ed-Fi-ODS-API-SDK\CSharpSDK --apiPackage EdFi.OdsApi.Sdk.Api.EnrollmentComposite --modelPackage EdFi.OdsApi.Sdk.Models.EnrollmentComposite --helperPackage EdFi.OdsApi.Sdk.Helpers --projectName EdFiClientSDK

Open up Visual Studio and create a new project. Choose the type Visual C# > ClassLibrary. Name the project "EdFiClientSDK".

Copy C:\Ed-Fi-ODS-API-SDK\CSharpSDK\EdFiClientSDK\EdFi folder to newly created project  folder

Click on  Soultion Explorer > Show All Files

Add the Copied files to project

Expand the folders and notice the Apis, Models, and Helpers namespaces simillar to EdFi provided core SDK.

Use the Package Manager Console to install the RestSharp library. At the PM> prompt, enter "install-package restsharp".

Compile the solution to make sure there are no errors

Using the SDK

Now you can use the project same way as you did in Using Ed-Fi Core SDK NuGet. 

  • No labels