예제 #1
0
        protected virtual void SetCommand(bool clearQueryHints)
        {
            if (QueryNumber == 0 && (DataContext.QueryHints.Count > 0 || DataContext.NextQueryHints.Count > 0))
            {
                var queryContext = Query.Queries[QueryNumber];

                queryContext.QueryHints = new List <string>(DataContext.QueryHints);
                queryContext.QueryHints.AddRange(DataContext.NextQueryHints);

                if (QueryHints == null)
                {
                    QueryHints = new List <string>(DataContext.QueryHints.Count + DataContext.NextQueryHints.Count);
                }

                QueryHints.AddRange(DataContext.QueryHints);
                QueryHints.AddRange(DataContext.NextQueryHints);

                if (clearQueryHints)
                {
                    DataContext.NextQueryHints.Clear();
                }
            }

            var parameterValues = new SqlParameterValues();

            QueryRunner.SetParameters(Query, Expression, DataContext, Parameters, QueryNumber, parameterValues);

            SetQuery(parameterValues);
        }
예제 #2
0
        protected virtual void SetCommand(bool clearQueryHints)
        {
            // TODO: can we refactor query to be thread-safe to remove this lock?
            lock (Query)
            {
                if (QueryNumber == 0 && (DataContext.QueryHints.Count > 0 || DataContext.NextQueryHints.Count > 0))
                {
                    var queryContext = Query.Queries[QueryNumber];

                    queryContext.QueryHints = new List <string>(DataContext.QueryHints);
                    queryContext.QueryHints.AddRange(DataContext.NextQueryHints);

                    if (QueryHints == null)
                    {
                        QueryHints = new List <string>(DataContext.QueryHints.Count + DataContext.NextQueryHints.Count);
                    }

                    QueryHints.AddRange(DataContext.QueryHints);
                    QueryHints.AddRange(DataContext.NextQueryHints);

                    if (clearQueryHints)
                    {
                        DataContext.NextQueryHints.Clear();
                    }
                }

                QueryRunner.SetParameters(Query, Expression, DataContext, Parameters, QueryNumber);
                SetQuery();
            }
        }
예제 #3
0
        protected virtual void SetCommand(bool clearQueryHints)
        {
            lock (Query)
            {
                if (QueryNumber == 0 && (DataContext.QueryHints.Count > 0 || DataContext.NextQueryHints.Count > 0))
                {
                    var queryContext = Query.Queries[QueryNumber];

                    queryContext.QueryHints = new List <string>(DataContext.QueryHints);
                    queryContext.QueryHints.AddRange(DataContext.NextQueryHints);

                    QueryHints.AddRange(DataContext.QueryHints);
                    QueryHints.AddRange(DataContext.NextQueryHints);

                    if (clearQueryHints)
                    {
                        DataContext.NextQueryHints.Clear();
                    }
                }

                QueryRunner.SetParameters(Query, DataContext, Expression, Parameters, QueryNumber);
                SetQuery();
            }
        }