IntelligentPlant.IndustrialAppStore.DependencyInjection 3.0.0-pre.361

This is a prerelease version of IntelligentPlant.IndustrialAppStore.DependencyInjection.
dotnet add package IntelligentPlant.IndustrialAppStore.DependencyInjection --version 3.0.0-pre.361                
NuGet\Install-Package IntelligentPlant.IndustrialAppStore.DependencyInjection -Version 3.0.0-pre.361                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IntelligentPlant.IndustrialAppStore.DependencyInjection" Version="3.0.0-pre.361" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IntelligentPlant.IndustrialAppStore.DependencyInjection --version 3.0.0-pre.361                
#r "nuget: IntelligentPlant.IndustrialAppStore.DependencyInjection, 3.0.0-pre.361"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IntelligentPlant.IndustrialAppStore.DependencyInjection as a Cake Addin
#addin nuget:?package=IntelligentPlant.IndustrialAppStore.DependencyInjection&version=3.0.0-pre.361&prerelease

// Install IntelligentPlant.IndustrialAppStore.DependencyInjection as a Cake Tool
#tool nuget:?package=IntelligentPlant.IndustrialAppStore.DependencyInjection&version=3.0.0-pre.361&prerelease                

IntelligentPlant.IndustrialAppStore.DependencyInjection

This package defines types and extension methods to assist with registering Industrial App Store services with Microsoft.Extensions.DependencyInjection.

Please consider using one of the following packages instead of using this package directly:

Package App Type Description
IntelligentPlant.IndustrialAppStore.AspNetCore ASP.NET Core Provides a strongly-typed client for querying the Industrial App Store Data API, an authentication handler that is pre-configured to use the Industrial App Store for authentication, and additional services and middlewares for implementing features such as Content Security Policies.
IntelligentPlant.IndustrialAppStore.CommandLine CLI Provides a strongly-typed client for querying the Industrial App Store Data API, and services for authenticating with the Industrial App Store using the OAuth 2.0 device code authorization flow.
IntelligentPlant.IndustrialAppStore.Templates Provides project templates for dotnet new and Visual Studio for creating apps that are pre-configured to use one of the two above packages.

The packages can also be used to write on-premises apps that interface with a local Data Core API instance.

Getting Started

To register a scoped IndustrialAppStoreHttpClient service with an IServiceCollection, call the AddIndustrialAppStoreApiServices extension method:

var builder = services.AddIndustrialAppStoreApiServices();

This returns an IIndustrialAppStoreBuilder object that can be used to customise the registered services via additional extension method calls. For example, to customise the HttpClient used by the IndustrialAppStoreHttpClient service:

var builder = services.AddIndustrialAppStoreApiServices(configureHttpBuilder: http => http.ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler() {
    EnableMultipleHttp2Connections = true
}));

Once you have built your container, you can inject the IndustrialAppStoreHttpClient service into your application components as required.

Remember that IndustrialAppStoreHttpClient is registered as a scoped service.

Authentication

By default, the scoped AccessTokenProvider service is used to provide the Industrial App Store access token for the IndustrialAppStoreHttpClient service.

The default AccessTokenProvider service registration does not return an access token, meaning that calls to Industrial App Store APIs will fail. To configure an AccessTokenProvider service that returns an access token, you can do one of the following:

Replacing the default AccessTokenProvider registration

You can replace the default AccessTokenProvider registration with a custom implementation that returns an access token. For example:

var builder = services
    .AddIndustrialAppStoreApiServices()
    .AddAccessTokenProvider((IServiceProvider provider) => {
        var accessTokenService = provider.GetRequiredService<MyTokenService>();
        return (CancellationToken ct) => accessTokenService.GetAccessTokenAsync(ct);
    });

Manually setting the access token factory

After creating a new IServiceScope, you can retrieve the AccessTokenProvider service from the service provider and set the AccessTokenProvider.Factory property to a factory method that returns an access token. For example:

using var scope = serviceProvider.CreateScope();

var accessTokenProvider = scope.ServiceProvider.GetRequiredService<AccessTokenProvider>();
accessTokenProvider.Factory = (CancellationToken ct) => new ValueTask<string?>("my-access-token");

var client = scope.ServiceProvider.GetRequiredService<IndustrialAppStoreHttpClient>();
var dataSources = await client.DataSources.GetDataSourcesAsync();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on IntelligentPlant.IndustrialAppStore.DependencyInjection:

Package Downloads
IntelligentPlant.IndustrialAppStore.Authentication

ASP.NET Core authentication handler for Intelligent Plant's Industrial App Store.

IntelligentPlant.IndustrialAppStore.CommandLine

Types and extensions for building Intelligent Plant Industrial App Store command-line applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0-pre.361 33 11/20/2024
3.0.0-pre.358 34 11/20/2024
3.0.0-pre.351 36 11/15/2024
3.0.0-pre.348 48 11/11/2024
3.0.0-pre.339 39 11/7/2024
3.0.0-pre.328 59 10/31/2024
3.0.0-pre.320 38 10/31/2024