Skip to main content

🧩 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:

  • IMapsApiClient
  • IMapsJsonSerializer
  • IRequestFactory

πŸ‘‰ See: Abstractions


πŸ“¦ Models​

Shared data structures used across the SDK:

  • MapsApiRequest
  • LatLng

πŸ‘‰ 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: