This document is archived and information here might be outdated.  Recommended version.


NASOEHelper Class (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > NetworkAnalyst > ESRI.ArcGIS.NetworkAnalyst > Classes > N > NASOEHelper Class
ArcGIS Developer Help

NASOEHelperClass Class

Helper object to assist server object extension developers.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Interfaces

Interfaces Description
INASOEHelper Provides access to methods that assist server object extension developers.

Remarks

The NASOEHelper object can be used by server object extension developers to create a new NALayer based on a network analysis layer that was published in your map document.  
[C#]

private IServerObjectHelper serverObjectHelper;
private INALayer2 naLayer;

public void Init(IServerObjectHelper pSOH)
{
  serverObjectHelper = pSOH; 
}

public void Construct(IPropertySet props)
{
  // In Construct of the SOE, get a reference to the NALayer in the Map named "MyRouteLayer"
  IMapServer ms = (IMapServer)this.serverObjectHelper.ServerObject;
  INASOEHelper naSOEHelper = new NASOEHelperClass();
  naLayer = (INALayer2)naSOEHelper.CreateNALayer(this.ms, ms.DefaultMapName, "MyRouteLayer");
}

private byte[] MySOEOperationHandler(
    NameValueCollection boundVariables,
    JsonObject operationInput,
    string outputFormat,
    string requestProperties,
    out string responseProperties)
{
  // In the operation, make use of the NALayer to either just get the NAContext
  // or create a new NAContext that you can populate, solve, and then throw away
  // to keep the state of the original NAContext pristine.

  // Do this to use the existing NAContext (Make sure to reset it's state after use)
  INAContext naContext = naLayer.Context;

  // Do this to create a new NAContext so the state of the original NAContext doesn't get modified
  INAContext naContext = naLayer.CopyContext();

  PopulateStuffOnTheNAContext(naContext);

  return SolveAndReturnResults(naContext);
}
[Visual Basic .NET]