Opacc.Client
0.4.0
dotnet add package Opacc.Client --version 0.4.0
NuGet\Install-Package Opacc.Client -Version 0.4.0
<PackageReference Include="Opacc.Client" Version="0.4.0" />
<PackageVersion Include="Opacc.Client" Version="0.4.0" />
<PackageReference Include="Opacc.Client" />
paket add Opacc.Client --version 0.4.0
#r "nuget: Opacc.Client, 0.4.0"
#:package Opacc.Client@0.4.0
#addin nuget:?package=Opacc.Client&version=0.4.0
#tool nuget:?package=Opacc.Client&version=0.4.0
Opacc.Client
A typed .NET client for the Opacc ERP WebService (OXAS). Provides a strongly-typed API over the generic Opacc WCF endpoint for reading, querying and writing Business Objects, with dependency-injection integration and a bundled Roslyn analyzer that validates your BO model classes at compile time.
Installation
<PackageReference Include="Opacc.Client" Version="*" />
Quick start
Configure programmatically:
services.AddOpaccClient(options =>
{
options.ServiceUrl = "YourOpaccWebserviceUrl";
options.ClientId = "1";
options.ApplicationId = "MyApp";
options.DefaultUserId = "100";
options.DefaultPassword = "...";
});
…or bind from configuration (appsettings.json, User Secrets, environment variables):
// appsettings.json → "Opacc": { "ServiceUrl": "...", "ClientId": "1", ... }
// Keep DefaultPassword out of source control — use User Secrets or an env var.
services.AddOpaccClient(builder.Configuration.GetSection("Opacc"));
The Opacc config section uses the same keys as OpaccClientOptions, so the same
file also feeds the opacc scaffolding CLI.
Inject IOpaccClient (or the lower-level IOpaccTransport) wherever you need it.
Builders vs. awaitables
The operation entry points return builders, not tasks. Only the closing call actually
sends the request, and only it is awaitable — which is why only it carries an Async suffix:
var addr = await client.GetBo<Addr>().Start(1001).FirstAsync();
// ^ builder, not awaitable ^ sends the request
| Entry point | Closing call |
|---|---|
GetBo<T>() / Query<T>() |
FirstAsync(), ToListAsync(), ToPageAsync() |
SaveBo<T>() / DeleteBo<T>() / Raw(...) |
ExecuteAsync() |
Deprecated: these entry points used to be called
GetBoAsync<T>(),QueryAsync<T>(),SaveBoAsync<T>()andDeleteBoAsync<T>(). The suffix was misleading — they never returned an awaitable. The old names still work but emit a compiler warning and are removed in v1.0; drop theAsyncto migrate.
Service calls
Besides the BO operations (GetBo, Query, SaveBo, DeleteBo)
you can call any Opacc service on any port:
// named parameters → ["ArtNo=10100", "CustNo=1001"]
var r = await client.SendRawAsync(OpaccService.ArtSal_GetPrice, new { ArtNo = "10100", CustNo = 1001 });
var price = r.Scalar;
// positional parameters, taken from a scaffolded (or hand-written) request class
var r2 = await client.SendAsync(new ArtSal_GetPriceRequest { ArtNo = "10100", CustNo = 1001 });
Which convention applies is dictated by the operation, not by preference. For services
without a scaffolded constant, construct the id directly:
new OpaccServiceId("MyPort", "MyOperation").
Raw(...) is the fluent form for everything the two shorthands cannot express —
above all a different user (see below) and a verbatim parameter array:
var r = await client.Raw(new OpaccServiceId("MyPort", "MyOperation"))
.Parameters(["10100", "", "1001"])
.ExecuteAsync();
Running a request as a different user
Every operation runs under DefaultUserId unless told otherwise. WithCredentials
switches a single request to a user-specific session:
await client.GetBo<Addr>().Start(1001).WithCredentials(4711, "secret").FirstAsync();
await client.Raw(OpaccService.ArtSal_GetPrice).Parameters(new { ArtNo = "10100" })
.WithCredentials(4711, "secret").ExecuteAsync();
Sessions are pooled per user and reused until they expire (SessionTimeout) or go idle
(UserSessionIdleTimeout); at most MaxUserSessions user sessions exist at a time.
Related packages
- Opacc.Client.Sentry — Sentry performance tracing for every Opacc operation.
- Opacc.Client.CLI (
opacc) — a dotnet tool that scaffolds C# model classes from a live Opacc instance.
Analyzer
This package ships a Roslyn analyzer (analyzers/dotnet/cs) that runs automatically
once installed — no extra reference required. It validates [Bo] / [BoProperty]
model definitions and reports common mapping mistakes as build diagnostics.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.3)
- System.ServiceModel.Duplex (>= 6.0.0)
- System.ServiceModel.Federation (>= 6.0.0)
- System.ServiceModel.Http (>= 6.0.0)
- System.ServiceModel.NetTcp (>= 6.0.0)
- System.ServiceModel.Security (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|