This document demonstrates the complete Get List flow using the GetProductsForLookup 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 → Database → Response
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
Simple List: Returns basic IEnumerable<T> without pagination
Lookup Optimized: Designed for dropdown/lookup scenarios
Lightweight: Minimal data transfer for performance
No Pagination: All results returned in single response
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)
GET Request → Controller receives request with query parameters
Service Processing → Business orchestration and query resolution
Query Handler → Database query building and execution
AutoMapper → Entity-to-DTO transformation
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
Limit Results: Always apply reasonable limits for lookup scenarios
Selective Fields: Only return necessary fields in DTO
Indexing: Ensure proper database indexes on filter fields
Caching: Consider caching for frequently accessed lookup data
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 GetProductsForLookup example demonstrates how FlexBase enables clean, maintainable, and scalable list operations optimized for lookup and dropdown scenarios! 🚀
public IEnumerable<GetProductsForLookupDto> GetProductsForLookup(GetProductsForLookupParams @params)
{
return _flexHost.GetFlexiQuery<GetProductsForLookup>().AssignParameters(@params).Fetch();
}
public class GetProductsForLookup : FlexiQueryEnumerableBridge<Product, GetProductsForLookupDto>
{
protected readonly ILogger<GetProductsForLookup> _logger;
protected GetProductsForLookupParams _params;
protected readonly RepoFactory _repoFactory;
public GetProductsForLookup(ILogger<GetProductsForLookup> logger, RepoFactory repoFactory)
{
_logger = logger;
_repoFactory = repoFactory;
}
public virtual GetProductsForLookup AssignParameters(GetProductsForLookupParams @params)
{
_params = @params;
return this;
}
public override IEnumerable<GetProductsForLookupDto> Fetch()
{
var result = Build<Product>().SelectTo<GetProductsForLookupDto>().ToList();
return result;
}
protected override IQueryable<T> Build<T>()
{
_repoFactory.Init(_params);
IQueryable<T> query = _repoFactory.GetRepo().FindAll<T>();
//Build Your Query Here
return query;
}
}
public class GetProductsForLookupParams : DtoBridge
{
// Add custom filtering parameters here
public string SearchTerm { get; set; }
public string CategoryId { get; set; }
public bool? IsActive { get; set; }
public int? Limit { get; set; }
}
public partial class GetProductsForLookupDto : DtoBridge
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public string CategoryName { get; set; }
public bool IsActive { get; set; }
}