public TrackableContext(TraceWriter writer) { try { if (Utils.GetAppSetting("Environment") == "Local") { TrackableDbContext.LoadSqlServerTypes(Environment.CurrentDirectory); } else { TrackableDbContext.LoadSqlServerTypes(@"D:\home\site\wwwroot"); } this.DbContext = new TrackableDbContext(Utils.GetAppSetting("DatabaseConnection")); this.LocationRepository = RepositoryFactory.CreateLocationRepository(this.DbContext); this.TrackingPointRepository = RepositoryFactory.CreateTrackingPointRepository(this.DbContext); this.ConfigurationRepository = RepositoryFactory.CreateConfigurationRepository(this.DbContext); this.TripRepository = RepositoryFactory.CreateTripRepository(this.DbContext); this.AssetRepository = RepositoryFactory.CreateAssetRepository(this.DbContext); this.TripDetectorFactory = new TripDetectorFactory( this.ConfigurationRepository, this.TripRepository, this.TrackingPointRepository, this.LocationRepository, Utils.GetAppSetting("BingMapsKey")); this.LoggerFactory = new LoggerFactory(); this.LoggerFactory.AddProvider(new TraceWriterProvider(writer, null)); this.traceWriter = writer; } catch (Exception e) { writer.Error("Error initializing trackable context", e); throw; } }