Example #1
0
        public void TakeHint(
            [Values(TakeHints.Percent, TakeHints.WithTies, TakeHints.Percent | TakeHints.WithTies)] TakeHints takeHint
            )
        {
            if (!UserProviders.Contains(ProviderName.SqlServer))
            {
                return;
            }

            using (var db = GetDataContext(ProviderName.SqlServer))
            {
                var query =
                    from c1 in db.Child
                    from c2 in db.Child.Take(10, takeHint)
                    select new { c1, c2 };

                var sql = query.ToString();
                Console.WriteLine(sql);

                if (takeHint.HasFlag(TakeHints.Percent))
                {
                    Assert.That(sql, Contains.Substring("PERCENT"));
                }

                if (takeHint.HasFlag(TakeHints.WithTies))
                {
                    Assert.That(sql, Contains.Substring("WITH TIES"));
                }
            }
        }
Example #2
0
        public void TakeHint(
            [IncludeDataSources(TestProvName.AllSqlServer2005Plus)] string context,
            [Values(TakeHints.Percent, TakeHints.WithTies, TakeHints.Percent | TakeHints.WithTies)] TakeHints takeHint)
        {
            using (var db = GetDataContext(context))
            {
                var query =
                    from c1 in db.Child
                    from c2 in db.Child.Take(10, takeHint)
                    select new { c1, c2 };

                var sql = query.ToString();
                TestContext.WriteLine(sql);

                if (takeHint.HasFlag(TakeHints.Percent))
                {
                    Assert.That(sql, Contains.Substring("PERCENT"));
                }

                if (takeHint.HasFlag(TakeHints.WithTies))
                {
                    Assert.That(sql, Contains.Substring("WITH TIES"));
                }
            }
        }
Example #3
0
        public bool GetIsTakeHintsSupported(TakeHints hints)
        {
            if (TakeHintsSupported == null)
            {
                return(false);
            }

            return((TakeHintsSupported.Value & hints) == hints);
        }