Getting Started with the Library

Learn how to add the C# Client Library to an ASP.NET Core solution

📘

Steps to get started with the C# Client Library

With an understanding of How the C# Client Library Works let's review how to set it up in a project.

  1. Install the Pacakge
  2. Add the Directscale Middleware
  3. Configure the Directscale Middleware.

👍

You can download the ACME Client Extension from GitHub to see an example of a project using the C# Client Library.


Package Installation


📘

The C# Client Library can be downloaded from NuGet.org

The DirectScale Extension Package can be added with the following approaches using Microsoft Visual Studio:

  • From the Package Manager Console window:
    • Go to View > Other Windows > Package Manager Console
    • Navigate to the directory in which the .csproj file exists
    • Execute the following command:
Install-Package DirectScale.Disco.Extension.Abstractions
  • From the Manage NuGet Packages dialog:
    • Right-click the project in Solution Explorer > Manage NuGet Packages
    • Set the Package source to "nuget.org"
    • Enter "DirectScale.Disco.Extension.Abstractions" in the search box
    • Select the latest "DirectScale.Disco.Extension.Abstractions" package from the Browse tab and click Install

Add Directscale Middleware


To use the Client Library it needs to be added as middleware in the startup.cs class.

📘

Want to know more about how ASP.NET middleware works?

Read Microsoft's Article: ASP.NET Core Middleware


Configuring Directscale Middleware


Client code can be written to enhance or alter Directscale products once the Directscale Middleware is added.
Use the information below to learn how to configure the middleware to customize Directscale products.

Adding Route Registrations

The configuration action passed to the AddDirectScale method enables the ability to add endpoint registrations.
See the documentation for the methods listed in the code snipping below by reading about the methods on the SetupOptions Class.

services.AddDirectScale(options =>
{
	options.AddHook(...);
	options.AddEventHandler(...);
	options.AddMerchant(...);
	options.AddCustomPage(...);
});

Examples

Reference the code recipes below for examples of using the AddHook(), AddEventHandler(), AddMerchant(), and AddCustomPage() methods