当前位置: 首页>>代码示例>>C#>>正文


C# RelationPredicateBucket类代码示例

本文整理汇总了C#中RelationPredicateBucket的典型用法代码示例。如果您正苦于以下问题:C# RelationPredicateBucket类的具体用法?C# RelationPredicateBucket怎么用?C# RelationPredicateBucket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RelationPredicateBucket类属于命名空间,在下文中一共展示了RelationPredicateBucket类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FetchRepoAukcija

        public static RepoAukcijaEntity FetchRepoAukcija(DataAccessAdapterBase adapter, PrefetchPath2 prefetchPath, DateTime datumAukcije)
        {
            RelationPredicateBucket bucket = new RelationPredicateBucket();
            bucket.PredicateExpression.Add(RepoAukcijaFields.DatumAukcije == datumAukcije);

            return FetchRepoAukcijaCollection(adapter, bucket, prefetchPath).SingleOrDefault();
        }
开发者ID:vjerch,项目名称:TN,代码行数:7,代码来源:RepoAukcijaEntity.cs

示例2: GetToDownload

        public static IEnumerable<ArtworkEntity> GetToDownload()
        {
            var bucket = new RelationPredicateBucket();
            bucket.Relations.Add(ArtworkEntity.Relations.ArtworkToEpisodeEntityUsingArtworkId, JoinHint.Left);
            bucket.Relations.Add(ArtworkToEpisodeEntity.Relations.EpisodeEntityUsingEpisodeId, JoinHint.Left);
            bucket.Relations.Add(EpisodeEntity.Relations.SeasonEntityUsingSeasonId,JoinHint.Left);
            bucket.Relations.Add(SeasonEntity.Relations.SeriesEntityUsingSeriesId, JoinHint.Left);

            bucket.Relations.Add(ArtworkEntity.Relations.ArtworkToPersonEntityUsingArtworkId, JoinHint.Left);

            bucket.Relations.Add(ArtworkEntity.Relations.ArtworkToRoleEntityUsingArtworkId, JoinHint.Left);
            bucket.Relations.Add(ArtworkToRoleEntity.Relations.RoleEntityUsingRoleId, JoinHint.Left);
            bucket.Relations.Add(RoleEntity.Relations.RoleToSeriesEntityUsingRoleId, JoinHint.Left);
            bucket.Relations.Add(RoleToSeriesEntity.Relations.SeriesEntityUsingSeriesId, JoinHint.Left);

            bucket.Relations.Add(ArtworkEntity.Relations.ArtworkToSeasonEntityUsingArtworkId, JoinHint.Left);
            bucket.Relations.Add(ArtworkToSeasonEntity.Relations.SeasonEntityUsingSeasonId, JoinHint.Left);
            bucket.Relations.Add(SeasonEntity.Relations.SeriesEntityUsingSeriesId, JoinHint.Left);

            bucket.Relations.Add(ArtworkEntity.Relations.ArtworkToSeriesEntityUsingArtworkId, JoinHint.Left);
            bucket.Relations.Add(ArtworkToSeriesEntity.Relations.SeriesEntityUsingSeriesId, JoinHint.Left);

            bucket.PredicateExpression.Add(ArtworkFields.IsDownloadedOnMaster == false);

            var prefetchPath = new PrefetchPath2(EntityType.ArtworkEntity);
            prefetchPath.Add(ArtworkEntity.PrefetchPathArtworkToEpisodes).SubPath.Add(ArtworkToEpisodeEntity.PrefetchPathEpisode).SubPath.Add(EpisodeEntity.PrefetchPathSeason).SubPath.Add(SeasonEntity.PrefetchPathSeries);
            prefetchPath.Add(ArtworkEntity.PrefetchPathArtworkToPeople);
            prefetchPath.Add(ArtworkEntity.PrefetchPathArtworkToRoles).SubPath.Add(ArtworkToRoleEntity.PrefetchPathRole).SubPath.Add(RoleEntity.PrefetchPathRoleToSeries).SubPath.Add(RoleToSeriesEntity.PrefetchPathSeries);
            prefetchPath.Add(ArtworkEntity.PrefetchPathArtworkToSeasons).SubPath.Add(ArtworkToSeasonEntity.PrefetchPathSeason).SubPath.Add(SeasonEntity.PrefetchPathSeries);
            prefetchPath.Add(ArtworkEntity.PrefetchPathArtworkToSeries).SubPath.Add(ArtworkToSeriesEntity.PrefetchPathSeries);

            return Database.GetEntityCollection<ArtworkEntity>(bucket, prefetchPath);
        }
