private void ParseQueryItemsToGenerics(QueryProtocol[] queryItems, QueryProtocol parentQueryItem)
        {
            bool isRootGeneric = parentQueryItem == null;

            foreach (QueryProtocol queryItem in queryItems)
            {
                if (isRootGeneric)
                {
                    if (!ClarifyApplication.Instance.SchemaCache.IsValidTableOrView(queryItem.ObjectName))
                    {
                        throw new ApplicationException(
                                  string.Format("'{0}' is not a table or view.", queryItem.ObjectName));
                    }

                    queryItem.ClarifyGeneric = this.dataSet.CreateGeneric(queryItem.ObjectName);
                }
                else
                {
                    // Link up child / parents
                    queryItem.Parent = parentQueryItem;

                    if (!ClarifyApplication.Instance.SchemaCache.IsValidRelation(parentQueryItem.ObjectName, queryItem.TraverseRelation))
                    {
                        throw new ApplicationException(
                                  string.Format("'{0}' is not a valid relation for object '{1}'.", queryItem.TraverseRelation, parentQueryItem.ObjectName));
                    }

                    SchemaRelation rel = ClarifyApplication.Instance.SchemaCache.GetRelation(
                        parentQueryItem.ObjectName, queryItem.TraverseRelation);

                    if (parentQueryItem.ObjectName.ToLower() == rel.ChildTable.Name.ToLower())
                    {
                        queryItem.ObjectName = rel.ParentTable.Name;
                    }
                    else
                    {
                        queryItem.ObjectName = rel.ChildTable.Name;
                    }

                    queryItem.ClarifyGeneric = parentQueryItem.ClarifyGeneric.Traverse(
                        queryItem.TraverseRelation);
                }

                ParseQueryItem(queryItem);
            }
        }
コード例 #2
0
 public string GetMtmTableName(SchemaRelation relation)
 {
     throw new NotImplementedException();
 }