/// <inheritdoc /> public CommenceCursor CommitGetCursor(CmcOptionFlags flags = CmcOptionFlags.Default) { CommenceCursor cc = null; FormOA.ICommenceCursor newcur = null; try { newcur = _ers.CommitGetCursor((int)flags); if (newcur != null) { cc = new CommenceCursor(newcur, _rcwReleasePublisher); } } catch (COMException) { } return(cc); }
/// <summary> /// Get a CommenceCursor object that wraps the native FormOA.ICommenceCursor interface. /// </summary> /// <exception cref="CommenceCOMException">Unable to create a cursor.</exception> /// <param name="categoryName">Commence category name.</param> /// <returns>CommenceCursor wrapping Commence ICommenceCursor with default settings</returns> public Database.ICommenceCursor GetCursor(string categoryName) { CommenceCursor _cur; // our own cursor object /* * Contrary to what Commence documentation says, * GetCursor() does not return null on error, * but instead a COM error is raised */ try { _cur = new CommenceCursor(_db, categoryName, _rcwReleasePublisher); // should not need dependency injection, or should it? return(_cur); } catch (COMException e) { throw new CommenceCOMException($"GetCursor failed to create a cursor on category or view '{categoryName}'.", e); } }
/// <inheritdoc /> public CommenceCursor CommitGetCursor(CmcOptionFlags flags = CmcOptionFlags.Default) { CommenceCursor cc = null; FormOA.ICommenceCursor newcur = null; try { newcur = _ars.CommitGetCursor((int)flags); if (newcur != null) { cc = new CommenceCursor(newcur, _rcwReleasePublisher); } } catch (COMException) { } // we should Dispose ourselves now, the AddRowset is no longer valid. // ...but I don't know how. return(cc); }
/// <summary> /// Get a CommenceCursor object that wraps the native FormOA.ICommenceCursor interface. /// </summary> /// <param name="pName">Commence category name.</param> /// <param name="pCursorType">Type of Commence data to access with this cursor.</param> /// <param name="pCursorFlags">Logical OR of Option flags.</param> /// <returns>CommenceCursor wrapping ICommenceCursor according to flags passed.</returns> /// <exception cref="ArgumentException">Viewtype cannot be used in a CommenceCursor.</exception> /// <exception cref="CommenceCOMException">Commence could not create a cursor.</exception> public Database.ICommenceCursor GetCursor(string pName, CmcCursorType pCursorType, CmcOptionFlags pCursorFlags) { CommenceCursor cur; // our own cursor object /* * Contrary to what Commence documentation says, * GetCursor() does not return null on error, * but instead a COM error is raised. */ IViewDef vd; if (pCursorType == CmcCursorType.View) { vd = GetViewDefinition(pName); if (!((ViewDef)vd).ViewType .GetAttributePropertyValue <bool, CursorCreatableAttribute>(nameof(CursorCreatableAttribute.CursorCreatable))) { throw new ArgumentException($"Commence does not support cursors on views of type {vd.Type}."); } try { cur = new CommenceCursor(_db, pCursorType, pName, _rcwReleasePublisher, pCursorFlags, vd.Type); } catch (COMException e) { throw new CommenceCOMException($"GetCursor failed to create a cursor on category or view '{pName}'.", e); } } else { try { cur = new CommenceCursor(_db, pCursorType, pName, _rcwReleasePublisher, pCursorFlags); } catch (COMException e) { throw new CommenceCOMException($"GetCursor failed to create a cursor on category or view '{pName}'.", e); } } return(cur); }
private CommenceCursor _cur = null; // note that we do not use the interface, but the direct type. #region Constructors internal CursorColumns(CommenceCursor cur) { _cur = cur; _columns = new List <string>(); _relatedcolumns = new List <IRelatedColumn>(); }