π§© Core Overview
The Core package provides the foundational infrastructure for the entire SDK.
It is responsible for handling:
- Configuration
- HTTP communication
- Serialization
- Dependency injection
- Error handling
All feature modules (such as Places and Routing) are built on top of Core.
ποΈ Architecture Roleβ
Core acts as the central layer of the SDK:
- Defines shared contracts (abstractions)
- Implements low-level communication with Google Maps APIs
- Provides reusable infrastructure for all modules
π You only configure Core once β everything else builds on top of it.
π¦ Whatβs inside Coreβ
π§Ύ Configurationβ
Centralized SDK configuration:
- API Key
- Language and region
- Request timeout
- Logging (planned)
- MemoryCache (planned)
π See: Configuration
π§© Dependency Injectionβ
Registers all required services into your application:
- HTTP client
- Serialization
- Builders and factories
π See: Dependency Injection
π§± Abstractionsβ
Core contracts that define how the SDK works internally:
IMapsApiClientIMapsJsonSerializerIRequestFactory
π See: Abstractions
π¦ Modelsβ
Shared data structures used across the SDK:
MapsApiRequestLatLng
π See: Models
π Enumsβ
Common enumerations:
ApiKeyLocation
π See: Enums
π¨ Exceptionsβ
Strongly-typed error handling model:
MapsApiException(base)- Specialized exceptions (Auth, RateLimit, etc.)
π See: Exceptions
π οΈ Extensionsβ
Helper utilities and integration helpers:
- Dependency injection extensions
- JSON parsing helpers
π See: Extensions
β‘ Typical Flowβ
Using the SDK follows a simple pattern:
var services = new ServiceCollection();
// 1. Configure Core
services.AddD3lg4doMaps(new MapsConfiguration {
ApiKey = "YOUR_API_KEY"
});
// 2. Register feature modules
services.AddD3lg4doMapsPlaces();
// 3.1 Resolve and use services
var provider = services.BuildServiceProvider();
var places = provider.GetRequiredService<IPlacesService>();
// 3.2 Receive services into your modules
public class MyService {
private readonly IPlacesService _placesService;
public MyService(IPlacesService placesService) {
_placesService = placesService;
}
}
π§ Design Principlesβ
Core is built around a few key ideas:
- Centralization β one configuration, shared everywhere
- Separation of concerns β clear boundaries between components
- Extensibility β replace internal pieces if needed
- Developer experience β minimal setup, clean API
π Next Stepβ
Now that Core is configured, you can start using a feature module:
- π See: Places Overview
- π See: Routing Overview