public IDatasetElement this[string title] { get { SE_LAYERINFO_64 layerInfo = new SE_LAYERINFO_64(); try { SdeFeatureClass fc = null; //SdeConnection connection = _sConnection.AllocConnection(); using (ArcSdeConnection connection = new ArcSdeConnection(_connStr)) { if (connection.Open()) { if (Wrapper92_64.SE_layerinfo_create(new SE_COORDREF_64(), ref layerInfo) != 0) { return(null); } if (Wrapper92_64.SE_layer_get_info(connection.SeConnection, title, "", layerInfo) != 0) { return(null); } fc = new SdeFeatureClass(this, connection.SeConnection, layerInfo); } connection.Close(); } //_sConnection.FreeConnection(); return(new DatasetElement(fc)); } finally { if (layerInfo.handle != 0) { Wrapper92_64.SE_layerinfo_free(layerInfo); } } } }
/* * internal SdeConnection AllocConnection() * { * if (_sConnection == null) return null; * return _current = _sConnection.AllocConnection(); * } * * internal void FreeConnection() * { * if (_sConnection == null) return; * _current = null; * _sConnection.FreeConnection(); * } */ internal SE_COORDREF_64 GetSeCoordRef(ArcSdeConnection connection, string table, string spatialColumnName, ref SE_ENVELOPE envelope) { _errMsg = ""; if (connection == null || connection.SeConnection.handle == 0) { _errMsg = "GetSeCoordRef:\n No Connection allocated!"; return(new SE_COORDREF_64()); } SE_COORDREF_64 coordRef = new SE_COORDREF_64(); SE_LAYERINFO_64 layerInfo = new SE_LAYERINFO_64(); Int64 _err_no = 0; try { _err_no = Wrapper92_64.SE_coordref_create(ref coordRef); if (_err_no != 0) { return(new SE_COORDREF_64()); } _err_no = Wrapper92_64.SE_layerinfo_create(coordRef, ref layerInfo); if (_err_no != 0) { return(new SE_COORDREF_64()); } _err_no = Wrapper92_64.SE_layer_get_info(connection.SeConnection, table, spatialColumnName, layerInfo); if (_err_no != 0) { return(new SE_COORDREF_64()); } _err_no = Wrapper92_64.SE_layerinfo_get_coordref(layerInfo, coordRef); if (_err_no != 0) { return(new SE_COORDREF_64()); } _err_no = Wrapper92_64.SE_coordref_get_xy_envelope(coordRef, ref envelope); if (_err_no != 0) { return(new SE_COORDREF_64()); } return(coordRef); } catch (Exception ex) { _errMsg = "GetSeCoordRef:\n " + ex.Message + "\n" + ex.StackTrace; return(new SE_COORDREF_64()); } finally { if (layerInfo.handle != 0) { Wrapper92_64.SE_layerinfo_free(layerInfo); } if (_err_no != 0) { if (coordRef.handle != 0) { Wrapper92_64.SE_coordref_free(coordRef); } _errMsg = Wrapper92_64.GetErrorMsg(new SE_CONNECTION_64(), _err_no); } } }