Class AgentContext
Main entry point to the Software Potential Agent's Configuration and processing capabilities.
- Configuration - Controls configuration of the Agent's Stores, Activation endpoints etc. in a manner appropriate to your application style/environment.
- Agent Context, see IAgentContext - Provides licensing and configuration information not pertaining to a specific licensed product.
- Product Context, see IProductContext - Provides information regarding a licensed product.
Namespace: Sp.Agent.Configuration
Assembly: Sp.Agent.dll
Examples
using Sp.Agent.Configuration;
using Sp.Agent;
// Skeleton Software Potential Agent Integration class - see documentation for your application environment/style to see Configuration options.
public class SpAgent
{
readonly static IAgentContext _agentContext;
readonly static IProductContext _product;
static SpAgent()
{
_agentContext = AgentContext.For( "abc12" );
// TODO see your specific Sp.Agent.*.dll Integration Layer Documentation for specifics of how to manage configuration for your application/hosting context
// _agentContext.Configure( x => x /* application/environment-specific Configuration Sequence */ .CompleteWithDefaults() );
_product = _agentContext.ProductContextFor( "My Product", "My Version" );
// _product.Configure( x => x /* product-specific Configuration Sequence */ .CompleteWithDefaults() );
}
static IProductContext Product
{
get { return _product; }
}
public void Activate( string activationKey )
{
Product.Activation.OnlineActivate( activationKey );
}
}
Methods
For(String)
Obtains the IAgentContext for the Software Potential Agent Permutation with reference id permutationId
.
Declaration
public static IAgentContext For(string permutationId)
Parameters
Type | Name | Description |
---|---|---|
System.String | permutationId |
Returns
Type | Description |
---|---|
IAgentContext | IAgentContext for the specified Software Potential Agent Permutation. |
Examples
AgentContext.For( "abc12" )
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |
For(String, Assembly)
Obtains the IAgentContext for the Software Potential Agent Permutation with reference id permutationId
.
This overload uses the location of the associatedAssembly
, if non-null, as an additional search location for permuted Agent DLLs (e.g., Sp.Agent.abc12.dll
)
Declaration
public static IAgentContext For(string permutationId, Assembly associatedAssembly)
Parameters
Type | Name | Description |
---|---|---|
System.String | permutationId | |
System.Reflection.Assembly | associatedAssembly |
Returns
Type | Description |
---|---|
IAgentContext | IAgentContext for the specified Software Potential Agent Permutation. |
Examples
AgentContext.For("abc12", typeof(SpAgent).Assembly)
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if |