I've created a code snippet that works for a file geodatabase, but not for the enterprise geodatabase with which I'm working:
IGeoDataset geodataset = datasets.Next() as IGeoDataset;
ISpatialReference spatialReference = geodataset.SpatialReference;
spatialReference.SetZDomain(-1371.0, 29035.0);
IGeoDatasetSchemaEdit geoDatasetSchemaEdit = (IGeoDatasetSchemaEdit)geodataset;
if (geoDatasetSchemaEdit.CanAlterSpatialReference)
{
geoDatasetSchemaEdit.AlterSpatialReference(spatialReference);
}
With a file geodatabase, changing the Z domain changes the Z resolution, which is the expected behaviour. However, when I try against the enterprise geodatabase, I get a COMException:
System.Runtime.InteropServices.COMException was unhandled HelpLink=esri_csGeoDatabase.hlp HResult=-2147216107 Message=Layer not found Source=esriDataSourcesGDB.SdeWorkspace.1 ErrorCode=-2147216107 StackTrace: at ESRI.ArcGIS.Geodatabase.IGeoDatasetSchemaEdit.AlterSpatialReference(ISpatialReference SpatialReference) at EngineConsoleApplication3.Program.Main(String[] args) in c:\Users\Jonathan Bailey\Documents\Visual Studio 2012\Projects\EngineConsoleApplication3\Program.cs:line 36 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: |
There aren't any connections to the enterprise geodatabase other than the one that I created in the ArcObjects code. Is there something else I need to do like compress the database? Delete all the versions(!)?
Thanks,
Jon.