Use Case
Overview
The EBusiness application is a comprehensive e-commerce solution built using FlexBase Framework, demonstrating real-world implementation of enterprise features. This application showcases how to build scalable, maintainable business applications following Domain-Driven Design (DDD) principles and Clean Architecture patterns.
Application Architecture
Domain Focus
E-Commerce Business: Complete online shopping platform
Multi-Tenant Support: Serve multiple customers with isolated data
Event-Driven Architecture: Asynchronous processing for scalability
CQRS Pattern: Separate read and write operations for performance
Key Business Capabilities
Order Management: Complete order lifecycle from creation to fulfillment
Product Catalog: Product management with inventory tracking
Customer Management: User registration, authentication, and profile management
Payment Processing: Secure payment handling and transaction management
Inventory Management: Stock tracking and low inventory alerts
Reporting & Analytics: Business intelligence and reporting capabilities
Feature Implementation List
1. Order Management Features
Command Features (Data Modification)
AddOrder - Create new customer orders
Flow:
POST /api/Orders/AddOrder
Handler:
AddOrderHandler.cs
Event:
OrderCreatedEvent
(Eventual)Use Case: Customer places order, inventory reserved, confirmation sent
UpdateOrder - Modify existing orders
Flow:
PUT /api/Orders/UpdateOrder
Handler:
UpdateOrderHandler.cs
Event:
OrderUpdatedEvent
(Eventual)Use Case: Update order details, change shipping address
CancelOrder - Cancel pending orders
Flow:
PUT /api/Orders/CancelOrder
Handler:
CancelOrderHandler.cs
Event:
OrderCancelledEvent
(Eventual)Use Case: Customer cancels order, inventory released
ProcessOrder - Process order for fulfillment
Flow:
PUT /api/Orders/ProcessOrder
Handler:
ProcessOrderHandler.cs
Event:
OrderProcessedEvent
(Eventual)Use Case: Warehouse processes order, shipping label generated
Query Features (Data Retrieval)
GetOrderById - Retrieve specific order details
Flow:
GET /api/Orders/GetOrderById/{id}
Query:
GetOrderByIdQuery.cs
Use Case: Customer views order details, admin order lookup
GetOrders - List all orders with filtering
Flow:
GET /api/Orders/GetOrders
Query:
GetOrdersQuery.cs
Use Case: Admin order management, customer order history
GetOrdersPaged - Paginated order list
Flow:
GET /api/Orders/GetOrdersPaged
Query:
GetOrdersPagedQuery.cs
Use Case: Large order lists with pagination support
GetCustomerOrders - Orders for specific customer
Flow:
GET /api/Orders/GetCustomerOrders/{customerId}
Query:
GetCustomerOrdersQuery.cs
Use Case: Customer order history, account management
2. Product Management Features
Command Features (Data Modification)
AddProduct - Create new products
Flow:
POST /api/Products/AddProduct
Handler:
AddProductHandler.cs
Event:
ProductCreatedEvent
(Eventual)Use Case: Admin adds new product to catalog
UpdateProduct - Modify product information
Flow:
PUT /api/Products/UpdateProduct
Handler:
UpdateProductHandler.cs
Event:
ProductUpdatedEvent
(Eventual)Use Case: Update product details, pricing, descriptions
UpdateInventory - Adjust product stock levels
Flow:
PUT /api/Products/UpdateInventory
Handler:
UpdateInventoryHandler.cs
Event:
InventoryUpdatedEvent
(Eventual)Use Case: Stock adjustments, receiving shipments
DeactivateProduct - Soft delete products
Flow:
PUT /api/Products/DeactivateProduct
Handler:
DeactivateProductHandler.cs
Event:
ProductDeactivatedEvent
(Eventual)Use Case: Discontinue products, seasonal items
Query Features (Data Retrieval)
GetProductById - Retrieve specific product
Flow:
GET /api/Products/GetProductById/{id}
Query:
GetProductByIdQuery.cs
Use Case: Product detail pages, admin product management
GetProducts - List products with filtering
Flow:
GET /api/Products/GetProducts
Query:
GetProductsQuery.cs
Use Case: Product catalog browsing, search results
GetProductsPaged - Paginated product list
Flow:
GET /api/Products/GetProductsPaged
Query:
GetProductsPagedQuery.cs
Use Case: Large product catalogs with pagination
SearchProducts - Product search functionality
Flow:
GET /api/Products/SearchProducts
Query:
SearchProductsQuery.cs
Use Case: Customer product search, admin product lookup
3. Customer Management Features
Command Features (Data Modification)
RegisterCustomer - Create new customer accounts
Flow:
POST /api/Customers/RegisterCustomer
Handler:
RegisterCustomerHandler.cs
Event:
CustomerRegisteredEvent
(Eventual)Use Case: New customer registration, welcome email sent
UpdateCustomer - Modify customer information
Flow:
PUT /api/Customers/UpdateCustomer
Handler:
UpdateCustomerHandler.cs
Event:
CustomerUpdatedEvent
(Eventual)Use Case: Profile updates, address changes
DeactivateCustomer - Soft delete customer accounts
Flow:
PUT /api/Customers/DeactivateCustomer
Handler:
DeactivateCustomerHandler.cs
Event:
CustomerDeactivatedEvent
(Eventual)Use Case: Account closure, compliance requirements
Query Features (Data Retrieval)
GetCustomerById - Retrieve specific customer
Flow:
GET /api/Customers/GetCustomerById/{id}
Query:
GetCustomerByIdQuery.cs
Use Case: Customer profile pages, admin customer lookup
GetCustomers - List customers with filtering
Flow:
GET /api/Customers/GetCustomers
Query:
GetCustomersQuery.cs
Use Case: Admin customer management, customer support
GetCustomersPaged - Paginated customer list
Flow:
GET /api/Customers/GetCustomersPaged
Query:
GetCustomersPagedQuery.cs
Use Case: Large customer databases with pagination
4. Payment Processing Features
Command Features (Data Modification)
ProcessPayment - Handle payment transactions
Flow:
POST /api/Payments/ProcessPayment
Handler:
ProcessPaymentHandler.cs
Event:
PaymentProcessedEvent
(Eventual)Use Case: Credit card processing, order payment
RefundPayment - Process payment refunds
Flow:
POST /api/Payments/RefundPayment
Handler:
RefundPaymentHandler.cs
Event:
PaymentRefundedEvent
(Eventual)Use Case: Order cancellations, returns processing
Query Features (Data Retrieval)
GetPaymentById - Retrieve payment details
Flow:
GET /api/Payments/GetPaymentById/{id}
Query:
GetPaymentByIdQuery.cs
Use Case: Payment verification, transaction lookup
GetPayments - List payments with filtering
Flow:
GET /api/Payments/GetPayments
Query:
GetPaymentsQuery.cs
Use Case: Financial reporting, transaction history
5. Inventory Management Features
Command Features (Data Modification)
AdjustInventory - Modify stock levels
Flow:
PUT /api/Inventory/AdjustInventory
Handler:
AdjustInventoryHandler.cs
Event:
InventoryAdjustedEvent
(Eventual)Use Case: Stock adjustments, receiving shipments
ReserveInventory - Reserve stock for orders
Flow:
PUT /api/Inventory/ReserveInventory
Handler:
ReserveInventoryHandler.cs
Event:
InventoryReservedEvent
(Eventual)Use Case: Order processing, stock allocation
Query Features (Data Retrieval)
GetInventoryLevels - Check stock levels
Flow:
GET /api/Inventory/GetInventoryLevels
Query:
GetInventoryLevelsQuery.cs
Use Case: Stock monitoring, low inventory alerts
GetLowStockItems - Identify items needing restocking
Flow:
GET /api/Inventory/GetLowStockItems
Query:
GetLowStockItemsQuery.cs
Use Case: Purchasing decisions, inventory alerts
Event-Driven Processing
Event Subscribers
OrderCreatedSubscriber - Handles order creation events
Actions: Send confirmation email, reserve inventory, update analytics
PaymentProcessedSubscriber - Handles payment events
Actions: Update order status, send receipt, trigger fulfillment
InventoryLowSubscriber - Handles low inventory events
Actions: Send alerts to purchasing, update product status
CustomerRegisteredSubscriber - Handles customer registration
Actions: Send welcome email, create customer profile, update marketing
Technology Implementation
Framework Components
FlexBase Framework: Core enterprise framework
Entity Framework Core: Data access and ORM
NServiceBus: Message bus and event handling
ASP.NET Core: Web API and controllers
AutoMapper: Object mapping and DTOs
Database Support
SQL Server: Primary database
MySQL: Alternative database option
PostgreSQL: Cross-platform database support
Multi-Tenant: Isolated data per customer
Message Bus Options
RabbitMQ: High-performance messaging
Azure Service Bus: Cloud-native messaging
SQL Server Transport: Database-based messaging
Learning Transport: Development and testing
Business Value
Scalability
Horizontal Scaling: Add more instances as needed
Database Scaling: Separate read/write databases
Message Bus Scaling: Handle high message volumes
Maintainability
Clear Separation: Commands vs Queries
Domain Focus: Business logic in domain layer
Testability: Each component can be tested independently
Performance
CQRS: Optimized read and write operations
Event Sourcing: Track all changes for audit
Caching: Fast data retrieval for frequently accessed data
This EBusiness application demonstrates how FlexBase Framework enables rapid development of enterprise-grade applications with clean architecture, scalable design, and maintainable code! 🚀
Last updated