I have written a tool that accesses the IRouteLocator to get the unit of measure. In order to test the tool, I need to attach an route locator to my M-Value linear feature class. I have tried creating an event layer, and using the Make Route Event Layer geoprocessing tool, and still when I query the workspace for locators, the collection does not have any valid locators in it. I have attached the source code that queries for the locator for reference. It's C++. Any help would be greatly appreciated.
An update to my original post. This morning I added an Address Locator to the geodatabase and was able to verify that the code up to the point where it queries the IEnumLocator for the next Locator is working and does correctly return the Address Locator. I also tried creating an IRouteLocator on the fly using sample code, but the locator is not stored in the geodatabase, even though I made sure that the locator was still in scope when I ran my code. Is there any way to store an IRouteLocator created on the fly in the geodatabase so that it can be retrieved later for reuse?
Second update. I tried to add the locator created in code to the locator workspace using the ILocatorWorkspace AddLocator function, but it failed with an InvalidCastException. I tried it with both the IRouteLocator2 interface and an ILocator interface.