public static long Count(WhereDelegate <TestSuiteExecutionSummaryColumns> where, Database database = null)
        {
            TestSuiteExecutionSummaryColumns c = new TestSuiteExecutionSummaryColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <TestSuiteExecutionSummary>();
            QuerySet query = GetQuerySet(db);

            query.Count <TestSuiteExecutionSummary>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
        public static long Count(WhereDelegate <WebHookDescriptorWebHookSubscriberColumns> where, Database database = null)
        {
            WebHookDescriptorWebHookSubscriberColumns c = new WebHookDescriptorWebHookSubscriberColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <WebHookDescriptorWebHookSubscriber>();
            QuerySet query = GetQuerySet(db);

            query.Count <WebHookDescriptorWebHookSubscriber>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 3
0
        public static long Count(WhereDelegate <SecondaryObjectColumns> where, Database database = null)
        {
            SecondaryObjectColumns c      = new SecondaryObjectColumns();
            IQueryFilter           filter = where (c);

            Database db    = database ?? Db.For <SecondaryObject>();
            QuerySet query = GetQuerySet(db);

            query.Count <SecondaryObject>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 4
0
        public static long Count(WhereDelegate <PasswordFailureColumns> where, Database database = null)
        {
            PasswordFailureColumns c      = new PasswordFailureColumns();
            IQueryFilter           filter = where (c);

            Database db    = database ?? Db.For <PasswordFailure>();
            QuerySet query = GetQuerySet(db);

            query.Count <PasswordFailure>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
        public static long Count(WhereDelegate <DataInstancePropertyValueColumns> where, Database database = null)
        {
            DataInstancePropertyValueColumns c = new DataInstancePropertyValueColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <DataInstancePropertyValue>();
            QuerySet query = GetQuerySet(db);

            query.Count <DataInstancePropertyValue>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 6
0
        public static long Count(WhereDelegate <AsyncExecutionRequestDataColumns> where, Database database = null)
        {
            AsyncExecutionRequestDataColumns c = new AsyncExecutionRequestDataColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <AsyncExecutionRequestData>();
            QuerySet query = GetQuerySet(db);

            query.Count <AsyncExecutionRequestData>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
        public static long Count(WhereDelegate <ServiceRegistryLoaderDescriptorColumns> where, Database database = null)
        {
            ServiceRegistryLoaderDescriptorColumns c = new ServiceRegistryLoaderDescriptorColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <ServiceRegistryLoaderDescriptor>();
            QuerySet query = GetQuerySet(db);

            query.Count <ServiceRegistryLoaderDescriptor>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 8
0
        public static long Count(WhereDelegate <UserIdentifierColumns> where, Database database = null)
        {
            UserIdentifierColumns c      = new UserIdentifierColumns();
            IQueryFilter          filter = where (c);

            Database db    = database ?? Db.For <UserIdentifier>();
            QuerySet query = GetQuerySet(db);

            query.Count <UserIdentifier>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 9
0
        public static long Count(WhereDelegate <NotificationSubscriptionColumns> where, Database database = null)
        {
            NotificationSubscriptionColumns c = new NotificationSubscriptionColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <NotificationSubscription>();
            QuerySet query = GetQuerySet(db);

            query.Count <NotificationSubscription>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 10
0
        public static long Count(WhereDelegate <AssemblyDescriptorAssemblyReferenceDescriptorColumns> where, Database database = null)
        {
            AssemblyDescriptorAssemblyReferenceDescriptorColumns c = new AssemblyDescriptorAssemblyReferenceDescriptorColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <AssemblyDescriptorAssemblyReferenceDescriptor>();
            QuerySet query = GetQuerySet(db);

            query.Count <AssemblyDescriptorAssemblyReferenceDescriptor>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 11
0
        public static long Count(WhereDelegate <MachineRegistriesColumns> where, Database database = null)
        {
            MachineRegistriesColumns c      = new MachineRegistriesColumns();
            IQueryFilter             filter = where (c);

            Database db    = database ?? Db.For <MachineRegistries>();
            QuerySet query = GetQuerySet(db);

            query.Count <MachineRegistries>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 12
0
        public static long Count(WhereDelegate <ClientServerConnectionColumns> where, Database database = null)
        {
            ClientServerConnectionColumns c = new ClientServerConnectionColumns();
            IQueryFilter filter             = where (c);

            Database db    = database ?? Db.For <ClientServerConnection>();
            QuerySet query = GetQuerySet(db);

            query.Count <ClientServerConnection>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
        public static long Count(WhereDelegate <DaoReferenceObjectWithForeignKeyColumns> where, Database database = null)
        {
            DaoReferenceObjectWithForeignKeyColumns c = new DaoReferenceObjectWithForeignKeyColumns();
            IQueryFilter filter = where (c);

            Database db    = database ?? Db.For <DaoReferenceObjectWithForeignKey>();
            QuerySet query = GetQuerySet(db);

            query.Count <DaoReferenceObjectWithForeignKey>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Execute a query and return the number of results
        /// </summary>
        /// <param name="where">A WhereDelegate that recieves a ListItemColumns
        /// and returns a IQueryFilter which is the result of any comparisons
        /// between ListItemColumns and other values
        /// </param>
        /// <param name="db"></param>
        public static long Count(WhereDelegate <ListItemColumns> where, Database database = null)
        {
            ListItemColumns c      = new ListItemColumns();
            IQueryFilter    filter = where (c);

            Database db = database == null?Db.For <ListItem>() : database;

            QuerySet query = GetQuerySet(db);

            query.Count <ListItem>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 15
0
        public static void QuerySetCount()
        {
            SqlClientRegistrar.Register <Item>();
            QuerySet query = new QuerySet();

            query.Count <Item>().Where <Bam.Net.Data.Tests.ItemColumns>(c => c.Name.StartsWith("Mort"));
            query.Execute(Db.For <Item>());

            long result        = query.Results[0].As <CountResult>().Value;
            long toCountResult = query.Results.ToCountResult(0);

            Expect.AreEqual(result, toCountResult);
            Out(query.Results.ToCountResult(0).ToString());
        }
Ejemplo n.º 16
0
        public static long Count(WhereDelegate <DaoReferenceObjectColumns> where, Database db = null)
        {
            DaoReferenceObjectColumns c = new DaoReferenceObjectColumns();
            IQueryFilter filter         = where (c);
            QuerySet     query          = new QuerySet();

            query.Count <DaoReferenceObject>();
            query.Where(filter);

            if (db == null)
            {
                db = Db.For <DaoReferenceObject>();
            }
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
Ejemplo n.º 17
0
        public void AlternativeSyntaxTest()
        {
            SqlClientRegistrar.Register <Item>();
            Db.TryEnsureSchema <Item>();

            Database db = Db.For(typeof(Item));

            Item createdItem = new Item();

            createdItem.Name = "Item_".RandomLetters(8);
            QuerySet query = new QuerySet();

            query.Insert <Item>(createdItem);
            query.Select <Item>().Where <ItemColumns>(c => c.Name.StartsWith("I"));
            query.Count <Item>();

            query.Execute(db);

            // alternative syntax

            //query.Insert<Item>(createdItem)
            //    .Select<Item>().Where<ItemColumns>(c => c.Name.StartsWith("I"))
            //    .Count<Item>()
            //    .Execute(db);

            // -- end alternative syntax

            Item insertedItem = query.Results.ToDao <Item>(0);

            OutLineFormat("InsertedItemId: {0}, Name: {1}", ConsoleColor.Green, insertedItem.Id, insertedItem.Name);

            ItemCollection items = query.Results[1].As <ItemCollection>();

            OutLine("** Item Results **", ConsoleColor.DarkYellow);
            items.Each(item =>
            {
                OutLineFormat("Id: {0}, Name: {1}", ConsoleColor.DarkYellow, item.Id, item.Name);
            });

            long count = query.Results[2].As <CountResult>().Value;

            OutLineFormat("Count Result: {0}", ConsoleColor.Yellow, count);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 取得数据总数量
        /// </summary>
        /// <returns></returns>
        public int Count()
        {
            var rst = QuerySet.Count();

            return(rst);
        }