.NET SDK — activate a license
Activation exchanges a license key (and the device’s fingerprint) for a session — a claimed seat plus a signed, cached license the SDK can validate locally. Your application holds that session while it runs and releases it on shutdown.
Access the license
Section titled “Access the license”ILicenseSession is the single entry point. Resolve it from the request/lifetime scope
and call AccessLicenseAsync. The first call activates; subsequent calls return the
cached, still-valid license without a round trip.
public class LicenseGate(ILicenseSession session){ public async Task<bool> IsLicensedAsync() { var license = await session.AccessLicenseAsync(); return license is { LicenseValidation.IsOperational: true }; }}AccessLicenseAsync returns null when no valid license can be obtained (for example,
the key is unknown or activation was refused). It never throws for the ordinary
“not licensed” case — check for null and for IsOperational.
What “operational” means
Section titled “What “operational” means”license.LicenseValidation describes the license without you having to interpret raw
dates:
| Property | Tells you |
|---|---|
IsOperational | The license currently permits protected use (active, in trial, or within grace). Gate on this. |
LicenseStatus | Active, GracePeriod, Expired, or Invalid. |
LicenseModel | Trial, Perpetual, or Subscription. |
TrialStatus | InTrial, TrialExpired, or NotInTrial. |
CurrentSession | The session id — pass it when metering consumption. |
Gate features on IsOperational rather than on LicenseStatus == Active: it already
accounts for trials and the grace window, so a brief
backend outage or a legitimate trial doesn’t lock out a paying customer.
Refresh and release
Section titled “Refresh and release”The SDK refreshes the license in the background on the interval you configure
(LicenseRefreshIntervalSeconds). To force a refresh — for instance right after a plan
change — call RefreshLicenseAsync:
await session.RefreshLicenseAsync();When the application shuts down, or a user signs out, release the session so the seat is freed and the final usage is flushed:
await session.ReleaseSessionAsync();In a host-based app the SDK flushes pending usage on shutdown for you; call
ReleaseSessionAsync explicitly when you end a session earlier than process exit.
Interactive-user activation
Section titled “Interactive-user activation”When your application has a signed-in user, you can activate against the
entitlements assigned to that user instead of distributing a license key. On the
fluent builder, call
UseInteractiveUserActivation(); the request then carries the user’s token, and
the activation code becomes optional when the user has exactly one assigned
entitlement. See authentication
for the wire contract and the
end-user portal for how users see what’s
assigned to them.
Seats and fingerprints
Section titled “Seats and fingerprints”Each activation claims one seat against the entitlement. The SDK identifies the device
with a fingerprint; a stable fingerprint means the
same install reuses its seat across restarts instead of consuming a new one. If the
entitlement is out of seats, activation is refused and AccessLicenseAsync returns
null — surface that to the user as “no seats available” rather than a generic error.