Get List Example

Overview

This document demonstrates the complete Get List flow using the GetShippingDetails feature from the EBusiness application. The flow starts with a GET request to the controller and uses Query projects instead of Handlers in the DomainHandler section for data retrieval. This is similar to Get Paged List but returns a simple IEnumerable<T> without pagination.

Complete Flow Architecture

GET Request → Controller → Service → Query Handler → RESTClient → External System

Response ← Controller ← Service ← Query Handler ← RESTClient ← External System

Detailed Flow Breakdown

1. GET Request

2. Controller (API Entry Point)

3. Service Layer (Business Orchestration)

4. Query Handler (RESTClient Integration)
   ├── Internal DTO → Request DTO Mapping
   ├── RESTClient Call to External System
   └── Response DTO → Internal DTO Mapping

5. Response (Simple List)

Step-by-Step Implementation

1. API Controller - The Entry Point

File: ShippingController_GetShippingDetails.cs

What Happens:

  • HTTP Method: GET /api/Shipping/GetShippingDetails

  • Input: GetShippingDetailsParams from query parameters

  • Action: Calls the service layer to process the query

  • Response: HTTP 200 OK with IEnumerable<GetShippingDetailsDto>

2. Service Layer - Business Orchestration

File: ProcessShippingService_GetShippingDetails.cs

What Happens:

  • Query Resolution: Gets the FlexiQuery instance for GetShippingDetails

  • Parameter Assignment: Assigns query parameters to the query handler

  • Query Execution: Calls the Fetch() method to execute the query

  • Result: Returns simple list of shipping details for lookup

3. Query Handler - RESTClient Integration

File: GetShippingDetails.cs

What Happens:

  • Parameter Assignment: Stores query parameters for use in RESTClient calls

  • Request Mapping: Converts internal parameters to Request DTO

  • RESTClient Call: Calls external shipping service via RESTClient

  • Response Mapping: Converts Response DTO to Internal DTO list

  • Error Handling: Handles success/failure responses from external system

  • Data Transformation: Applies business logic during mapping

4. Query Parameters - Input DTO

File: GetShippingDetailsParams.cs

What Happens:

  • Custom Filters: Allows filtering by search term, order ID, status, date range

  • Limit Support: Optional limit for lookup results

  • Query Parameters: Automatically bound from URL query string

5. Output DTO - Data Transfer Object

File: GetShippingDetailsDto.cs

What Happens:

  • Lookup Data: Contains essential fields for dropdown/lookup scenarios

  • Minimal Structure: Only includes necessary fields for selection

  • Performance: Lightweight DTO for fast loading

6. AutoMapper Configuration - Data Transformation

File: GetShippingDetailsMapperConfiguration.cs

What Happens:

  • Entity to DTO Mapping: Maps domain entities to DTOs

  • Custom Mappings: Handles complex property transformations

  • Lookup Optimization: Maps only necessary fields for lookup scenarios

Key Differences from Get Paged List

Get List vs Get Paged List Characteristics

Aspect
Get List
Get Paged List

Return Type

IEnumerable<T>

FlexiPagedList<T>

Pagination

❌ No pagination

✅ Built-in pagination

Use Case

Lookup/Dropdown

Data grids/tables

Performance

Fast for small datasets

Optimized for large datasets

Memory Usage

Lower (no pagination metadata)

Higher (includes pagination info)

Controller Method

RunQueryListService

RunQueryPagedService

Query Base

FlexiQueryEnumerableBridge

FlexiQueryPagedListBridge

Get List-Specific Features

  1. Simple List: Returns basic IEnumerable<T> without pagination

  2. Lookup Optimized: Designed for dropdown/lookup scenarios

  3. Lightweight: Minimal data transfer for performance

  4. No Pagination: All results returned in single response

  5. Fast Loading: Optimized for quick data retrieval

Common Use Cases

  • Dropdown Lists: Populate dropdown controls

  • Lookup Tables: Search and select scenarios

  • Reference Data: Load reference data for forms

  • Auto-complete: Provide suggestions for input fields

  • Quick Filters: Fast filtering options

Flow Summary

Synchronous Flow (Data Retrieval)

  1. GET Request → Controller receives request with query parameters

  2. Service Processing → Business orchestration and query resolution

  3. Query Handler → Database query building and execution

  4. AutoMapper → Entity-to-DTO transformation

  5. Response → HTTP 200 OK with simple list

No Asynchronous Flow

  • No Events: Query operations don't publish events

  • No Subscribers: No side effects or event processing

  • Immediate Response: Data is returned immediately

Query Building Patterns

Basic Query Building

Advanced Query Building

Performance Considerations

Optimization Strategies

  1. Limit Results: Always apply reasonable limits for lookup scenarios

  2. Selective Fields: Only return necessary fields in DTO

  3. Indexing: Ensure proper database indexes on filter fields

  4. Caching: Consider caching for frequently accessed lookup data

  5. Lazy Loading: Use lazy loading for related entities when appropriate

When to Use Get List vs Get Paged List

Scenario
Use Get List
Use Get Paged List

Dropdown Population

✅ Yes

❌ No

Lookup Tables

✅ Yes

❌ No

Auto-complete

✅ Yes

❌ No

Data Grids

❌ No

✅ Yes

Large Datasets

❌ No

✅ Yes

Admin Interfaces

❌ No

✅ Yes

Reporting

❌ No

✅ Yes

Key Benefits

  • Performance: Fast loading for small datasets

  • Simplicity: Simple list without pagination complexity

  • Lookup Optimized: Perfect for dropdown/lookup scenarios

  • Lightweight: Minimal data transfer

  • Type Safety: Strongly typed DTOs and parameters

  • AutoMapper: Automatic entity-to-DTO mapping

  • No Side Effects: Read-only operations

  • Testable: Each component can be tested independently

  • Maintainable: Clear separation of concerns


This GetShippingDetails example demonstrates how FlexBase enables clean, maintainable, and scalable list operations optimized for lookup and dropdown scenarios! 🚀

Last updated