static void Resolve(SchemaInfo schema, HashSet <ClassInfo> affectedClasses)
        {
            // add subclasses
            foreach (ClassInfo ci in affectedClasses.ToArray())
            {
                foreach (ClassInfo sci in schema.GetSubclasses(ci))
                {
                    affectedClasses.Add(sci);
                }
            }

            schema.Resolve(affectedClasses);
        }
Exemple #2
0
 public List <ClassInfo> GetSubclassesForSchema(SchemaInfo schema)
 {
     return(schema.GetSubclasses(this));
 }
Exemple #3
0
 public List<ClassInfo> GetSubclassesForSchema(SchemaInfo schema)
 {
     return schema.GetSubclasses(this);
 }
        public override IDataReader LoadMatchingPrimaryKeys(SchemaInfo schemaInfo, ClassInfo classInfo, SoodaWhereClause whereClause, SoodaOrderBy orderBy, int startIdx, int pageCount)
        {
            try
            {
                SoqlQueryExpression queryExpression = new SoqlQueryExpression();
                foreach (FieldInfo fi in classInfo.GetPrimaryKeyFields())
                {
                    queryExpression.SelectExpressions.Add(new SoqlPathExpression(fi.Name));
                    queryExpression.SelectAliases.Add("");

                }
                if (schemaInfo.GetSubclasses(classInfo).Count > 0)
                {
                    queryExpression.SelectExpressions.Add(new SoqlPathExpression(classInfo.SubclassSelectorField.Name));
                    queryExpression.SelectAliases.Add("");
                }
                queryExpression.StartIdx = startIdx;
                queryExpression.PageCount = pageCount;
                queryExpression.From.Add(classInfo.Name);
                queryExpression.FromAliases.Add("");
                if (whereClause != null && whereClause.WhereExpression != null)
                {
                    queryExpression.WhereClause = whereClause.WhereExpression;
                }

                if (orderBy != null)
                {
                    queryExpression.SetOrderBy(orderBy);
                }

                string query = SoqlToSql(queryExpression, schemaInfo, false);

                IDbCommand cmd = Connection.CreateCommand();
                try
                {
                    cmd.CommandTimeout = CommandTimeout;
                }
                catch (NotSupportedException e)
                {
                    logger.Debug("CommandTimeout not supported. {0}", e.Message);
                }

                if (Transaction != null)
                    cmd.Transaction = this.Transaction;

                SqlBuilder.BuildCommandWithParameters(cmd, false, query, whereClause.Parameters, false);

                return TimedExecuteReader(cmd);
            }
            catch (Exception ex)
            {
                logger.Error("Exception in LoadMatchingPrimaryKeys: {0}", ex);
                throw;
            }
        }
        static void Resolve(SchemaInfo schema, HashSet<ClassInfo> affectedClasses)
        {
            // add subclasses
            foreach (ClassInfo ci in affectedClasses.ToArray())
            {
                foreach (ClassInfo sci in schema.GetSubclasses(ci))
                    affectedClasses.Add(sci);
            }

            schema.Resolve(affectedClasses);
        }