Skip to content

How To Save The TimeZoneDb

Chris Dostert edited this page Jan 17, 2014 · 4 revisions

Summary

TimeZoneDb is built to be persistence agnostic. By default it will store its data in memory. If you want to save it somewhere else it's as simple as implementing two interfaces(ITimeZoneRepository and IDaylightSavingsAdjustmentRepository), and passing them to TimeZoneDbUseCases when you instantiate it, as demonstrated below.

Example

// instantiate custom implementations of the repository interfaces
var customTimeZoneRepository = new CustomTimeZoneRepository();
var customDaylightSavingsAdjustmentRepository = new CustomDaylightSavingsAdjustmentRepository();

// this will load TimeZoneDb into custom data source
var timeZoneDbUseCases = 
new TimeZoneDbUseCases(customTimeZoneRepository,customDaylightSavingsAdjustmentRepository);
Clone this wiki locally