If you have a valid locator instance you should iterate through the reference tables. Each reference table has a name property. This name instance should implement IDatasetName. Using IDatasetName you have the information of the dataset and its workspace and you can open the dataset if necessary. Keep in mind, this will throw an exception if the dataset is not accessible.
internal static void WriteReferenceTableNamesToConsole(ILocator locator)
{
var addressLocator = locator as IReferenceDataTables;
if (null == addressLocator)
return;
var referenceDataTables = addressLocator.Tables;
IReferenceDataTable referenceDataTable;
while (null != (referenceDataTable = referenceDataTables.Next()))
{
var tableName = (IDatasetName) referenceDataTable.Name;
Console.WriteLine(tableName.WorkspaceName.PathName + Environment.NewLine + tableName.Name);
try
{
var referenceTable = (IFeatureClass) ((IName) tableName).Open();
// ...
}
catch (COMException)
{
Console.Error.WriteLine(string.Format("Reference data '{0}' for locator '{1}' not accessible!", tableName, locator.Name));
}
}
}
Regards from Germany
Product Manager
Developers and Location Services
Germany and Switzerland