开发者ID:MichelZ,项目名称:TVJunkie,代码行数:33,代码来源:ArtworkEntity.cs

示例3: FetchArtiklCollectionForPaging

		/// <summary>
        /// Efficient pageing for grid.
        /// </summary>
        /// <param name="pageNumber">Must be greater than zero.</param>
        /// <param name="sortDirection">Validne vrijednosti su 'asc' i 'desc'.</param>
        public static EntityCollection<ArtiklEntity> FetchArtiklCollectionForPaging(DataAccessAdapterBase adapter,
			RelationPredicateBucket bucket,
			PrefetchPath2 prefetchPath,
            int pageNumber,
            int pageSize,
            string sortField,
			bool isSortAscending)
        {
			string sortDirection = isSortAscending ? "asc" : "desc";

            Type sortEntityFieldType = typeof(ArtiklFields);
            string sortEntityFieldTypeName = SortHelper.GetEntityFieldTypeNameForSorting(sortField, sortEntityFieldType);
            if (!string.IsNullOrWhiteSpace(sortEntityFieldTypeName))
            {
                sortEntityFieldType = Type.GetType(sortEntityFieldTypeName);
            }

            sortField = SortHelper.GetSortField(sortField);			

			SortExpression sort = SortHelper.GetSortExpression(sortField, sortDirection, sortEntityFieldType);
			
            EntityCollection<ArtiklEntity> toReturn = new EntityCollection<ArtiklEntity>(new ArtiklEntityFactory());
            adapter.FetchEntityCollection(toReturn, bucket, pageSize, sort, prefetchPath, pageNumber, pageSize);

            return toReturn;
        }
开发者ID:malininja,项目名称:NinjaSoftware.Enio,代码行数:31,代码来源:ArtiklEntity.cs

示例4: FetchUser

        public static UserEntity FetchUser(DataAccessAdapterBase adapter, string userName, string passwordHash)
        {
            RelationPredicateBucket bucket = new RelationPredicateBucket();
            bucket.PredicateExpression.Add(UserFields.Username == userName);
            bucket.PredicateExpression.Add(UserFields.Password == passwordHash);

            return FetchUserCollection(adapter, bucket, null).SingleOrDefault();
        }
开发者ID:vjerch,项目名称:TN,代码行数:8,代码来源:UserEntity.cs

示例5: Exists

        public static bool Exists(int seriesId, int seasonNumber, int episodeNumber)
        {
            var bucket = new RelationPredicateBucket();
            bucket.Relations.Add(Relations.SeasonEntityUsingSeasonId);
            bucket.PredicateExpression.Add(SeasonFields.SeasonNumber == seasonNumber);
            bucket.PredicateExpression.Add(SeasonFields.SeriesId == seriesId);
            bucket.PredicateExpression.Add(EpisodeFields.EpisodeNumber == episodeNumber);

            return Database.GetEntityCollection<EpisodeEntity>(bucket).Any();
        }
开发者ID:MichelZ,项目名称:TVJunkie,代码行数:10,代码来源:EpisodeEntity.cs

