This repository contains the supporting materials for Module 7 of the Azure Functions training course. It demonstrates a complete .NET 8 Web API with Azure Functions integration patterns for processing orders from multiple external suppliers.
By completing this module, students will learn:
- API Development - Building RESTful APIs with .NET 8
- Supplier Integration - Handling multiple data formats from external systems
- Data Transformation - Converting between supplier-specific and internal formats
- Azure Functions - Creating HTTP-triggered functions in an isolated worker model
- Testing - Writing comprehensive unit tests with Moq and NUnit
- Entity Framework Core - Database operations with Code First approach
This solution contains:
A complete .NET 8 Web API demonstrating:
- RESTful API design
- Entity Framework Core 8 with SQL Server
- Repository pattern for data access
- Multiple supplier integration (Speedy, Vault)
- External order processing endpoints
- Automatic database seeding
Comprehensive unit tests covering:
- 70 tests across mapping, controller, and model layers
- Mock-based testing (no in-memory database)
- Production-ready test patterns
The repository includes extensive documentation for students:
- API README.md - Complete API setup and usage guide
- EXTERNAL_ORDERS_README.md - Supplier webhook integration overview
- ENDPOINTS_SUMMARY.md - Detailed endpoint documentation
- AZURE_FUNCTIONS_HTTP_ONLY.md - HTTP-only integration pattern
- AZURE_FUNCTIONS_LAB_INSTRUCTIONS.md - Student lab exercises
- AZURE_FUNCTIONS_EXAMPLES.md - Complete function implementations
- NAMESPACE_CONSIDERATIONS.md - Important namespace guidance for Azure Functions
- Tests README.md - Test suite documentation
- TEST_SUITE_SUMMARY.md - Test coverage summary
You work for NeoWarehouse, a wholesale company that receives orders from two suppliers:
- Speedy - Uses numeric IDs and ISO timestamps
- Vault - Uses email addresses, GUIDs, and Unix timestamps
Each supplier sends orders in their own format. Your task is to create Azure Functions that:
- Accept supplier-specific formats
- Transform data to internal format
- Validate customer and product references
- Save orders to the database via the API
Learn to map between different data structures:
CustomerId(long) βCustomerEmail(string)ProductId(long) βProductCode(Guid)- DateTime β Unix timestamp
- Different address structures
Two approaches demonstrated:
- Transform Only - Data conversion without persistence
- Full Integration - Validation + transformation + database save
Modern serverless patterns:
- Non-static classes with dependency injection
HttpRequestDataandHttpResponseData- System.Text.Json serialization
- Constructor injection of IHttpClientFactory
- .NET 8 SDK
- Visual Studio 2022 or VS Code
- SQL Server (LocalDB or Express)
- Azure Functions Core Tools (for Functions development)
-
Clone the repository
git clone https://github.com/TCBWZA/Wave_AzureFunctions_NeoWarewholesale cd Wave_AzureFunctions_NeoWarewholesale
-
Set up the API
cd NeoWarewholesale.API # Install EF Core tools locally dotnet new tool-manifest dotnet tool install dotnet-ef --local # Apply migrations dotnet tool run dotnet-ef database update # Run the API dotnet run
-
Verify database seeding The database automatically seeds with:
- β 2 Suppliers (Speedy, Vault)
- β 10 Customers
- β 20 Products
- β 5 Sample orders
-
Run tests
cd ../NeoWarewholesale.Tests dotnet test
- Review the API endpoints in ENDPOINTS_SUMMARY.md
- Test the transform-only endpoints (
/fromspeedy,/fromvault) - Understand the mapping logic in
Mappings/ExternalOrderMappingExtensions.cs
Follow AZURE_FUNCTIONS_LAB_INSTRUCTIONS.md to:
- Create a new Azure Functions project (.NET 8 isolated)
- Copy required DTOs (watch for namespace considerations!)
- Implement the HTTP trigger function
- Call the main API via HTTP
- Test locally
- Create a function to handle Vault's format
- Handle ProductCode β ProductId resolution
- Convert Unix timestamps
- Test with sample data
- Test both functions locally
- Verify orders are created in the database
- Check logging output
- Handle error scenarios
Students successfully complete the module when they can:
β
Explain the difference between in-process and isolated worker models
β
Create Azure Functions with proper dependency injection
β
Transform data between different supplier formats
β
Call a REST API from an Azure Function using HttpClient
β
Handle errors gracefully with appropriate HTTP status codes
β
Write and run unit tests for their functions
β
Understand when to use Azure Functions vs. direct API integration
- .NET 8 - LTS version
- C# 12 - Language features
- ASP.NET Core Web API - RESTful services
- Azure Functions (Isolated Worker) - Serverless compute
- Entity Framework Core 8 - ORM and migrations
- SQL Server - Database
- NUnit - Testing framework
- Moq - Mocking library
- System.Text.Json - JSON serialization
- Read the comprehensive documentation in each folder
- Check the troubleshooting sections in README files
- Review the test suite for implementation examples
- Consult with your instructor
- Sample implementations provided in AZURE_FUNCTIONS_EXAMPLES.md (Not yet released.)
- Test suite demonstrates best practices
- Common pitfalls documented in NAMESPACE_CONSIDERATIONS.md
This module includes:
- Practical Labs - Hands-on Azure Functions development
- Testing - Students should test their functions
- Documentation - Students document their design decisions in comments
Module: 7 - Azure Functions Integration
Course: Azure Functions Development with .NET 8
Ready to start? Head to NeoWarewholesale.API/README.md for setup instructions!