private ICommenceCursor GetCategoryCursorAllFieldsAndConnections(ICommenceDatabase db, string categoryName, CmcOptionFlags flags) { ICommenceCursor cur = db.GetCursor(categoryName, CmcCursorType.Category, flags); string[] fieldNames = db.GetFieldNames(categoryName).ToArray(); cur.Columns.AddDirectColumns(fieldNames); var cons = db.GetConnectionNames(cur.Category); foreach (var c in cons) { //string nameField = db.GetNameField(c.ToCategory); //cur.Columns.AddRelatedColumn(c.Name, c.ToCategory, nameField); // this is bad. a related column loses the THID flag cur.Columns.AddDirectColumn(c.Name + ' ' + c.ToCategory); // will respect UseThids flag } cur.Columns.Apply(); return(cur); }
private IEnumerable <CommenceCategoryMetaData> GetCategoryMetadata(IEnumerable <string> list) { foreach (string categoryName in list) { ICategoryDef d = _db.GetCategoryDefinition(categoryName); CommenceCategoryMetaData c = new CommenceCategoryMetaData(categoryName, d); var fields = _db.GetFieldNames(categoryName); c.Fields = GetFieldMetaData(categoryName, fields).ToList(); c.Connections = _db.GetConnectionNames(categoryName).Cast <CommenceConnection>().ToList(); var views = _db.GetViewNames(categoryName); c.Views = GetViewMetaData(views).ToList(); var forms = _db.GetFormNames(categoryName); c.Forms = GetFormMetaData(categoryName, forms).ToList(); c.Items = _db.GetItemCount(categoryName); yield return(c); } }