示例6: GetPopularGroups

        /// <summary>
        /// Retrieves a list of groups matching the criteria specified via method parameters.
        /// </summary>
        /// <param name="category">Category name.</param>
        /// <param name="categoryId">Category Id</param>
        /// <param name="pageNumber">Page number.</param>
        /// <param name="pageSize">Page size.</param>
        /// <param name="recordCount">Record count.</param>
        /// <returns>List of groups.</returns>
        public List<MonoSoftware.MonoX.Repositories.SnGroupDTO> GetPopularGroups(string category, Guid categoryId, int pageNumber, int pageSize, out int recordCount)
        {
            RelationPredicateBucket filter = new RelationPredicateBucket();

            //introduced to filter out groups by languages and applications
            filter.Relations.Add(SnGroupEntity.Relations.SnGroupCategoryEntityUsingGroupCategoryId, JoinHint.Left);
            //Note: MonoX supports the multi application environment so general filter for all DB access calls should contain the application id filter
            filter.PredicateExpression.Add(SnGroupCategoryFields.ApplicationId == MonoSoftware.MonoX.Repositories.MembershipRepository.GetInstance().GetApplicationId());
            //Note: MonoX in supports the multi language environment so general filter for all DB access calls should contain the language id filter
            filter.PredicateExpression.Add(SnGroupCategoryFields.LanguageId == LocalizationUtility.GetCurrentLanguageId());

            //Filter groups by category
            if (categoryId != Guid.Empty)
            {
                filter.PredicateExpression.Add(SnGroupFields.GroupCategoryId == categoryId);
            }
            if (!String.IsNullOrEmpty(category))
            {
                filter.PredicateExpression.Add(SnGroupCategoryFields.Slug == category);
            }

            IPrefetchPath2 prefetch = new PrefetchPath2((int)EntityType.SnGroupEntity);
            prefetch.Add(SnGroupEntity.PrefetchPathSnGroupCategory);
            //Fetch a record from the members table only for the current user so his status could be read
            Guid uid = SecurityUtility.GetUserId();
            if (!Guid.Empty.Equals(uid))
            {
                PredicateExpression memberFilter = new PredicateExpression(SnGroupMemberFields.UserId == uid);
                prefetch.Add(SnGroupEntity.PrefetchPathSnGroupMembers, 1, memberFilter);
            }

            #region Popular groups sorter
            const string memberCountField = "MemberCountField";
            const string memberCountTableName = "MemberCountTable";

            EntityFields2 memberFields = new EntityFields2(2);
            memberFields.DefineField(SnGroupMemberFields.GroupId, 0);
            memberFields.DefineField(SnGroupMemberFields.Id, 1, memberCountField, AggregateFunction.Count);
            DerivedTableDefinition memberCountTable = new DerivedTableDefinition(memberFields, memberCountTableName, null, new GroupByCollection(memberFields[0]));

            IDynamicRelation memberCountRelation = new DynamicRelation(memberCountTable, JoinHint.Right, MonoSoftware.MonoX.DAL.EntityType.SnGroupEntity, String.Empty, SnGroupMemberFields.GroupId.SetObjectAlias(memberCountTable.Alias) == SnGroupFields.Id);
            filter.Relations.Add(memberCountRelation);

            ISortExpression sorter = new SortExpression(new SortClause(new EntityField2(memberCountField, null).SetObjectAlias(memberCountTableName), null, SortOperator.Descending));
            #endregion

            EntityCollection<SnGroupEntity> groups = new EntityCollection<SnGroupEntity>();
            //Fetch the group collection
            FetchEntityCollection(groups, filter, 0, sorter, prefetch, pageNumber, pageSize);
            //Fetch the group total count used by paging
            recordCount = GetDbCount(groups, filter);
            //Transfer group entities to the DTO
            List<MonoSoftware.MonoX.Repositories.SnGroupDTO> toReturn = groups.Select(group => new MonoSoftware.MonoX.Repositories.SnGroupDTO(group)).ToList<MonoSoftware.MonoX.Repositories.SnGroupDTO>();
            return toReturn;
        }
开发者ID:MonoSoftware,项目名称:MonoX-Sample-Solution,代码行数:64,代码来源:PopularGroupRepository.cs

示例7: FetchTrgovanjeGlavaHnbCollection

        public static EntityCollection<TrgovanjeGlavaHnbEntity> FetchTrgovanjeGlavaHnbCollection(DataAccessAdapterBase adapter,
            DateTime startDate,
            DateTime endDate)
        {
            RelationPredicateBucket bucket = new RelationPredicateBucket();
            bucket.PredicateExpression.Add(PredicateHelper.FilterValidEntities(startDate, endDate, TrgovanjeGlavaHnbFields.Datum));

            PrefetchPath2 prefetchPath = new PrefetchPath2(EntityType.TrgovanjeGlavaHnbEntity);
            prefetchPath.Add(TrgovanjeGlavaHnbEntity.PrefetchPathTrgovanjeStavkaHnbCollection);

            return FetchTrgovanjeGlavaHnbCollection(adapter, bucket, prefetchPath);
        }
开发者ID:vjerch,项目名称:TN,代码行数:12,代码来源:TrgovanjeGlavaHnbEntity.cs


注:本文中的RelationPredicateBucket类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。