/// <summary> /// Get Id for data /// </summary> /// <param name="connectionGroup">Connection group</param> /// <param name="templateNode">Template node</param> /// <returns></returns> public Int64? GetId(ConnectionGroupInfo connectionGroup, TemplateNodeInfo templateNode) { Debug.Assert(!templateNode.IsInstance); Int64? parentId = null; if (templateNode.Parent != null) { parentId = this.GetId(connectionGroup, templateNode.Parent); } long? templateId = Storage.TemplateDirectory.GetId(connectionGroup); TemplateNodeQueryInfo pq = templateNode.GetParentQuery(); object parentQueryId = pq != null ? (object) Storage.TemplateNodeQueryGroupDirectory.GetId(connectionGroup, pq) : null; return this.GetRecordIdByFields( this.CreateField(TemplateIdFn, templateId), this.CreateField(ParentIdFn, parentId), this.CreateField(UserIdFieldName, templateNode.Id), this.CreateField(NameFn, templateNode.Name), this.CreateField(IconFieldName, templateNode.IconImageReferenceName), this.CreateField(ShowIfEmptyFieldName, !templateNode.HideEmptyResultDatabases), this.CreateField(ShowNumberOfRecordsFieldName, templateNode.ShowNumberOfRecords), this.CreateField(ParentQueryGroupIdFn, parentQueryId) ); }