In this topic
Initializing a geocode resource programmatically
A geocode resource will be initialized if you are working with a FindAddressTask control. However, if you are working with a geocode resource outside the FindAddressTask control, if applicable, initialize the geocode resource before using it. The same situation applies when creating a GeocodeResourceManager and adding geocode resources dynamically at runtime. Specifically, the GeocodeResource needs to be initialized. The resource manager handles the data source connection; therefore, server context creation and disposal are managed for you.
The following code example shows how to retrieve a geocode resource item from a GeocodeResourceManager, initialize the resource, and create geocode functionality to use for address matching operations.
[C#]
GeocodeResourceItem geocodeResourceItem = GeocodeResourceManager1.ResourceItems.Find
("Geocode Resource");
if (!geocodeResourceItem.Resource.Initialized)
geocodeResourceItem.InitializeResource();
// Create a Web ADF common API geocode functionality.
IGeocodeFunctionality commonGeocodeFunctionality = (IGeocodeFunctionality)
(geocodeResourceItem.Resource.CreateFunctionality(typeof(IGeocodeFunctionality),
null));