public CurrentProductListCollectionResponse Fetch(CurrentProductListQueryCollectionRequest 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 CurrentProductListTypedView(); using (var adapter = DataAccessAdapterFactory.NewDataAccessAdapter()) { OnBeforeFetchCurrentProductListQueryCollectionRequest(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); OnAfterFetchCurrentProductListQueryCollectionRequest(adapter, request, typedView, sortExpression, includedFieldNames, predicateBucket, request.PageNumber, request.PageSize, request.Limit, totalItemCount); } var dtos = new CurrentProductListCollection(); var enumerator = typedView.GetEnumerator(); while (enumerator.MoveNext()) { dtos.Add(Map(enumerator.Current, includedFieldNames)); } var response = new CurrentProductListCollectionResponse(dtos, request.PageNumber, request.PageSize, totalItemCount); return(response); }
/// <summary>Queries 'CurrentProductList' typed view records using sorting, filtering, paging and more.</summary> public CurrentProductListCollectionResponse Get(CurrentProductListQueryCollectionRequest request) { OnBeforeGetCurrentProductListQueryCollectionRequest(request); var output = Repository.Fetch(request); OnAfterGetCurrentProductListQueryCollectionRequest(request, output); return(output); }
partial void OnAfterFetchCurrentProductListQueryCollectionRequest(IDataAccessAdapter adapter, CurrentProductListQueryCollectionRequest request, CurrentProductListTypedView typedView, SortExpression sortExpression, string[] includedFieldNames, IRelationPredicateBucket predicateBucket, int pageNumber, int pageSize, int limit, int totalItemCount);
partial void OnBeforeFetchCurrentProductListQueryCollectionRequest(IDataAccessAdapter adapter, CurrentProductListQueryCollectionRequest request, SortExpression sortExpression, string[] includedFieldNames, IRelationPredicateBucket predicateBucket, int pageNumber, int pageSize, int limit);
partial void OnAfterGetCurrentProductListQueryCollectionRequest(CurrentProductListQueryCollectionRequest request, CurrentProductListCollectionResponse response);
partial void OnBeforeGetCurrentProductListQueryCollectionRequest(CurrentProductListQueryCollectionRequest request);