public QuarterlyOrderCollectionResponse Fetch(QuarterlyOrderQueryCollectionRequest request) { base.FixupLimitAndPagingOnRequest(request); var totalItemCount = 0; var sortExpression = RepositoryHelper.ConvertStringToSortExpression(TypedViewType, request.Sort); var includedFieldNames = RepositoryHelper.ConvertStringToExcludedIncludedFields(request.Select); var predicateBucket = RepositoryHelper.ConvertStringToRelationPredicateBucket(TypedViewType, request.Filter); var typedView = new QuarterlyOrderTypedView(); using (var adapter = DataAccessAdapterFactory.NewDataAccessAdapter()) { OnBeforeFetchQuarterlyOrderQueryCollectionRequest(adapter, request, sortExpression, includedFieldNames, predicateBucket, request.PageNumber, request.PageSize, request.Limit); totalItemCount = (int)adapter.GetDbCount(typedView.GetFieldsInfo(), predicateBucket, null, false); adapter.FetchTypedView(typedView.GetFieldsInfo(), typedView, predicateBucket, request.Limit, sortExpression, true, null, request.PageNumber, request.PageSize); OnAfterFetchQuarterlyOrderQueryCollectionRequest(adapter, request, typedView, sortExpression, includedFieldNames, predicateBucket, request.PageNumber, request.PageSize, request.Limit, totalItemCount); } var dtos = new QuarterlyOrderCollection(); var enumerator = typedView.GetEnumerator(); while (enumerator.MoveNext()) { dtos.Add(Map(enumerator.Current, includedFieldNames)); } var response = new QuarterlyOrderCollectionResponse(dtos, request.PageNumber, request.PageSize, totalItemCount); return(response); }
partial void OnAfterFetchQuarterlyOrderQueryCollectionRequest(IDataAccessAdapter adapter, QuarterlyOrderQueryCollectionRequest request, QuarterlyOrderTypedView typedView, SortExpression sortExpression, string[] includedFieldNames, IRelationPredicateBucket predicateBucket, int pageNumber, int pageSize, int limit, int totalItemCount);