/// <summary> /// Handle any of the static commands /// </summary> /// <param name="commandId"></param> /// <returns></returns> private bool HandleStaticCommand(int commandId) { switch ((uint)commandId) { case PkgCmdIDList.cmdCreateTable: case PkgCmdIDList.cmdidGlobalCreateTable: TableNode.CreateNew(DataViewHierarchyAccessor); return(true); case PkgCmdIDList.cmdCreateProcedure: case PkgCmdIDList.cmdidGlobalCreateProcedure: StoredProcedureNode.CreateNew(DataViewHierarchyAccessor, false); return(true); case PkgCmdIDList.cmdCreateFunction: case PkgCmdIDList.cmdidGlobalCreateFunction: StoredProcedureNode.CreateNew(DataViewHierarchyAccessor, true); return(true); case PkgCmdIDList.cmdCreateView: case PkgCmdIDList.cmdidGlobalCreateView: ViewNode.CreateNew(DataViewHierarchyAccessor); return(true); case PkgCmdIDList.cmdCreateUDF: case PkgCmdIDList.cmdidGlobalCreateUDF: UdfNode.CreateNew(DataViewHierarchyAccessor); return(true); } return(false); }
private BaseNode MakeNewNode(int id) { string nodeId = DataViewHierarchyAccessor.GetNodeId(id); nodeId = nodeId.ToLowerInvariant(); BaseNode newNode; switch (nodeId) { case "table": newNode = new TableNode(DataViewHierarchyAccessor, id); break; case "storedprocedure": newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, false); break; case "storedfunction": newNode = new StoredProcedureNode(DataViewHierarchyAccessor, id, true); break; case "view": newNode = new ViewNode(DataViewHierarchyAccessor, id); break; case "udf": newNode = new UdfNode(DataViewHierarchyAccessor, id); break; case "trigger": newNode = new TriggerNode(DataViewHierarchyAccessor, id); break; default: throw new NotSupportedException("Node type not supported"); } Debug.Assert(newNode != null); return(newNode); }