コード例 #1
0
ファイル: HostDomain.cs プロジェクト: dekkerb115/Bam.Net
 public override IQueryFilter GetUniqueFilter()
 {
     if (UniqueFilterProvider != null)
     {
         return(UniqueFilterProvider(this));
     }
     else
     {
         var colFilter = new HostDomainColumns();
         return(colFilter.KeyColumn == IdValue);
     }
 }
コード例 #2
0
ファイル: HostDomain.cs プロジェクト: dekkerb115/Bam.Net
        public static long Count(WhereDelegate <HostDomainColumns> where, Database database = null)
        {
            HostDomainColumns c      = new HostDomainColumns();
            IQueryFilter      filter = where (c);

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

            query.Count <HostDomain>();
            query.Where(filter);
            query.Execute(db);
            return(query.Results.As <CountResult>(0).Value);
        }
コード例 #3
0
ファイル: HostDomain.cs プロジェクト: dekkerb115/Bam.Net
        public static HostDomain GetOneWhere(WhereDelegate <HostDomainColumns> where, Database database = null)
        {
            var result = OneWhere(where, database);

            if (result == null)
            {
                HostDomainColumns c      = new HostDomainColumns();
                IQueryFilter      filter = where (c);
                result = CreateFromFilter(filter, database);
            }

            return(result);
        }
コード例 #4
0
ファイル: HostDomain.cs プロジェクト: dekkerb115/Bam.Net
 public static async Task BatchQuery <ColType>(int batchSize, WhereDelegate <HostDomainColumns> where, Action <IEnumerable <HostDomain> > batchProcessor, Bam.Net.Data.OrderBy <HostDomainColumns> orderBy, Database database = null)
 {
     await System.Threading.Tasks.Task.Run(async() =>
     {
         HostDomainColumns columns = new HostDomainColumns();
         var results = Top(batchSize, where, orderBy, database);
         while (results.Count > 0)
         {
             await System.Threading.Tasks.Task.Run(() =>
             {
                 batchProcessor(results);
             });
             ColType top = results.Select(d => d.Property <ColType>(orderBy.Column.ToString())).ToArray().Largest();
             results     = Top(batchSize, (HostDomainColumns) where (columns) && orderBy.Column > top, orderBy, database);
         }
     });
 }
コード例 #5
0
ファイル: HostDomain.cs プロジェクト: dekkerb115/Bam.Net
 public static async Task BatchQuery(int batchSize, WhereDelegate <HostDomainColumns> where, Action <IEnumerable <HostDomain> > batchProcessor, Database database = null)
 {
     await System.Threading.Tasks.Task.Run(async() =>
     {
         HostDomainColumns columns = new HostDomainColumns();
         var orderBy = Bam.Net.Data.Order.By <HostDomainColumns>(c => c.KeyColumn, Bam.Net.Data.SortOrder.Ascending);
         var results = Top(batchSize, where, orderBy, database);
         while (results.Count > 0)
         {
             await System.Threading.Tasks.Task.Run(() =>
             {
                 batchProcessor(results);
             });
             long topId = results.Select(d => d.Property <long>(columns.KeyColumn.ToString())).ToArray().Largest();
             results    = Top(batchSize, (HostDomainColumns) where (columns) && columns.KeyColumn > topId, orderBy, database);
         }
     });
 }
コード例 #6
0
ファイル: HostDomain.cs プロジェクト: dekkerb115/Bam.Net
        public static HostDomainCollection Top(int count, WhereDelegate <HostDomainColumns> where, OrderBy <HostDomainColumns> orderBy, Database database = null)
        {
            HostDomainColumns c      = new HostDomainColumns();
            IQueryFilter      filter = where (c);

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

            query.Top <HostDomain>(count);
            query.Where(filter);

            if (orderBy != null)
            {
                query.OrderBy <HostDomainColumns>(orderBy);
            }

            query.Execute(db);
            var results = query.Results.As <HostDomainCollection>(0);

            results.Database = db;
            return(results);
        }