OData.Client.Manager
2.3.0
dotnet add package OData.Client.Manager --version 2.3.0
NuGet\Install-Package OData.Client.Manager -Version 2.3.0
<PackageReference Include="OData.Client.Manager" Version="2.3.0" />
paket add OData.Client.Manager --version 2.3.0
#r "nuget: OData.Client.Manager, 2.3.0"
// Install OData.Client.Manager as a Cake Addin #addin nuget:?package=OData.Client.Manager&version=2.3.0 // Install OData.Client.Manager as a Cake Tool #tool nuget:?package=OData.Client.Manager&version=2.3.0
ODataClientManager
Purpose
This repository provides a C# based OData client manager library.
The Manager uses the IODataClient
implementation of Simple.OData.Client
to communicate with OData APIs and is able to handle authorization and versioning requirements.
Getting started
The easiest way to start using the ODataManager
is to install the Nuget package:
Install-Package OData.Client.Manager
In the source file where you will be using ODataManager
import the namespace:
using OData.Client.Manager;
Quickstart
The following code snipped shows an example of how to use the IODataManger
implementation.
// Create the manager
var odataEndpoint = new Uri("http://localhost:12345/api");
var manager = new ODataManager(odataEndpoint);
// Use the client of the manager (example of the typed fluent API syntax)
IEnumerable<Product> entities = await manager.Client
.For<Product>()
.FindEntriesAsync();
// Use the client of the manager (example of the dynamic fluent API syntax)
var dx = ODataDynamic.Expression;
IEnumerable<dynamic> entities = await manager.Client
.For(dx.Products)
.FindEntriesAsync();
For more information about how to use the Odata client, please read the Simple.OData.Client documentation.
Make use of autenticated and versioned requests
- To make use of authentication use one of the existing authenticators in the
OData.Client.Manager.Authenticators
namespace, or create your own by implementing theIAuthenticator
interface. - To make use of authentication, just use one of the existing managers in the
OData.Client.Manager.Versioning
namespace or create your own by implementing theIVersioningManager
interface.
// Setup the configuration
var config = new ODataManagerConfiguration(new Uri("http://localhost:12345/api"))
{
// Authenticated requests
Authenticator = new OidcAuthenticator(new OidcSettings
{
AuthUri = new Uri("http://localhost:5000"),
ClientId = "ClientAppX",
ClientSecret = "Secret",
Username = "User",
Password = "Password",
Scope = "api1",
GrantType = "Password", // Default
DiscoveryPolicy = new DiscoveryPolicy { RequireHttps = false },
}),
// Versioned requests
VersioningManager = new QueryParamVersioningManager("1.2", "api-version")
};
// Use the configuration in the ctor of the manager
var manager = new ODataManager(config);
FAQ
- Why do I get the error
Https required
?- OIDC endpoints must provide an encrypted connection (https) by default (except URIs of localhost). To disable this requirement, make use of the
OidcSettings
and setRequireHttps
of theDiscoveryPolicy
property tofalse
:settings.DiscoveryPolicy = new DiscoveryPolicy { RequireHttps = requireHttps };
.
- OIDC endpoints must provide an encrypted connection (https) by default (except URIs of localhost). To disable this requirement, make use of the
Links
- OData: http://www.odata.org/getting-started or https://docs.microsoft.com/odata
- Simple.OData.Client: https://github.com/simple-odata-client/Simple.OData.Client/wiki
- IdentityModel: https://identitymodel.readthedocs.io
- OIDC: https://openid.net/connect
Open Source License Acknowledgements and Third-Party Copyrights
- Icon made by Freepik
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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 is compatible. |
.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. |
-
.NETStandard 2.0
- IdentityModel (>= 6.0.0)
- Simple.OData.Client (>= 6.0.1)
-
.NETStandard 2.1
- IdentityModel (>= 6.0.0)
- Simple.OData.Client (>= 6.0.1)
-
net6.0
- IdentityModel (>= 6.0.0)
- Simple.OData.Client (>= 6.0.1)
-
net7.0
- IdentityModel (>= 6.0.0)
- Simple.OData.Client (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.